Difference between revisions of "Google Pixel"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
m (Root)
 
(15 intermediate revisions by one user not shown)
Line 5: Line 5:
 
* Pixel XL
 
* Pixel XL
  
== Google New Interface ==
+
== Usage: Google New Interface ==
  
 
The main interface controls are now very abstract and look like 1980s VCR buttons, except the play button is facing the wrong way.
 
The main interface controls are now very abstract and look like 1980s VCR buttons, except the play button is facing the wrong way.
Line 18: Line 18:
  
 
SWIPE UP Apps Menu is also known as the "hidden menu" since there is no indication that this menu even exists as it is not represented by any icon or message on the desktop.  Again, millennial thinking required here.
 
SWIPE UP Apps Menu is also known as the "hidden menu" since there is no indication that this menu even exists as it is not represented by any icon or message on the desktop.  Again, millennial thinking required here.
 +
 +
Check for disk usage aka Free Disk Space available:
 +
* Square -> Settings -> Storage
  
 
== Pre- Crack / Root Basics ==
 
== Pre- Crack / Root Basics ==
Line 38: Line 41:
 
Android Version 9<BR>
 
Android Version 9<BR>
 
Patch June 5 2019
 
Patch June 5 2019
 +
 +
THE BIG PROBLEM - There are many guides on how to install [[TWRP]], Magisk, and Root this phone.  They are ALL HORRIBLE.  None are complete, each having different problems including procedural errors, missing steps, and things that just completely do not work.  By the time I successfully rooted this phone I could not remember exactly what steps I took and how I finally successfully completed the process.  Therefore, the guide below is not clear and step by step.  It will be improved in the future when I get the opportunity to root additional Pixel phones. 
 +
 +
Softwares / Tools in play here
 +
* [[TWRP]] - this is a backup and boot utility that you will flash onto your phone.  It is easy to install and works well.
 +
* Magisk Manager - this is an app that is supposed to make it easier to install Magisk and root your phone
 +
* Magisk - this is the app that needs to be installed to root your phone, it is a PITA to get installed.
  
 
=== Developer Options and USB Debugging ===
 
=== Developer Options and USB Debugging ===
Line 59: Line 69:
 
=== installing tools for backup and root ===
 
=== installing tools for backup and root ===
  
There are a number of guides online many of which offer downloads for the necessary tools including TWRP and Magisk.  They often offer them from unknown or their own server and they are often outdated versions.  Do yourself a favor and get the latest versions from the developer sites.
+
There are a number of guides online many of which offer downloads for the necessary tools including [[TWRP]] and Magisk.  They often offer them from unknown or their own server and they are often outdated versions.  Do yourself a favor and get the latest versions from the developer sites.
 
* TWRP is at https://twrp.me/Devices/Google/ and save this file to the bottom most directory of the PHONE
 
* TWRP is at https://twrp.me/Devices/Google/ and save this file to the bottom most directory of the PHONE
 
* Magisk Manager is at https://magiskmanager.com/ and save this file to the working directory of the COMPUTER (where ADB is)
 
* Magisk Manager is at https://magiskmanager.com/ and save this file to the working directory of the COMPUTER (where ADB is)
Line 127: Line 137:
 
Run Magisk Manager app
 
Run Magisk Manager app
  
The Magisk Manager is not the the Magisk App.  I found out that I had to install magisk mangager from what I downloaded earlier, then install it from recovery.  After reboot to the desktop I could open magisk manager but it indicated that magisk was not installed. ??? So they must be 2 different parts.  The install option only allowed me to download a zip file.  So I downloaded that to the download directory and reboot back to recovery.  From recovery I choose to install the zip file.  Then I reboot the phone.
+
The Magisk Manager is not the the Magisk App.  I found out that I had to install magisk mangager from what I downloaded earlier, then install it from recovery.  After reboot to the desktop I could open magisk manager but it indicated that magisk was not installed. ??? So they must be 2 different parts.  The install option only allowed me to download a zip file.  So I downloaded that to the download directory and reboot back to recovery.  From recovery I choose to install the zip file.  Then I reboot the phone. The phone takes a long time to boot then does not go to the android desktop, instead, back to the TWRP recovery menu.
 +
* choose advanced -> fix recovery bootloop
 +
Now back to the android desktop so we are out of the bootloop.  Press the Square and choose Magisk Manager.  It still indicates Magisk is not installed.
 +
 
 +
''Note: This device is using the A/B partition.  There was no warns about installing TWRP when the phone has A/B partition in any of the guides I started with, but apparently it is not a good idea to install TWRP when the phone is the version with A/B partition.  Too late now!  moving on...''
 +
 
 +
Attempting to install Magisk from zip using Recovery TWRP again. Difference in procedure.  This time I downloaded the latest zip on the PC and transferred it to the phone via data cable rather than downloading from the Magisk Manager app.  Result - phone slow too boot then stuck in bootloop again.  Had to advanced, fix recovery bootloop again in TWRP. 
 +
 
 +
This time I am making a backup in TWRP, The default backup options in TWRP are system, data, and boot. For most cases, this is sufficient for backing up a ROM. I am doing this as a precaution before proceeding.
 +
 
 +
Now downloading the latest Magisk Uninstaller from here: https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445
 +
 
 +
Now reboot the phone to android desktop, and enable file sharing to copy the uninstaller to the phone, then reboot to recovery mode and install the uninstaller to clean things up before we try again.
 +
 
 +
additional attempts fail.  Conclusion: not possible to install Magisk this way.  Next we will try to use the method that patches the factory image.
 +
 
 +
===Patch Stock Boot Image===
 +
Lets grab a factory image. My phone uses image sailfish-pq3a.190605.003
 +
 +
Just go to ABOUT PHONE and look at the build number, match it up with an image file from here:
 +
* https://developers.google.com/android/images
 +
 
 +
Having a factory image copied onto your phone is a good idea anyway, it gives you a way to recover if something goes very wrong.
 +
 
 +
Pixel PQ3A.190605.003
 +
"sailfish" for Pixel
 +
9.0.0 (PQ3A.190605.003, Jun 2019) Link 3128c984ab63e16219113c4df7b03bdec6afacd8a6b5c0e46daac67c0237671f
 +
*filename: sailfish-pq3a.190605.003-factory-3128c984.zip
 +
 
 +
This method works by patching the Stock Boot Image of your running firmware. So, you will need to have the Stock Boot .img file in order to install Magisk using this way.
 +
 
 +
#Copy the image zip to the phone internal shared storage/Download via file transfer usb cable. it will take time.
 +
#Make sure Magisk Manager is installed
 +
#With phone loaded to regular desktop run Magisk Manager.  I guess you have to have WiFi on or Magisk Manager just sits there like a lame duck trying to update.
 +
#Install via aap on the “Install” > “Install” > “Select boot image file“.  Magisk Manager will install Magisk to your boot image, and store it in [Internal Storage]/Download/magisk_patched.img
 +
#You need to take that patched boot image, put it back on your PC I guess and in the platform-tools directory with adb.
 +
# place phone in bootloader screen
 +
# From PC elevated command promopt:
 +
fastboot flash boot /path/to/magisk_patched.img
 +
 
 +
Some cool tips:  You can copy files from the phone to the PC using platform-tools while the phone is in recovery.  Example:
 +
adb pull /sdcard/Download/magisk_patched.img
 +
 
 +
Fails:
 +
copying image to cache
 +
unpacking boot image
 +
unsupported/unknown image format
 +
Installation failed
 +
 
 +
===HERE IS WHAT FINALLY WORKED===
 +
I had to reload a stock image that matched what the phone had before I began.  In order to flash the stock image, the files from the stock image had to be extracted, and the script necessary to flash the phone had to be heavily modified so it would work. Remember, the sim card is removed during this entire process.
 +
 
 +
Here are the steps performed along with some sample screen output...
 +
 
 +
1. Modified flash-all.sh by removing the version check, and the -w switch
 +
* downloaded and extract factory image sailfish-pq3a.190605.003-factory-3128c984.zip
 +
* go into extracted directory sailfish-pq3a.190605.003
 +
* deleted .bat file (windows sux) and deleted flash-base.sh since it wont be needed
 +
* open flash-all.sh in text editor ( vi flash-all.sh ) and modified it to look like this:
 +
<nowiki>#!/bin/sh</nowiki>
 +
<nowiki></nowiki>
 +
<nowiki># Copyright 2012 The Android Open Source Project</nowiki>
 +
<nowiki></nowiki>
 +
<nowiki># Remark out this version check because it causes fail</nowiki>
 +
<nowiki>#if ! grep -q dtbo.sig $(which fastboot); then</nowiki>
 +
<nowiki>#  echo "fastboot too old"</nowiki>
 +
<nowiki>#  exit 1</nowiki>
 +
<nowiki>#fi</nowiki>
 +
<nowiki>~/bin/platform-tools/fastboot flash bootloader bootloader-sailfish-8996-012001-1904111134.img</nowiki>
 +
<nowiki>~/bin/platform-tools/fastboot reboot-bootloader</nowiki>
 +
<nowiki>sleep 5</nowiki>
 +
<nowiki>~/bin/platform-tools/fastboot flash radio radio-sailfish-8996-130281-1903110834.img</nowiki>
 +
<nowiki>~/bin/platform-tools/fastboot reboot-bootloader</nowiki>
 +
<nowiki>sleep 5</nowiki>
 +
<nowiki>~/bin/platform-tools/fastboot update image-sailfish-pq3a.190605.003.zip</nowiki>
 +
Please note that I have platform-tools (with adb) installed to the bin directory under my home directory.  You will have to modify the path from ~/bin/platform-tools to wherever you have the platform-tools directory if you have it elsewhere.
 +
 
 +
2. Ran flash-all from shell while android phone in bootloader mode
 +
*output from computer terminal
 +
 
 +
<nowiki>./flash-all.sh </nowiki>
 +
<nowiki>Sending 'bootloader_a' (32424 KB)                  OKAY [  1.102s]</nowiki>
 +
<nowiki>Writing 'bootloader_a'                            (bootloader) Valid bootloader version.</nowiki>
 +
<nowiki>(bootloader) Flashing active slot "_a" </nowiki>
 +
<nowiki>(bootloader) Flashing active slot "_a" </nowiki>
 +
<nowiki>OKAY [  4.653s]</nowiki>
 +
<nowiki>Finished. Total time: 5.957s</nowiki>
 +
<nowiki>Rebooting into bootloader                          OKAY [  0.053s]</nowiki>
 +
<nowiki>Finished. Total time: 0.253s</nowiki>
 +
<nowiki>Sending 'radio_a' (57156 KB)                      OKAY [  1.995s]</nowiki>
 +
<nowiki>Writing 'radio_a'                                  OKAY [  0.466s]</nowiki>
 +
<nowiki>Finished. Total time: 2.613s</nowiki>
 +
<nowiki>Rebooting into bootloader                          OKAY [  0.038s]</nowiki>
 +
<nowiki>Finished. Total time: 0.139s</nowiki>
 +
<nowiki>--------------------------------------------</nowiki>
 +
<nowiki>Bootloader Version...: 8996-012001-1904111134</nowiki>
 +
<nowiki>Baseband Version.....: 8996-130281-1903110834</nowiki>
 +
<nowiki>Serial Number........: FA71G0304665</nowiki>
 +
<nowiki>--------------------------------------------</nowiki>
 +
<nowiki>extracting android-info.txt (0 MB) to RAM...</nowiki>
 +
<nowiki>Checking 'product'                                OKAY [  0.049s]</nowiki>
 +
<nowiki>Checking 'version-bootloader'                      OKAY [  0.050s]</nowiki>
 +
<nowiki>Checking 'version-baseband'                        OKAY [  0.050s]</nowiki>
 +
<nowiki>Setting current slot to 'a'                        OKAY [  0.070s]</nowiki>
 +
<nowiki>extracting boot.img (29 MB) to disk... took 0.182s</nowiki>
 +
<nowiki>archive does not contain 'boot.sig'</nowiki>
 +
<nowiki>Sending 'boot_a' (29825 KB)                        OKAY [  1.051s]</nowiki>
 +
<nowiki>Writing 'boot_a'                                  OKAY [  0.266s]</nowiki>
 +
<nowiki>archive does not contain 'dtbo.img'</nowiki>
 +
<nowiki>archive does not contain 'dt.img'</nowiki>
 +
<nowiki>archive does not contain 'recovery.img'</nowiki>
 +
<nowiki>archive does not contain 'vbmeta.img'</nowiki>
 +
<nowiki>archive does not contain 'vbmeta_system.img'</nowiki>
 +
<nowiki>archive does not contain 'super_empty.img'</nowiki>
 +
<nowiki>archive does not contain 'boot_other.img'</nowiki>
 +
<nowiki>archive does not contain 'odm.img'</nowiki>
 +
<nowiki>archive does not contain 'product.img'</nowiki>
 +
<nowiki>archive does not contain 'product_services.img'</nowiki>
 +
<nowiki>extracting system.img (1949 MB) to disk... took 10.852s</nowiki>
 +
<nowiki>archive does not contain 'system.sig'</nowiki>
 +
<nowiki>Sending sparse 'system_a' 1/4 (524284 KB)          OKAY [ 17.615s]</nowiki>
 +
<nowiki>Writing 'system_a'                                OKAY [  3.451s]</nowiki>
 +
<nowiki>Sending sparse 'system_a' 2/4 (524284 KB)          OKAY [ 17.408s]</nowiki>
 +
<nowiki>Writing 'system_a'                                OKAY [  3.434s]</nowiki>
 +
<nowiki>Sending sparse 'system_a' 3/4 (524284 KB)          OKAY [ 17.726s]</nowiki>
 +
<nowiki>Writing 'system_a'                                OKAY [  3.401s]</nowiki>
 +
<nowiki>Sending sparse 'system_a' 4/4 (423120 KB)          OKAY [ 14.304s]</nowiki>
 +
<nowiki>Writing 'system_a'                                OKAY [  2.797s]</nowiki>
 +
<nowiki>extracting system_other.img (313 MB) to disk... took 1.825s</nowiki>
 +
<nowiki>archive does not contain 'system.sig'</nowiki>
 +
<nowiki>Sending 'system_b' (320532 KB)                    OKAY [ 10.815s]</nowiki>
 +
<nowiki>Writing 'system_b'                                OKAY [  2.196s]</nowiki>
 +
<nowiki>extracting vendor.img (259 MB) to disk... took 1.449s</nowiki>
 +
<nowiki>archive does not contain 'vendor.sig'</nowiki>
 +
<nowiki>Sending 'vendor_a' (265800 KB)                    OKAY [  9.053s]</nowiki>
 +
<nowiki>Writing 'vendor_a'                                OKAY [  1.760s]</nowiki>
 +
<nowiki>archive does not contain 'vendor_other.img'</nowiki>
 +
<nowiki>Rebooting                                          OKAY [  0.042s]</nowiki>
 +
<nowiki>Finished. Total time: 121.825s</nowiki>
 +
 
 +
3. Now TWRP is no longer in the boot recovery menu  so we have to use it from the computer.  reboot and go into bootloader mode on the android and run "fastboot boot ./twrp.img" again on the PC
 +
 
 +
See, you can run TWRP remote, from the PC via fastbook or you can have it installed on the phone. 
 +
 
 +
# fastboot boot ./twrp.img
 +
downloading 'boot.img'...
 +
OKAY [  1.014s]
 +
booting...
 +
OKAY [  1.055s]
 +
finished. total time: 2.069s
 +
 
 +
4. installed Magisk from ,TWRP Install and did not install twrp to the phone on exit.
 +
 
 +
5. reboot phone into desktop, then enabled Wifi
 +
 
 +
6. Ran Magisk - success! Magisk is up to date!
 +
 
 +
7. Ran Root Check - success! Pixel is rooted!
 +
 
 +
With the phone off place the sim card back in the phone and turn on so you can make a test call.
 +
 
 +
Some helpful guides online I took bits and pieces from to make this work:
 +
* https://github.com/topjohnwu/Magisk/issues/529
 +
* https://www.technobuzz.net/flash-factory-images-google-pixel-pixel-xl/
 +
* https://magiskmanager.com/magisk-beta
 +
* https://xiaomi.eu/community/threads/reboot-to-recovery-after-successfully-flash-magisk-in-latest-built-9-5-9-on-mi8.50454/
 +
* https://didgeridoohan.com/magisk/HomePage
 +
 
 +
=== Use Magisk Modules ===
 +
 
 +
Once Magisk is installed and the phone is rooted you can add Magisk modules to accomplish things you want.
 +
 
 +
== Custom ROMs ==
 +
Rooting, which is necessary for installing a custom ROM. 
  
 +
Prereqs:
 +
*Installed TWRP Recovery on your Google Pixel,
 +
*Root your Pixel,
 +
*Back up necessary data.
  
  

Latest revision as of 06:46, 19 June 2019

The Google Pixel smartphone is made by a Chinese company called Huawei - the same Chinese company that the United States Government is investigating for spying for the Chinese government.

The Google Pixel first generation phone or known as the Pixel One is offered in two sizes

  • Pixel
  • Pixel XL

Usage: Google New Interface

The main interface controls are now very abstract and look like 1980s VCR buttons, except the play button is facing the wrong way.

  • backwards triangle (bottom left) - equivalent to "escape" or go back one step
  • VCR record circle (bottom center) - equivalent to "home" this used to be a meaningful house icon
  • VCR stop square (bottom right) - equivalent to "menu" or something like that, you get some menu icons and open tasks to select from
  • SWIPE UP from bottom of screen - This is the fourth main control. From the bottom of the screen swipe up to access all of your apps.

Millennials love meaningless and confusing abstract symbols which are counter-intuitive to every generation before them. Why did Google devs use VCR symbols for the new Android desktop? They've never seen a VCR before, they didn't even realize.

SWIPE UP Apps Menu is also known as the "hidden menu" since there is no indication that this menu even exists as it is not represented by any icon or message on the desktop. Again, millennial thinking required here.

Check for disk usage aka Free Disk Space available:

  • Square -> Settings -> Storage

Pre- Crack / Root Basics

To quickly get to the settings menu

  • Press SQUARE and the SETTINGS GEAR which is a white gear image in a blue circle at the bottom right of the screen.

To allow file copy via USB cable

  • In Settings choose "Connected Devices" then "USB" to control what the phone does when connected to the computer.

Bootloader / Fast Boot Mode

USES VOLUME DOWN AND POWER BUTTON ONLY

  1. make sure phone is turned off
  2. press and hold the Volume Down button for a couple seconds then keep holding and press the power button
  3. while in bootloader mode navigate with the volume up and down, and use the power button to Enter/Select

Successful when you see an image of a little green android robot on its back with a service panel open. There is also the text in a green arrow reading START near the power button, and in white text some general information about the device.

Root

Android Version 9
Patch June 5 2019

THE BIG PROBLEM - There are many guides on how to install TWRP, Magisk, and Root this phone. They are ALL HORRIBLE. None are complete, each having different problems including procedural errors, missing steps, and things that just completely do not work. By the time I successfully rooted this phone I could not remember exactly what steps I took and how I finally successfully completed the process. Therefore, the guide below is not clear and step by step. It will be improved in the future when I get the opportunity to root additional Pixel phones.

Softwares / Tools in play here

  • TWRP - this is a backup and boot utility that you will flash onto your phone. It is easy to install and works well.
  • Magisk Manager - this is an app that is supposed to make it easier to install Magisk and root your phone
  • Magisk - this is the app that needs to be installed to root your phone, it is a PITA to get installed.

Developer Options and USB Debugging

OEM unlocking

If you have a Verizon phone or a Pixel One that an OTA update has disabled your ability to activate OEM Unlocking, at of June 2019 (or perhaps in the future) it is still possible to crack the system and enable OEM unlocking, but it is a little tricky and takes patience. In fact, I had to repeat the entire process because the first time it failed to work, and the second time it finally worked and worked very well.

(soon a guide here, for now check out...)

When you boot your Pixel phone and see the following error message briefly displayed in orange text:

Your device cant be checked for corruption.  Please lock the bootloader.

You did it! That is a good error message, it means they are not happy that you cracked YOUR phone that YOU own and THEY are trying to control. You now have your rights back!

Unlock the bootloader

(soon a guide here, for now check out...)

  • Unlock bootloader

installing tools for backup and root

There are a number of guides online many of which offer downloads for the necessary tools including TWRP and Magisk. They often offer them from unknown or their own server and they are often outdated versions. Do yourself a favor and get the latest versions from the developer sites.

TWRP 3.0.2 custom recovery https://www.teamandroid.com/2016/12/13/install-twrp-3-0-2-recovery-on-google-pixel-complete-guide/

download TWRP from https://twrp.me/Devices/Google/ choose Google Pixel (sailfish) -> https://dl.twrp.me/sailfish/ yields -> Download twrp-pixel-installer-sailfish-3.3.0-0.zip

download MagiskManager-v7.2.0.apk from https://magiskmanager.com/

error: /snap/core/xxxx read-only filesystem error

SKIP IF YOU DID NOT GET THIS ERROR

  • on phone goto settings -> connected devices -> USB
  • set to USB controlled by [x] this device
  • set to Use USB for [x] File Transfer

You will copy TWRP to a directory that appears something like this in your file manager

  • /run/user/1000/gvfs/mtp:host=%5Busb%3xxxxxxxxxx/Internal shared storage

I used SpaceFM file manager to copy the file from the computer to the Android phone. The read-only error was resolved by ensuring that the USB settings on the phone were set to "Use USB for File Transfer"

reboot to Recovery Mode and install Image

You should have Downloaded both the img and the zip. Copy the zip to your device. You will need to have fastboot binaries and the correct drivers installed.

Disconnect data cable and have the device off. Power off your device completely.

Hold volume down and turn on the device. Your device should now be in the bootloader. Connect the device to your PC. Open a command window and run the following command from the proper location:

fastboot boot ./twrp.img

This will temporarily boot TWRP on your device.

Go to install and browse to the zip and install the zip. The zip will install TWRP to both boot slots.

We are going to boot the phone in bootloader mode and from the bootloader screen select Recovery.

  • press and hold the Volume Down button for a couple seconds then keep holding and press the power button

It then asks if you would like to install the official TWRP app. Swipe for yes to install. The phone will reboot.

YOU ARE STILL NOT ROOT!

error: In recovery mode NO COMMAND and broken robot

SKIP IF YOU DID NOT GET THIS ERROR

You tried to go into recovery model from bootloader / fast boot menu and the file necessary for recovery was absent so you get this image and error instead of the expected Team Win Recovery Project blue recovery menu. Don't factory reset! We just need to get the TWRP file in the right place and try this again.

  1. make sure you downloaded both the img and the zip. Copy the zip to your device. These are two files you need to download from twrp.me. ( https://twrp.me/google/googlepixel.html ) - get the latest
  2. make sure you copied the zip file to your Pixel phone
  3. make sure you have the img file on the PC in the same directory as platform-tools (adb)
  4. make sure you rename the img file to twrp.img (the one in the platform-tools directory) ( mv twrp-3.3.0-0-sailfish.img twrp.img )
  5. make sure you boot into recovery and from the PC in the platform-tools working directory type: fastboot boot ./twrp.img
  6. Go to install and browse to the zip and install the zip. (it says swipe to flash)

Install Magisk Manager app

After phone is rebooted to desktop connect data cable and choose file transfer.

Make sure you copy MagiskManagerxxx.apk file to the ../Internal shared storage/Download folder of the phone

Go to the phone file manager via the app menu and use the file manager to navigate to the Download folder

Tap on the MagiskManagerxxx.apk file to install it

Run Magisk Manager app

The Magisk Manager is not the the Magisk App. I found out that I had to install magisk mangager from what I downloaded earlier, then install it from recovery. After reboot to the desktop I could open magisk manager but it indicated that magisk was not installed. ??? So they must be 2 different parts. The install option only allowed me to download a zip file. So I downloaded that to the download directory and reboot back to recovery. From recovery I choose to install the zip file. Then I reboot the phone. The phone takes a long time to boot then does not go to the android desktop, instead, back to the TWRP recovery menu.

  • choose advanced -> fix recovery bootloop

Now back to the android desktop so we are out of the bootloop. Press the Square and choose Magisk Manager. It still indicates Magisk is not installed.

Note: This device is using the A/B partition. There was no warns about installing TWRP when the phone has A/B partition in any of the guides I started with, but apparently it is not a good idea to install TWRP when the phone is the version with A/B partition. Too late now! moving on...

Attempting to install Magisk from zip using Recovery TWRP again. Difference in procedure. This time I downloaded the latest zip on the PC and transferred it to the phone via data cable rather than downloading from the Magisk Manager app. Result - phone slow too boot then stuck in bootloop again. Had to advanced, fix recovery bootloop again in TWRP.

This time I am making a backup in TWRP, The default backup options in TWRP are system, data, and boot. For most cases, this is sufficient for backing up a ROM. I am doing this as a precaution before proceeding.

Now downloading the latest Magisk Uninstaller from here: https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

Now reboot the phone to android desktop, and enable file sharing to copy the uninstaller to the phone, then reboot to recovery mode and install the uninstaller to clean things up before we try again.

additional attempts fail. Conclusion: not possible to install Magisk this way. Next we will try to use the method that patches the factory image.

Patch Stock Boot Image

Lets grab a factory image. My phone uses image sailfish-pq3a.190605.003

Just go to ABOUT PHONE and look at the build number, match it up with an image file from here:

Having a factory image copied onto your phone is a good idea anyway, it gives you a way to recover if something goes very wrong.

Pixel PQ3A.190605.003

"sailfish" for Pixel
9.0.0 (PQ3A.190605.003, Jun 2019) 	Link 	3128c984ab63e16219113c4df7b03bdec6afacd8a6b5c0e46daac67c0237671f
  • filename: sailfish-pq3a.190605.003-factory-3128c984.zip

This method works by patching the Stock Boot Image of your running firmware. So, you will need to have the Stock Boot .img file in order to install Magisk using this way.

  1. Copy the image zip to the phone internal shared storage/Download via file transfer usb cable. it will take time.
  2. Make sure Magisk Manager is installed
  3. With phone loaded to regular desktop run Magisk Manager. I guess you have to have WiFi on or Magisk Manager just sits there like a lame duck trying to update.
  4. Install via aap on the “Install” > “Install” > “Select boot image file“. Magisk Manager will install Magisk to your boot image, and store it in [Internal Storage]/Download/magisk_patched.img
  5. You need to take that patched boot image, put it back on your PC I guess and in the platform-tools directory with adb.
  6. place phone in bootloader screen
  7. From PC elevated command promopt:
fastboot flash boot /path/to/magisk_patched.img

Some cool tips: You can copy files from the phone to the PC using platform-tools while the phone is in recovery. Example:

adb pull /sdcard/Download/magisk_patched.img

Fails:

copying image to cache
unpacking boot image
unsupported/unknown image format
Installation failed

HERE IS WHAT FINALLY WORKED

I had to reload a stock image that matched what the phone had before I began. In order to flash the stock image, the files from the stock image had to be extracted, and the script necessary to flash the phone had to be heavily modified so it would work. Remember, the sim card is removed during this entire process.

Here are the steps performed along with some sample screen output...

1. Modified flash-all.sh by removing the version check, and the -w switch

  • downloaded and extract factory image sailfish-pq3a.190605.003-factory-3128c984.zip
  • go into extracted directory sailfish-pq3a.190605.003
  • deleted .bat file (windows sux) and deleted flash-base.sh since it wont be needed
  • open flash-all.sh in text editor ( vi flash-all.sh ) and modified it to look like this:
#!/bin/sh

# Copyright 2012 The Android Open Source Project

# Remark out this version check because it causes fail
#if ! grep -q dtbo.sig $(which fastboot); then
#  echo "fastboot too old"
#  exit 1
#fi
~/bin/platform-tools/fastboot flash bootloader bootloader-sailfish-8996-012001-1904111134.img
~/bin/platform-tools/fastboot reboot-bootloader
sleep 5
~/bin/platform-tools/fastboot flash radio radio-sailfish-8996-130281-1903110834.img
~/bin/platform-tools/fastboot reboot-bootloader
sleep 5
~/bin/platform-tools/fastboot update image-sailfish-pq3a.190605.003.zip

Please note that I have platform-tools (with adb) installed to the bin directory under my home directory. You will have to modify the path from ~/bin/platform-tools to wherever you have the platform-tools directory if you have it elsewhere.

2. Ran flash-all from shell while android phone in bootloader mode

  • output from computer terminal
./flash-all.sh 
Sending 'bootloader_a' (32424 KB)                  OKAY [  1.102s]
Writing 'bootloader_a'                             (bootloader) Valid bootloader version.
(bootloader) Flashing active slot "_a" 
(bootloader) Flashing active slot "_a" 
OKAY [  4.653s]
Finished. Total time: 5.957s
Rebooting into bootloader                          OKAY [  0.053s]
Finished. Total time: 0.253s
Sending 'radio_a' (57156 KB)                       OKAY [  1.995s]
Writing 'radio_a'                                  OKAY [  0.466s]
Finished. Total time: 2.613s
Rebooting into bootloader                          OKAY [  0.038s]
Finished. Total time: 0.139s
--------------------------------------------
Bootloader Version...: 8996-012001-1904111134
Baseband Version.....: 8996-130281-1903110834
Serial Number........: FA71G0304665
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product'                                 OKAY [  0.049s]
Checking 'version-bootloader'                      OKAY [  0.050s]
Checking 'version-baseband'                        OKAY [  0.050s]
Setting current slot to 'a'                        OKAY [  0.070s]
extracting boot.img (29 MB) to disk... took 0.182s
archive does not contain 'boot.sig'
Sending 'boot_a' (29825 KB)                        OKAY [  1.051s]
Writing 'boot_a'                                   OKAY [  0.266s]
archive does not contain 'dtbo.img'
archive does not contain 'dt.img'
archive does not contain 'recovery.img'
archive does not contain 'vbmeta.img'
archive does not contain 'vbmeta_system.img'
archive does not contain 'super_empty.img'
archive does not contain 'boot_other.img'
archive does not contain 'odm.img'
archive does not contain 'product.img'
archive does not contain 'product_services.img'
extracting system.img (1949 MB) to disk... took 10.852s
archive does not contain 'system.sig'
Sending sparse 'system_a' 1/4 (524284 KB)          OKAY [ 17.615s]
Writing 'system_a'                                 OKAY [  3.451s]
Sending sparse 'system_a' 2/4 (524284 KB)          OKAY [ 17.408s]
Writing 'system_a'                                 OKAY [  3.434s]
Sending sparse 'system_a' 3/4 (524284 KB)          OKAY [ 17.726s]
Writing 'system_a'                                 OKAY [  3.401s]
Sending sparse 'system_a' 4/4 (423120 KB)          OKAY [ 14.304s]
Writing 'system_a'                                 OKAY [  2.797s]
extracting system_other.img (313 MB) to disk... took 1.825s
archive does not contain 'system.sig'
Sending 'system_b' (320532 KB)                     OKAY [ 10.815s]
Writing 'system_b'                                 OKAY [  2.196s]
extracting vendor.img (259 MB) to disk... took 1.449s
archive does not contain 'vendor.sig'
Sending 'vendor_a' (265800 KB)                     OKAY [  9.053s]
Writing 'vendor_a'                                 OKAY [  1.760s]
archive does not contain 'vendor_other.img'
Rebooting                                          OKAY [  0.042s]
Finished. Total time: 121.825s

3. Now TWRP is no longer in the boot recovery menu so we have to use it from the computer. reboot and go into bootloader mode on the android and run "fastboot boot ./twrp.img" again on the PC

See, you can run TWRP remote, from the PC via fastbook or you can have it installed on the phone.

# fastboot boot ./twrp.img
downloading 'boot.img'...
OKAY [  1.014s]
booting...
OKAY [  1.055s]
finished. total time: 2.069s

4. installed Magisk from ,TWRP Install and did not install twrp to the phone on exit.

5. reboot phone into desktop, then enabled Wifi

6. Ran Magisk - success! Magisk is up to date!

7. Ran Root Check - success! Pixel is rooted!

With the phone off place the sim card back in the phone and turn on so you can make a test call.

Some helpful guides online I took bits and pieces from to make this work:

Use Magisk Modules

Once Magisk is installed and the phone is rooted you can add Magisk modules to accomplish things you want.

Custom ROMs

Rooting, which is necessary for installing a custom ROM.

Prereqs:

  • Installed TWRP Recovery on your Google Pixel,
  • Root your Pixel,
  • Back up necessary data.

Keywords: Android