FORUMS
Remove All Ads from XDA

[Guide] Unlock/Root/Update/Relock for BQ Aquaris X2 pro (zangyapro)

17 posts
Thanks Meter: 26
 
By luk.giak, Junior Member on 30th November 2018, 01:51 PM
Post Reply Email Thread
Introduction
I'm writing this thread to summarize useful information about the BQ Aquaris X2 pro such as:
  1. preliminary actions (adb and fastboot configuration)
  2. unlocking the bootloader
  3. flash a factory image
  4. root the device (currently without TWRP)
  5. updating the device without losing root
  6. relocking the bootloader

I own this phone since July 2018. I started writing my notes in August 2018 in the form of a Google document (link here). I shared this document with some telegram groups and some people I know.
Now I that I think it can be more useful to summarize all my notes here on XDA so that all interested people can access it.

DISCLAIMER:
By attempting any of the processes listed in this thread you accept full responsibility for your actions. I have no responsibility about your actions.

1) Preliminary actions
1.1) Developer options, USB debugging and Unlock OEM
The first thing you need to do is to enable Developer options, USB debugging and Unlock OEM. Hence:
  • enable “Developer options” by hitting 7 times on the build number (Got to settings --> about phone)
  • enter the new menu “Developer options” and,
  • enable “USB debugging”
  • enable “Unlock OEM”

1.2) Download and configure abd and fastboot
All steps listed in this guide will require the use of Google Platform tools. I suggest the use of the one provided by Google here: https://developer.android.com/studio...platform-tools.

Download the one for your operating system:
Click image for larger version

Name:	Screenshot 2018-11-30 at 10.01.00.png
Views:	472
Size:	142.3 KB
ID:	4655394

Be sure that your terminal can access adb and fastboot from every position by configuring the PATH. I'm use to configure the PATH on the fly when I need it. As I said before, I work on Linux/macOS where you can set the PATH by:
  • opening a terminal and running:
Code:
export PATH=$PATH:path_to_platform_tools
2) Unlock the bootloader
Unlocking the booloader will wipe your phone. So backup your data first.
The good news here is that this phone can be handled like a Nexus/Pixel phone. Therefore, the procedure to unlock the bootloader is straightforward:
  1. do all stuff at point 1.1 and 1.2
  2. open a terminal
  3. plug your phone to the PC
  4. reboot into the bootloader

    Code:
    adb reboot bootloader
  5. run the code:
    Code:
    fastboot flashing unlock
  6. now you have to wait until your phone reboots. It takes a while, don't panic!!! When the phone is on the initial screen turn it off and reboot into the bottloader again by holing 'power + volume down'.
  7. run the code:
    Code:
    fastboot flashing unlock_critical
  8. it's done. Your bootloader is completely unlocked. Now, you only have to wait again for the reboot.

3) Flash a factory image
As you probably know, BQ releases a factory image at each update at this link factory images. Factory images are very useful to perform a very clean install. Are you experiencing some issues with your phone and none of the trick you tried solved it? If it is a software issue a clean flash with a factory image will likely remove the issue.
Keep in mind that by flashing a factory image you will wipe also the userdata partition. So backup your data first. Now let's see how to flash the factory image:
  1. you need an unlocked bootloader (see previous sections)
  2. download the factory image from this link
  3. unzip the archive
  4. open a terminal at this folder
  5. be sure to have abd and fastboot properly configured (see previous sections)
  6. run the script to flash all (*):
    Code:
    ./sdm660_fastboot_all_images.sh
  7. wait the end of the process. The phone will reboot.

(*) on Windows you have to deal with the file sdm660_fastboot_all_images.bat. I suppose it's similar but I've never done it on Windows.

4) Obtain ROOT privileges
Nowadays, the most common tool to obtain root privileges is Magisk. Many people here know very well what Magisk is and how to install it with TWRP. However, TWRP is not yet ready for BQ Aquaris X2 pro, hence, we must follow the procedure for installing it without the custom recovery.
When I wrote the document in August I find very informative this guide by @nathanchance. It's for the pixel 2XL but, as I told you before, it works perfectly also for the BQ Aquaris X2 pro (zangyapro). So here I summarize what @nathanchance already posted. All credits must go to him.

Here you have the steps:
  1. Download the Magisk zip from the official thread and install the manager from the zip.
  2. Grab a boot image to patch (either the one from the latest factory image or a custom kernel one) and push it to your device:
    Code:
    adb push <path_to_file> /sdcard/Download
  3. Open Magisk Manager and click the Install button.
  4. Click "Install" at the first prompt then choose "Patch Boot Image File". A file manager will pop up.
  5. Select the boot image you want to patch and let Magisk Manager patch it.
  6. Pull it off your device:
    Code:
    adb pull /sdcard/MagiskManager/patched_boot.img
  7. Reboot into the bootloader:
    Code:
    adb reboot bootloader
  8. Flash the boot image and reboot.
    Code:
    fastboot flash boot patched_boot.img
    fastboot reboot
  9. Open Magisk Manager and you should be rooted!

Please note that it exists also a specific thread where the author also provides the patched boot.img files for download. Hence, you can start from point 6 without patching the boot.img by yourself. Take care of selecting the right one. Here you have the thread link.

5) Update the ROM without loosing root
To the best of my knowledge, the only way to update keeping root is by using the factory images provided by BQ.
  1. Download the factory image of the latest firmware (link)
  2. Extract the file zip and upload the file boot.img on your phone
    Code:
    adb push <path_to_file> /sdcard/Download
  3. Open Magisk Manager and click the Install button.
  4. Click "Install" at the first prompt and then choose "Patch Boot Image File". A file manager will pop up.
  5. Select the boot image you want to patch and let Magisk Manager patch it.
  6. Pull it off your device:
    Code:
    adb pull /sdcard/MagiskManager/patched_boot.img
  7. Place the file patched_boot.img in the folder of the BQ firmware unzipped at point 2
  8. Make a copy of the file sdm660_fastboot_all_images (.sh in Mac/Liux and .bat on Windows).
  9. Rename the file, I called it sdm660_fastboot_upgrade.sh
  10. Change the following lines (this will preserve root privileges on your phone):
    Code:
    fastboot flash boot_a boot.img # <-- delete this line
    fastboot flash boot_a patched_boot.img # <-- add this line
  11. Delete the following line (this will prevent your data to be wiped):
    Code:
    fastboot flash userdata userdata.img # <-- delete this line
  12. Run from your terminal
    Code:
    ./sdm660_fastboot_upgrade.sh (or bat)

I think that one can also update using the OTA. This will make you lose the root privileges and therefore, you will have to repeat the procedure at section 4. I've never tested this so, if you decide to do it, you are on your own.

6) Relock the Bootloader
By relocking the bootloader you will lose all your data, hence, backup them first.

To relock the bootloader you only need the following commands:
Code:
fastboot flashing lock_critical
fastboot flashing lock
Each command will wipe your data and will reboot the phone. Be patient waiting for the reboot and do not panic.
The Following 4 Users Say Thank You to luk.giak For This Useful Post: [ View ] Gift luk.giak Ad-Free
 
 
30th November 2018, 01:53 PM |#2  
OP Junior Member
Thanks Meter: 26
 
More
Reserved.
(work in progress)
2nd January 2019, 05:10 PM |#3  
Member
Thanks Meter: 4
 
More
First: Thanks for this really nice and comprehensive thread!

I have an important addition to point:
Quote:

3. Open Magisk Manager and click the Install button.

Install Button will only appear if the phone has internet connection (Wifi or Mobile Data)
with this I can patch the boot image successfully
But unfortunately I can not run the "sdm660_fastboot_upgrade.sh.bat" it does not recognize my device.
When checking the commands in the batch I found that my device is acting really strange, sometimes giving different errors for the same command like:
Code:
C:\Android\X2proRoot\1.7.1_WithRoot>fastboot set_active _a
error: Device does not support slots.

C:\Android\X2proRoot\1.7.1_WithRoot>fastboot set_active _a
Setting current slot to 'a'...
FAILED (remote: Invalid Slot)
finished. total time: 0.004s

C:\Android\X2proRoot\1.7.1_WithRoot>fastboot set_active _a
error: Device does not support slots.
also strange:
Code:
C:\Android\X2proRoot\1.7.1_WithRoot>fastboot flash boot patched_boot.img
target didn't report max-download-size
sending 'boot' (50749 KB)...
FAILED (remote: Requested download size is more than max allowed
)
finished. total time: 0.004s
Probably some windows crap not working or an incompatibility of the installed platform tools / drivers and the ones from BQ...
The Following User Says Thank You to raudidroid For This Useful Post: [ View ] Gift raudidroid Ad-Free
2nd January 2019, 05:26 PM |#4  
OP Junior Member
Thanks Meter: 26
 
More
Quote:
Originally Posted by raudidroid

First: Thanks for this really nice and comprehensive thread!

I have an important addition to point:

Install Button will only appear if the phone has internet connection (Wifi or Mobile Data)

Thanks. I was not aware of this. And now I can't check this on my device because I started using GPay and I prefer to stay with no root and locked bootloader.

Maybe I will play again with the bootloader when TWRP for this device will be released. If it will
3rd January 2019, 04:42 PM |#5  
Member
Thanks Meter: 4
 
More
got it running!
Quote:
Originally Posted by raudidroid

Probably some windows crap not working or an incompatibility of the installed platform tools / drivers and the ones from BQ...

Probably it was just that. I Installed Ubuntu 16.04 LTS in a Vmware machine and followed the tutorial (important note here: do everything in a Terminal running under root).

Short moments of panic due to boot-loop included (I flashed a defective boot image [vmware drag and drop files obviously did not copy the whole file] )

for everybody who ends in a bootloop: just keep calm, switch off phone (>10s press power button) an very quickly when it is of press power and volume down to get into flashmode again (I had to try several times)
The Following User Says Thank You to raudidroid For This Useful Post: [ View ] Gift raudidroid Ad-Free
3rd January 2019, 05:49 PM |#6  
OP Junior Member
Thanks Meter: 26
 
More
Hey @raudidroid, when I answered to you the first time I did not read all the message or you edited it later. Only now I'm reading the issues you faced.

On Windows, what shell did you use? PowerShell?
I'm not sure about this because I banned Windows from my personal and working life several years ago, however, recently I read some posts of people having issues with PowerShell. If this is also your case next time try to use classic cmd.

Quote:

Probably it was just that. I Installed Ubuntu 16.04 LTS in a Vmware machine and followed the tutorial (important note here: do everything in a Terminal running under root).

Regarding this the above quote, I'm quite sure that you do not need to be super user to apply any of the procedure listed in the guide.

Quote:

for everybody who ends in a bootloop: just keep calm, switch off phone (>10s press power button) an very quickly when it is of press power and volume down to get into flashmode again (I had to try several times)

Since your are suggesting "... very quickly when it is of press power and volume down ... " I can imagine that you did this procedure while your phone was connected to the laptop/PC with the USB cable. In this condition, when you force the shutdown by pressing power for 10s, the phone reboots automatically. So my suggestion is to unplug it first, in this way the phone turn off without rebooting and you can comfortably enter in the bootloader with no hurry.
4th January 2019, 01:42 PM |#7  
Member
Thanks Meter: 4
 
More
Quote:
Originally Posted by luk.giak

On Windows, what shell did you use? PowerShell?
I'm not sure about this because I banned Windows from my personal and working life several years ago, however, recently I read some posts of people having issues with PowerShell. If this is also your case next time try to use classic cmd.

I was using CMD / Command Prompt on win10, but maybe I have to many ADBs/Drivers/... installed. got a really weird behavior...
Quote:


Regarding this the above quote, I'm quite sure that you do not need to be super user to apply any of the procedure listed in the guide.

without root it wouldn't work, i got "no permissions (user in plugdev group; are your udev rules wrong?)"
with root everything ran smoothly
Quote:


Since your are suggesting "... very quickly when it is of press power and volume down ... " I can imagine that you did this procedure while your phone was connected to the laptop/PC with the USB cable. In this condition, when you force the shutdown by pressing power for 10s, the phone reboots automatically. So my suggestion is to unplug it first, in this way the phone turn off without rebooting and you can comfortably enter in the bootloader with no hurry.

Oh! Yep, that sounds like it would have been the better way to do it

Thanks for your post and your answers.

BTW: half-OT do you know any way to get netflix running after the rooting?
25th February 2019, 09:52 PM |#8  
Member
Thanks Meter: 26
 
More
For your information.

I follow part 5 and updated my firmware to version 1.7.3 successfully. Thanks for this guide.
The Following User Says Thank You to AndroidenKalle For This Useful Post: [ View ] Gift AndroidenKalle Ad-Free
25th February 2019, 09:56 PM |#9  
OP Junior Member
Thanks Meter: 26
 
More
Quote:
Originally Posted by AndroidenKalle

For your information.

I follow part 5 and updated my firmware to version 1.7.3 successfully. Thanks for this guide.

Your welcome!
5th April 2019, 09:43 PM |#10  
Member
Thanks Meter: 26
 
More
For your information.

I follow part 5 and updated my firmware to version 2.0.0 (Android Pie 9) successfully.
The Following User Says Thank You to AndroidenKalle For This Useful Post: [ View ] Gift AndroidenKalle Ad-Free
5th April 2019, 09:46 PM |#11  
OP Junior Member
Thanks Meter: 26
 
More
Quote:
Originally Posted by AndroidenKalle

For your information.

I follow part 5 and updated my firmware to version 2.0.0 (Android Pie 9) successfully.

Thanks for sharing.
I'm on PIE as well. Today I flashed the factory image to make a clean install.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes