Google Pixel Rooting
From falz.net
Some quick and dirty steps to root an original Google Pixel (sailfish) ITYOOL 2018 using Android 8.1 from July 2018. This starts with a full wipe of the phone. Instructions are using Linux and are a bit lazy using sudo instead of properly setting USB permissions.
Summary
- Unlock Phone's bootloader. This allows you to do thangs.
- Install Recovery image (TWRP). This allows you to boot to a custom place to do things like install software on your phone without Android running.
- Install Root (Magisck). This is root access to let you do things like install ad blockers, which is my motivation for rooting.
If you install an android system update via OTA image, do steps 2 and 3 again, which will not wipe out your phone or lose any data.
- Last tested on Pixel 2 w/ Android 10 November 2019. Its codename is "walleye", so substitute that for sawfish in the stuff below.
- This procedure was last tested on a Pixel 1 with Android 10, September 2019
- Useful link, although it's for the XL
Details
Downloads
Download these things on your computer. Some will get uploaded to your phone later.
- Android platform-tools, which provides adb and fastboot binaries. These are official Android developer tools - https://developer.android.com/studio/releases/platform-tools
- TWRP img file. At the time of writing it's twrp-3.2.2-0-sailfish.img
- TWRP zip file. At the time of writing it's twrp-pixel-installer-sailfish-3.2.2-0.zip
- Latest Magisk, which is Magisk-v20.4.zip currently
Procedure
1) Unlock bootloader. This will wipe phone to factory defaults.
- choose Settings-> System-> About Phone. Scroll all the way down and tap Build Number a dozen times until it says you're a developer.
- Go to Settings-> System-> Developer Options (which should be new). Enable OEM Unlocking and USB Debugging.
- Turn phone off, then boot it to bootloader by holding Volume Down and Power at same time. If the phone fully booted, shut it off and try again.
- Connect USB cable to your computer. Extract the platform-tools you downloaded to somewhere, enter that directory via CLI and issue
fastboot flashing unlock
- It may ask you to confirmation on the phone or something and will probably reboot and do some important stuff. From here on out when your phone boots it will give you a warning message about this. This is you life now.
2) Install Recovery Image (TWRP)
- Prior to this, boot your phone and at bare minimum set a pin via Settings > Security & location >Screen lock > Pin.
- While phone is booted to android, push some files to the phone's 'Downloads' folder, and then reboot it to the bootloader
sudo ./adb push Magisk-v20.4.zip /sdcard/Download/ sudo ./adb push twrp-pixel-installer-sailfish-3.2.2-0.zip /sdcard/Download/ sudo ./adb reboot bootloader
- Now let's launch and install TWRP. This will tell your phone to launch TWRP
- NOTE that as of December 2019, you can NOT have a pin set when you boot in to TWRP. Disable it via Settings-> Security -> Screen Lock. Re-enable it when done
sudo ./fastboot boot twrp-3.2.2-0-sailfish.img
- TWRP should lunch, which is a black/blue screen with a clunky interface.
- Enter your pin # as password and use checkbox on keyboard to proceed.
- Choose the Install button, browse to Downloads and install twrp-pixel-installer-sailfish-3.2.2-0.zip.
- Once installed choose Reboot System button
- TWRP may ask you to install its app at this point.
3) Install Root (Magisk)
- Boot to bootloader again, but this time use the vol up/down keys to choose Recovery Mode, press Power to select. You could also get here by typing this while booted to android:https://developers.google.com/android/ota
sudo ./adb reboot recovery
- This brings you in to TWRP again. Choose install -> Magisk-v16.0.zip, then Reboot System.
Recommended Root Apps
- AdAway. Blocks ads in all apps by maintaining a local 'hosts file.
- Note that as of late 2019, you must enable a 'seamless hosts' setting in Magisk and then reboot for Adaway to function.
- Titanium Backup. Useful to back up and restore apps between phones while retaining session data. Note its interface is clunky and terrible.