[GUIDE] Unlock/Flash/Root for the Pixel 2 XL (taimen)

chazall1

Senior Member
Jun 11, 2010
852
288
93
do you have the latest abd and fastboot? Are you trying to install a factory image?
I have never had any issues with using Fastboot or adb om Ubuntu, Mint any distro for the past few years. I just install adb and android-tools-fastboot. You will need java installed for it to function. I currently run jdk-8u152-linux-x64.
 

fracman

Senior Member
Jan 1, 2015
453
126
0

fracman

Senior Member
Jan 1, 2015
453
126
0
I have never had any issues with using Fastboot or adb om Ubuntu, Mint any distro for the past few years. I just install adb and android-tools-fastboot. You will need java installed for it to function. I currently run jdk-8u152-linux-x64.
Hmm. Its so weird. I can adb all day long. And fastboot detects my phone no problem. I can fastboot reboot too. But as soon as I try to flash factory images I get fastboot too old. I don't have jdk installed. And it worked once without it. Can u explain to me how to flash factory on Ubuntu please? I gotta be doing it wrong.
 

probono10

Member
Nov 6, 2017
23
0
0
Rooted with Magisk & Adaway Installed, but...

do you have the latest abd and fastboot? Are you trying to install a factory image?
Installed Magisk, all seemed to go well after some unlocking issues, however, after rebooting the bootloader, ads are still appearing on YouTube.

Also, is it customary (or even possible) to relock the bootloader these days after this process is complete?

Attached screenshots from Pixel 2 XL (hit "upload" this time).
 

Attachments

CyberpodS2

Senior Member
Mar 27, 2012
2,801
1,236
193
NE Pennsylvania Boonies
Installed Magisk, all seemed to go well after some unlocking issues, however, after rebooting the bootloader, ads are still appearing on YouTube.

Also, is it customary (or even possible) to relock the bootloader these days after this process is complete?

Attached screenshots from Pixel 2 XL (hit "upload" this time).
Don't know about ads issue, but rule of thumb is this:

Never ever lock your bootloader without being 100% restored to 100% stock.
 

probono10

Member
Nov 6, 2017
23
0
0
Don't know about ads issue, but rule of thumb is this:

Never ever lock your bootloader without being 100% restored to 100% stock.
Thanks for the feedback. The grim warnings about having an unlocked bootloader prompted the question. Just wondered what everyone else, with infinitely more experience, are doing with their devices regarding this.

For me, returning to a phone riddled with ads after years without them, is like, well, having an iPhone.
 

Badger50

Forum Moderator
Staff member
Feb 27, 2011
11,218
9,394
253
60
Kansas City
Thanks for the feedback. The grim warnings about having an unlocked bootloader prompted the question. Just wondered what everyone else, with infinitely more experience, are doing with their devices regarding this.

For me, returning to a phone riddled with ads after years without them, is like, well, having an iPhone.
Many of us just ignore the warning. It's the nature of the beast these days when you unlock the bootloader. Which, is definitely worth it to get rid of those adds! :good:
 

Badger50

Forum Moderator
Staff member
Feb 27, 2011
11,218
9,394
253
60
Kansas City
Any recommendations then? Start over from the unlocked bootloader and re-install Magisk, etc.?
I would recommend that you read the instructions in the OP thoroughly! Nathan is excellent at this stuff. Once your rooted, you can install AdAway and get rid of many of those adds :good:
 

destiple

Member
Sep 24, 2009
24
4
3
Lincoln
Regarding flashing Factory Images (I assume this means the monthly update), will we need to re-root after doing this?

Introduction

Hello everyone, this is a guide to assist you with customizing your Pixel 2 XL! I will be going over installing fastboot and adb, unlocking your bootloader, how to flash the factory images for clean flashes and upgrades, and how to root. Please feel free to ask any questions if you need clarification. Enjoy!

This information has been distilled from Google's official factory image site and the Magisk thread.


Installing fastboot and adb

Thankfully, Google has provided just adb, fastboot, and systrace as a simple zip file, making this process super easy. You MUST be on at LEAST 26.0.2 for the commands in this guide to work. When in doubt, grab the latest copy and install them using the following instructions.


Windows:

  1. Unzip the folder somewhere on your hard drive.
  2. Go to the folder containing the adb and fastboot files and type "cmd" in the path bar at the top.
  3. A command prompt should open with the current folder showing on the prompt.
  4. Type the following commands:
    Code:
    adb --version
    fastboot --version
    You should see some information appear. If that is the case, you were successful!

Mac/Linux:

  1. Unzip the folder somewhere on your hard drive.
  2. Navigate to that folder with your terminal.
  3. Run the following commands:
    Code:
    sudo install adb /usr/local/bin
    sudo install fastboot /usr/local/bin
  4. Type the following commands:
    Code:
    adb --version
    fastboot --version
    You should see the version information, along with telling you they are installed to /usr/local/bin. If so, you were successful!


Unlocking the bootloader

WARNING: This WILL wipe your entire phone. Please make copies or backups of any important data. This can also go wrong rendering your device inoperable. Proceed with caution.

  1. On your phone, open Settings, navigate to "System" then "About phone", and tap on the build number 7 times.
  2. Go one menu up, click on "Developer options", and turn on USB debugging and OEM unlocking.
  3. In your terminal, type the following command:
    Code:
    adb reboot bootloader
  4. Next, decide if you want to do a standard unlock or critical unlock. A critical unlock allows you to directly flash bootloader files, otherwise you will get an error when you try to do so.
  5. Depending on what you decided in the previous step, run one of the following commands:
    Code:
    fastboot flashing unlock
    OR
    Code:
    fastboot flashing unlock_critical
  6. Follow the prompts on your device then reboot!


Flashing factory images

NOTE #1: You CANNOT downgrade factory images. Google has prevented users from doing so to keep them safe from vulernabilities that were patched. You should only upgrade or reinstall the current image.

NOTE #2: If you have mounted /system as rw at any point (like in TWRP), you must upgrade using the factory image method. OTAs will fail because they cannot verify the integrity of the disk since its verity data has been changed.

Updating to a new release (factory image):

  1. Download the latest factory image from Google's website.
  2. Reboot into the bootloader:
    Code:
    adb reboot bootloader
  3. Unzip the factory image.
  4. Inside you will see a bootloader image, a radio image, an image zip file, and a couple of flash scripts.
  5. If you are on Windows, open the "flash-all.bat" file in a text editor. If you are on Mac or Linux, open the "flash-all.sh" instead.
  6. Remove the "-w" flag before the fastboot command towards the end of the file. This will prevent fastboot from formatting your device.
  7. Run the flash all script! Open a command prompt, navigate to the folder with the script, and run one of the following commands:
    Windows:
    Code:
    flash-all
    Mac/Linux:
    Code:
    ./flash-all.sh
  8. Reboot once it is finished!
Updating to a new release (OTA zip):

  1. Download the latest OTA zip from Google's website
  2. Reboot into recovery:
    Code:
    adb reboot recovery
  3. Hold down the power button and push volume up
  4. Select "Apply update from ADB"
  5. Run the following command from the folder containing the OTA zip:
    Code:
    adb sideload <zip_name>.zip
  6. Reboot once it is finished!
Clean flashing a factory image (wipe everything):

  1. Download the latest factory image from Google's website
  2. Reboot into the bootloader:
    Code:
    adb reboot bootloader
  3. Unzip the factory image.
  4. Run the flash all script! Open a command prompt, navigate to the folder with the script, and run one of the following commands:
    Windows:
    Code:
    flash-all
    Mac/Linux:
    Code:
    ./flash-all.sh
  5. Reboot once it is finished!


Rooting with Magisk

  1. Download the Magisk Manager from the official thread and install it.
  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!


Closing statements

If there are any procedures you would like to see added (like flashing a custom kernel or booting TWRP), I am happy to add them if requested. Also, when requesting help, please be as specific as possible where you get confused. I want this guide to be clear as possible.
 
Last edited by a moderator:

probono10

Member
Nov 6, 2017
23
0
0
I would recommend that you read the instructions in the OP thoroughly! Nathan is excellent at this stuff. Once your rooted, you can install AdAway and get rid of many of those adds :good:
Never doubted Nathan's excellence, however, my own in this area is another story...
Followed his instructions, I thought, to the letter, but got a "Not Enough Space" message attached after the edited "Flash-All" command was executed.
 

Attachments