• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Guide] Root Pixel 5 Android 12

Search This thread

Homeboy76

Senior Member
Aug 24, 2012
2,802
1,412
[Guide] Root Pixel 5 Android 12 Unlock/Lock Bootloader + Systemless ROOT
Android Security Bulletin—December 2021
Pixel Update Bulletin—December 2021


Introduction
This Guide is for Pixel 5 owners that want to Root their phone, and enjoy the benefits of rooting it without installing a Custom ROM. However, for those that just can't live without a Custom ROM, take a look at 'Custom ROMs for Pixel 5'.


NEW
  1. Magisk Modules for Magisk Alpha/Canary
  2. Magisk Alpha (vvb2060)



Update(s)
  1. Factory/OTA Images - 06/12
  2. Magisk Stable - Magisk-23.0 05/12
  3. Magisk Beta - Magisk-23.0 05/12
  4. Magisk Canary - Magisk-23015 24/11
  5. TWRP - Waiting for T.R.W.P. for Android 12
  6. SafetyNet - SafetyNetFix v2.2.0
  7. SDK Platform-tools - r31.0.3 08/18
  8. Custom Kernels
    • ElementalX - Check ElementalX Kernel Manager
    • CleanSlate vR1.8.5 06/13 S (B5) 2.9.0 24/11
  9. Custom ROMs
    • ProtonAOSP[12] 11/01


Disclaimer
  1. I assume no responsibility for the malfunctioning/bricking of your phone.
  2. The order of listed items i.e., Custom Kernels, Custom ROMS, etc. Does not indicate my preference for them. It is your responsibility to do the research before selecting an item.


Prerequisites
  1. A Pixel 5 phone with an unlocked bootloader.
  2. The latest Android 12 Factory or OTA Image: "redfin" for Pixel 5


    Factory Image

    OTA Image
  3. A Computer with the latest SDK Platform-Tools: r31.0.3 installed.
    • Important: Update Platform Tools, regularly, for optimal performance.


Other Guides


Credits/Thanks/Recognitions
  1. @creezalird- Flash Android 12 factory image.
  2. Those I may have, inadvertently, forgotten.


Index
(NOTE: Numbers 1-11 are not steps, they are individual sets of instructions).
  1. Open a Command Prompt/Boot Fastboot Mode/Boot Recovery

    • Open a Command Prompt on Computer
      1. Open File Explorer, click the platform-tools folder ==> click the folder icon (left side of address bar) to highlight it type cmd and press enter.
      2. Open a Powershell Command Prompt on Computer: Open File Explorer, click the platform-tools folder ==> click the folder icon (left side of address bar) to highlight it type powershell and press enter.
      3. Notes:
        • Enable USB Debugging, on your phone: Settings ==> System ==> Advanced ==> Developer options ==> Scroll down to USB debugging and enable it.
        • When using the Powershell Command Prompt Commands must be preceeded with ./: i.e, ./fastboot devices
        • If you do not want to open a Command Prompt every time you want to use the fastboot command, add the path to the Platform-tools folder to Windows environment variables.
    • Boot fastboot mode (bootloader):
      • Power off phone, press and hold the power and volume down buttons until you see Start.
    • Boot Recovery
      • Power off phone, press and hold the power and volume down buttons until you see Start. Use volume up/down button until you see Recovery mode. Press power button.
  2. Test fastboot

    • Enable Developer Options - Tap Settings > About phone > Build number 7 times or until you should see 'you are a Developer'.
    • Enable USB Debugging - Tap Settings > System > Advanced > Developer options >
      Enable USB Debugging.
    • Open a Command Prompt on your computer in the Platform-tools folder.
    • Boot fastboot mode on your phone (#1)
    • Connect the phone to the Computer.
    • At the prompt type: fastboot devices to verify communication with phone. It should return your phone's serial number.
  3. Unlock Bootloader/Return Phone to Stock/Lock Bootloader

    • Unlock Bootloader

      1. This will erase all user data from the device!
      2. Backup your data
      3. Activate Developer Options: Tap Settings > About Phone > Tap Build Number 7 times or until you see you are a Developer. Tap back > System > Advanced > Developer Options. Enable OEM Unlock and, USB Debugging.
      4. Boot fastboot mode
      5. Connect the phone to the Computer with USB cord.
      6. Open a Command Prompt on your computer and type fastboot flashing unlock and press enter.
      7. You should see a request for confirmation on your phone, use the volume keys to scroll and the power key to select.
      8. Allow the process to complete and then type fastboot reboot at the Command Prompt and press enter.
      9. When your phone reboots disconnect your usb cable.
        Notes: After unlocking your bootloader, you'll see a warning: The bootloader is unlocked and... You will see this warning until, you relock the bootloader.
        Do not relock your bootloader until you have returned the device to Stock.
    • Return Phone to Stock

      1. Backup your data/Internal storage
      2. Settings > System > Advanced > Reset Options > Erase all data (factory reset)
      3. Log in
      4. Set up phone
    • Lock Bootloader

      1. Return the phone to Stock before locking the bootloader, failure to do so could brick your phone
      2. This will erase all user data from the device!
      3. Boot fastboot mode
      4. Open a Command Prompt and type this at the Prompt: fastboot flashing lock
      5. You should see a request for confirmation on your phone, use the volume keys to scroll and the power key to select.
      6. Allow the process to complete, then type this at the Command Prompt: fastboot reboot
      7. Enable Developer Options: Settings > About phone > Tap Build number 7 times or until you see 'you are a developer'.
      8. Tap Back > Developer options and toggle OEM Unlock off.
  4. Install/Update Factory Image keep data or wipe data

    • Important Note(s):
      1. If you are upgrading your phone to Android 12 a wipe is, absolutely necessary, if you want to root your phone after the upgrade. Subsequent, factory image updates do not require a wipe.
      2. If you are updating your phones firmware (factory image) and your phone was rooted: Disable all magisk modules and restore back Magisk app name if you hid it and reboot. Why? The magisk modules you are using may need updating to work with the updated firmware. Incompatiable modules cause bootloops. :(
      3. Always verify you have the latest version of SDK Platform-Tools installed on your computer before installing the Factory Image: Pixel 5 - redfin.
      4. If you get an error: while flashing, try one of these options:
        • Change the USB port to a non charging USB port.
        • Change the USB cord.
        • Change Computers.
      5. Backup your data
      6. Download the latest Factory Image: Pixel 5 - redfin to your Computer.
      7. Extract the factory Image to a folder.
    • Flash Factory Image Keep Data

      • Open the folder you extracted the Factory Image to and Edit the flash-all.bat file with a file editor i.e., DroidEdit app.
        1. Change this line: fastboot -w update image-redfin-aa9a.999999.999.zip
        2. to this: fastboot --disable-verity --disable-verification update image-redfin-sp1a.999999.999.zip
        3. Note: If you do not remove the -w your internal storage will be wiped.
      • After, you have edited the flash-all.bat file. Copy/Move these files to the Platform-tools folder:
        1. bootloader-redfin-....img
        2. flash-all.bat
        3. image-redfin-....zip
        4. radio-redfin-....img
      • Open a Command Prompt on your computer in the Platform-tools folder and type: flash-all at the Command Prompt and press enter.
      • The phone will reboot when flashing is completed.
      • Go-to 7. Root/Reroot with Magisk and Pass SafetyNet, • Patching the boot.img - to root/reroot.
    • Flash Factory Image Wipe Data

      • Open the folder you extracted the Factory Image to and Edit the flash-all.bat file with a file editor i.e., DroidEdit app.
        1. Change this line: fastboot -w update image-redfin-aa9a.999999.999.zip
        2. to this: fastboot -w --disable-verity --disable-verification update image-redfin-sp1a.999999.999.zip
        3. This will wipe your phone's Internal Storage.
      • Open the folder you extracted the Factory Image to and Copy/Move these files to the Platform-tools folder:
        1. bootloader-redfim-....img
        2. flash-all.bat
        3. image-redfin-....zip
        4. radio-redfin-....img
      • Open a Command Prompt on your computer in the Platform-tools folder and type: flash-all at the Command Prompt and press enter.
      • The phone will reboot when flashing is complete.
      • Setup phone
      • Enable Developer Mode and USB Debugging
        1. Setup => About phone => Tap Build number 7 times or untill you see you are a 'Devloper'.
        2. Setup => System => Developer options => Enable Developer options => enable USB Debugging
      • Go-to 7. Root/Reroot with Magisk and Pass SafetyNet, • Patching the boot.img - to root/reroot.
  5. ADB Sideload

  6. Extract/Flash boot.img

    • Extract boot.img

      1. Download the latest Factory image to your phone.
      2. Extract the Factory Image file (redfin-spa1.999999.999-factory-99a9a99a.zip) to a folder.
      3. Open the folder and, extract the Image file (image-redfin-spa1.999999.999.zip) into the folder.
      4. Copy the boot.img file to the computer's Platform-tools folder.
    • Flash boot.img

      1. Flashing the boot.img removes root.
      2. Open the folder you extracted the 'image...zip' file to and copy the boot.img file to your computer's platform-tools folder or to the folder that has fastboot.exe in it.
      3. Boot fastboot mode
      4. Connect the phone to the Computer
      5. Open a Command Prompt and type the following command at the prompt:
        fastboot flash boot --slot all boot.img
      6. Reboot
  7. Root/Reroot with Magisk and Pass SafetyNet.

    • Android 12

      1. Upgrading to Android 12 and rooting your phone
        • OP, Index, 4. Install/Update Factory Image keep data or wipe data
      2. You wiped your phone when upgraded to Android 12. You want to update the factory image and re-root it.
        • OP, Index, 4. Install/Update Factory Image keep data or wipe data
    • Patching the boot.img - to root/reroot.

      1. Do #6 - Extract boot.img
      2. Install Magisk Canary 23015
        Note: Tap 3 dot menu across from canary => Tap Go to file => Download, app-debug.apk
      3. Open Magisk Canary App
      4. Set the Update Channel Canary.
      5. Tap Install (next to Magisk)
      6. Tap, Select and Patch a File
      7. Select the boot.img file you extracted from the latest factory image.
      8. Tap the ✓ (Check Mark)
      9. Tap Let's Go
      10. When you see done, the boot.img has been patched (magisk_patched_xxxxxx.img), and stored in the download folder.
      11. Reboot
      12. Copy the patched boot.img file to your computer's Platform-tools folder or the folder that has fastboot.exe in it.
      13. Boot fastboot mode
      14. Connect the phone to the Computer with USB cord.
      15. Open a Command Prompt in the folder you copied the patched boot.img to.
      16. Type fastboot flash boot "name of patched boot".img without the quote marks at the Prompt and press enter.
      17. Type fastboot reboot at the Prompt and press enter.
      18. Important Notes: If your phone boot loops try one of the following options:
        • Flash the 'stock' boot.img to both slots: fastboot flash boot boot.img --slot all
        • Boot Safe Mode - Press Power Off button ==> Press Power Off until you see boot Safe Mode ==> Press Ok.
    • Pass Safety Net with SafetyNet Fix 2.2.0

      1. Download File(s)
      2. Install SafetyNet Fix 2.2.0
        • Open Magisk
        • Tap Modules icon
        • Tap Install from storage
        • Navigate to the SafetyNetFix file you downloaded
        • Tap the SafetyNetFix file
        • Tap the check mark (✓ at the bottom) to start the installation.
        • After it installs tap the Save icon to save the log
        • Tap Reboot.
      3. Settings for Magisk Canary 23015
        • Open Magisk App
        • Tap the Setup icon.
        • Scroll down to App and set the Update Channel to Canary.
        • Scroll down to Check Updates and enable it.
        • Scroll down to Magisk and enable Zygisk and Enforce DenyList.
        • Tap Configure DenyList => Tap 3 Dot Menu => Check ✓ Show system apps => Check ✓ Google Play Store, Google Pay, etc.
        • Scroll down to Superuser and enable Enable Biometric Authentication.
      4. Get Device Certified Clear Google Play Services, Google Play Store, Google Pay, etc. data
        • Turn Airplane mode on
        • Open Settings
        • Tap Apps & notifications
        • Tap see all...
        • Tap three dot menu
        • Tap Show system
        • Scroll down to Google Play Store
        • Tap Storage and Cache
        • Tap Clear storage
          Note: Repeat the 3 steps above for Google Play Services, Google Pay, etc.
        • reboot
        • Turn Airplane mode off
      5. Check Device Certification
        • Open Google Play Store app
        • Tap Menu - Circle top right
        • Tap Settings
        • Tap About
        • Check Play protect certification.
  8. Set Magisk App Update Channel/Update Magisk

    • Set Magisk App Update Channel

      • Open Magisk App > Tap Settings icon > Update Channel > Select Stable, Beta, Canary or Custom.
    • Update Magisk

      1. When Magisk App notifies you of an update:
      2. Tap install.
      3. Select, Direct Install (Recommended)
      4. When it finishes installing
      5. Tap, Save Log
      6. Log location: /storage/emulated/0/Download
      7. Tap, Reboot
      8. Done!
  9. Custom ROMs

    • Need help with a Custom ROM?
      • First, read and follow the Installation Instructions. The installation instructions are in the OP.
      • Second, if you have a problem Installing it, Search the thread of the Custom ROM you are trying to install for a solution to problem: If you don't find a solution post your request for help on the thread.
    • ROMs
      1. Alpha/Beta

        • None
      2. Official
      3. Unofficial

        • None
  10. Apps/Mods/Scripts/Tethering/Themes
  11. T.W.R.P. Backup/Restore

    • Waiting for Android 12 T.W.R.P.
 

Attachments

  • SuperuserIcon.jpg
    SuperuserIcon.jpg
    12.4 KB · Views: 622
  • ModulesIcon.jpg
    ModulesIcon.jpg
    13.8 KB · Views: 618
Last edited:

kbaltodano

Member
Mar 28, 2012
33
10
San Jose
Hey, thanks for this super-detailed guide!

I just did this to my P5, however the guide was not clear on how to get Safetynet working.
After Magisk was installed and I confirmed that the device was rooted, I went to this other thread and followed the instructions for Safetynet at the very end of the first post. The downside seems to be that the device is identified as a Pixel 3A, but it got the Safetynet test to pass. I assume that this will be fixed someday.
 

dyingearth

Senior Member
Aug 28, 2010
102
14
Los Angeles
Hey, thanks for this super-detailed guide!

I just did this to my P5, however the guide was not clear on how to get Safetynet working.
After Magisk was installed and I confirmed that the device was rooted, I went to this other thread and followed the instructions for Safetynet at the very end of the first post. The downside seems to be that the device is identified as a Pixel 3A, but it got the Safetynet test to pass. I assume that this will be fixed someday.

I don't think so. Even this method is kinda kludged. Pixel 3a is the latest version not subject to the hardware check that prevented Safetynet check.
 

PRL77

Senior Member
Sep 18, 2013
69
5
Los Angeles, CA
No OTA Update will not disable. Root

Incorrect, Jackie. See Homeboy76's reply. I actually did a reset to factory defaults before posting this and it removed root. An OTA would do the same.

---------- Post added at 08:39 PM ---------- Previous post was at 08:11 PM ----------

Yes, you will lose root if you take te OTA. The only way to keep root with OTA is do #7. D..
Thanks for confirming my thoughts. And thanks for this guide, it is damn brilliant.
 

Pollie81

Senior Member
Mar 8, 2012
1,681
647
Google Pixel 6
I'm not an expert but as far as i know that's not correct.

If you do a factory reset your boot image will not be overwritten so technically root is still there.
But the magisk app will be deleted because of the factory reset, the patched boot image should still be in place.
OTA overwrites those files so then it will be fully unrooted.
 

Jackie Coyote

Member
Nov 19, 2020
33
1
I'm not an expert but as far as i know that's not correct.

If you do a factory reset your boot image will not be overwritten so technically root is still there.
But the magisk app will be deleted because of the factory reset, the patched boot image should still be in place.
OTA overwrites those files so then it will be fully unrooted.
I don't take OTAs . I flash factory images on Mondays. But I thought you can't even take OTAs without restoring the boot image first. Either through fastboot or Magisk itself?? Or I think you can flash the full OTA from Google's website. I'm pretty sure that will replace the boot image with stock.
 

vette8t7

Member
Sep 23, 2010
25
0
My 3XL died, so I ordered a 5 unlocked from Amazon. In trying to unlock the bootloader with 'fastboot flashing unlock', I receive FAILED (remote: 'flashing unlock is not allowed'). How can I tell if I have an unlocked phone or is there something else I am missing?
 

Jackie Coyote

Member
Nov 19, 2020
33
1
My 3XL died, so I ordered a 5 unlocked from Amazon. In trying to unlock the bootloader with 'fastboot flashing unlock', I receive FAILED (remote: 'flashing unlock is not allowed'). How can I tell if I have an unlocked phone or is there something else I am missing?
Did you toggle the unlock in developer settings? If you can't and it's greyed out, your out of luck. Are you on the bootloader screen when your fastbooting? You have updated platform tools?
 

vette8t7

Member
Sep 23, 2010
25
0
My 3XL died, so I ordered a 5 unlocked from Amazon. In trying to unlock the bootloader with 'fastboot flashing unlock', I receive FAILED (remote: 'flashing unlock is not allowed'). How can I tell if I have an unlocked phone or is there something else I am missing?
My bad, I enabled OEM Debugging, but not the Enable OEM Unlock. Bootloader is unlocked!
 

PRL77

Senior Member
Sep 18, 2013
69
5
Los Angeles, CA
I don't take OTAs . I flash factory images on Mondays. But I thought you can't even take OTAs without restoring the boot image first. Either through fastboot or Magisk itself?? Or I think you can flash the full OTA from Google's website. I'm pretty sure that will replace the boot image with stock.
The guide goes over this in Step 7D how it is possible on devices with A/B partitions but not those without them.

---------- Post added at 11:44 AM ---------- Previous post was at 10:54 AM ----------

I'm not an expert but as far as i know that's not correct.

If you do a factory reset your boot image will not be overwritten so technically root is still there.
But the magisk app will be deleted because of the factory reset, the patched boot image should still be in place.
OTA overwrites those files so then it will be fully unrooted.
So you're saying that after I lost root on factory reset, all I needed to do was reinstall Magisk?
 

Jackie Coyote

Member
Nov 19, 2020
33
1
The guide goes over this in Step 7D how it is possible on devices with A/B partitions but not those without them.

---------- Post added at 11:44 AM ---------- Previous post was at 10:54 AM ----------


Unless I'm reading it incorrectly, that is no longer an option. Taking the OTA and installing Magisk to the inactive slot has been removed.
 

PRL77

Senior Member
Sep 18, 2013
69
5
Los Angeles, CA
The guide goes over this in Step 7D how it is possible on devices with A/B partitions but not those without them.

---------- Post added at 11:44 AM ---------- Previous post was at 10:54 AM ----------


Unless I'm reading it incorrectly, that is no longer an option. Taking the OTA and installing Magisk to the inactive slot has been removed.
I'm reading that some devices can be done that way while others cannot. This guide is linked in #7D: https://topjohnwu.github.io/Magisk/ota.html
I personally won't be doing it, I'll just re-root from scratch, but it does seem like an option.
 

Jackie Coyote

Member
Nov 19, 2020
33
1
I'm reading that some devices can be done that way while others cannot. This guide is linked in #7D: https://topjohnwu.github.io/Magisk/ota.html
I personally won't be doing it, I'll just re-root from scratch, but it does seem like an option.
Yeah, I don't take OTAs. Just was wondering for clarification purposes. Install to inactive slot is not an option on my latest magisk canary build.

https://twitter.com/topjohnwu/status/1303574238796808192?s=19
 

Homeboy76

Senior Member
Aug 24, 2012
2,802
1,412
I'm not an expert but as far as i know that's not correct.

If you do a factory reset your boot image will not be overwritten so technically root is still there.
But the magisk app will be deleted because of the factory reset, the patched boot image should still be in place.
OTA overwrites those files so then it will be fully unrooted.
<Edit> :oops: You're right!
 
Last edited:

Pollie81

Senior Member
Mar 8, 2012
1,681
647
Google Pixel 6
Are you sure the boot.img is not overwritten?
Why?
If the boot.img was not overwritten Magisk and Magisk Manager would still be on your phone.
The reason the boot.img is still there is it is stored on your computer i.e. C:/Platform-tools folder

A Factory reset wipes the phone's data & it's Internal Storage.

magisk manager is an app, the root itself is something that is changed in the boot image.
by a factory reset the system and boot image/partitions are not touched, only the data partition and internal storage if you choose so.
that clears everything exept the boot image, that's why if people would realy want to go back to stock they have to flash a stock/factory image.
because if you do that or OTA the boot image will be overwritten by the stock one.
 

Top Liked Posts

  • 1
    Recently got a Pixel 5 running Android 12. Do I need to wait until TWRP supports Android 12 in order to root?
    TWRP isn't needed to root.
    1
    Recently got a Pixel 5 running Android 12. Do I need to wait until TWRP supports Android 12 in order to root?
    No. However, to run a patched boot image, you have to disable Android Verified Boot, and disabling Android Verified Boot requires /data to be clean.

    See my guide here.
    1
    Interesting. Does this mean that each time one updates, or chooses to update, they'll have to flash a patched boot image and wipe their device to keep root?
    Here is a thread I wrote on this specific topic.

    The problem is dm-verity and vbmeta verification on the /vbmeta partition. If /vbmeta is flashed without these disabled, a patched boot image will not boot. For reasons that are still not quite understood, /data must be clean if verity and verification are disabled after having been enabled.

    So, if you've previously disabled vbmeta, and it has never been enabled (by flashing without the disable options), you won't have to wipe as long as you use the disable options when flashing it again.

    To make this a little clearer:

    Scenario 1: Vbmeta not disabled, no permanent patch, /data populated >>> vbmeta disabled, requires data wipe in order to successfully boot.

    Scenario 2: Vbmeta previously disabled, permanent patch, /data populated >>> vbmeta NOT disabled (flashed without disable options >>> won't boot with permanent patch >>> vbmeta disabled, requires data wipe in order to successfully boot.

    Scenario 3: Vbmeta previously disabled, permanent patch, /data populated >>> vbmeta re-disabled (flashed with disable options) >>> successful boot with permanent patch, no data wipe.

    Extremely confusing, I know.
    1
    Here is a thread I wrote on this specific topic.

    The problem is dm-verity and vbmeta verification on the /vbmeta partition. If /vbmeta is flashed without these disabled, a patched boot image will not boot. For reasons that are still not quite understood, /data must be clean if verity and verification are disabled after having been enabled.

    So, if you've previously disabled vbmeta, and it has never been enabled (by flashing without the disable options), you won't have to wipe as long as you use the disable options when flashing it again.

    To make this a little clearer:

    Scenario 1: Vbmeta not disabled, no permanent patch, /data populated >>> vbmeta disabled, requires data wipe in order to successfully boot.

    Scenario 2: Vbmeta previously disabled, permanent patch, /data populated >>> vbmeta NOT disabled (flashed without disable options >>> won't boot with permanent patch >>> vbmeta disabled, requires data wipe in order to successfully boot.

    Scenario 3: Vbmeta previously disabled, permanent patch, /data populated >>> vbmeta re-disabled (flashed with disable options) >>> successful boot with permanent patch, no data wipe.

    Extremely confusing, I know.
    I think I'm understanding a little better now. Thanks for spelling it out for me and helping me make a decision on how best to proceed. I appreciate the links to the separate threads as well. I have yet to have much success with XDA's search tools.
    1
    All good on updating from November to December patchset (bramble; pixel 4a 5g).

    Windows:
    1. Extract boot.img from image-bramble-sq1a.211205.008.zip
    2. Push to phone, patch with latest Canary (23015), pull back magisk_patched-23015_<5_LETTER-NUMBER_CODE>.img and rename to boot.img
    3. Re-pack image-bramble-sq1a.211205.008.zip with new boot.img (w./ winRAR; in-built windows zip caused issue)
    4. edit flash-all.bat and replace fastboot -w with fastboot --disable-verity --disable-verification
    5. reboot into bootloader
    6. flash-all.bat
    7. Done.

    I am running:
    Magisk Canary (23015) + Detection hide + USFN 2.2.0 + Zygisk + DenyList (a few applications that still detect; no Google Pay/Play *)
    YASNAC passes + Pay shows blue on 'hold to reader'
  • 2
    News flash
    #4 Install/Update Factory Image keep data or wipe data has been updated: @creezalird discovered the Pixel 4a 5(G) and Pixel 5 upgrading to Android 12 or updating Android 12 process by flashing the factory image does not require flashing vbmeta.img (fastboot flash --disable-verity --disable-verification --slot=all. vbmeta vbmeta.img). (y)
    I assume you mean vbmeta does not have to be reflashed after updating via the factory image? We want to make sure we don't confuse people...I initially read your comment as updating Android 12 does not require disabling verity or verification.
    AFAIK, the instructions in this thread should work for "Pixels on the SD765G". I think the Pixel 5a is on SD765G.
    Yes. This affects all Pixel Snapdragon 765G devices - the 4a (5G), the 5, and the 5a. This also affects the new Tensor devices: the 6 and 6 Pro.
    2
    With the latest canary magisk, I don't see any online modules.
    Is that because of zygisk? or something is wrong with my setup?

    Thanks
    BB
    Please read topjohnwu's blog post here about Magisk and its coming changes.
    1
    I believe @Regys is asking questions on your thread and mine see post #398 above. :)
    I did answer his question in my thread.

    Given that @Regys is still on Android 11, I'm wondering if he's willing to test an idea I have to see if it may be possible to upgrade and disable vbmeta without wiping.

    @Regys , either guide will work. If you want the easiest and least confusing way to do this, I would recommend using the Android Flash Tool instructions in my guide, as it's almost impossible to get wrong.
    1
    All good on updating from November to December patchset (bramble; pixel 4a 5g).

    Windows:
    1. Extract boot.img from image-bramble-sq1a.211205.008.zip
    2. Push to phone, patch with latest Canary (23015), pull back magisk_patched-23015_<5_LETTER-NUMBER_CODE>.img and rename to boot.img
    3. Re-pack image-bramble-sq1a.211205.008.zip with new boot.img (w./ winRAR; in-built windows zip caused issue)
    4. edit flash-all.bat and replace fastboot -w with fastboot --disable-verity --disable-verification
    5. reboot into bootloader
    6. flash-all.bat
    7. Done.

    I am running:
    Magisk Canary (23015) + Detection hide + USFN 2.2.0 + Zygisk + DenyList (a few applications that still detect; no Google Pay/Play *)
    YASNAC passes + Pay shows blue on 'hold to reader'
  • 29
    [Guide] Root Pixel 5 Android 12 Unlock/Lock Bootloader + Systemless ROOT
    Android Security Bulletin—December 2021
    Pixel Update Bulletin—December 2021


    Introduction
    This Guide is for Pixel 5 owners that want to Root their phone, and enjoy the benefits of rooting it without installing a Custom ROM. However, for those that just can't live without a Custom ROM, take a look at 'Custom ROMs for Pixel 5'.


    NEW
    1. Magisk Modules for Magisk Alpha/Canary
    2. Magisk Alpha (vvb2060)



    Update(s)
    1. Factory/OTA Images - 06/12
    2. Magisk Stable - Magisk-23.0 05/12
    3. Magisk Beta - Magisk-23.0 05/12
    4. Magisk Canary - Magisk-23015 24/11
    5. TWRP - Waiting for T.R.W.P. for Android 12
    6. SafetyNet - SafetyNetFix v2.2.0
    7. SDK Platform-tools - r31.0.3 08/18
    8. Custom Kernels
      • ElementalX - Check ElementalX Kernel Manager
      • CleanSlate vR1.8.5 06/13 S (B5) 2.9.0 24/11
    9. Custom ROMs
      • ProtonAOSP[12] 11/01


    Disclaimer
    1. I assume no responsibility for the malfunctioning/bricking of your phone.
    2. The order of listed items i.e., Custom Kernels, Custom ROMS, etc. Does not indicate my preference for them. It is your responsibility to do the research before selecting an item.


    Prerequisites
    1. A Pixel 5 phone with an unlocked bootloader.
    2. The latest Android 12 Factory or OTA Image: "redfin" for Pixel 5


      Factory Image

      OTA Image
    3. A Computer with the latest SDK Platform-Tools: r31.0.3 installed.
      • Important: Update Platform Tools, regularly, for optimal performance.


    Other Guides


    Credits/Thanks/Recognitions
    1. @creezalird- Flash Android 12 factory image.
    2. Those I may have, inadvertently, forgotten.


    Index
    (NOTE: Numbers 1-11 are not steps, they are individual sets of instructions).
    1. Open a Command Prompt/Boot Fastboot Mode/Boot Recovery

      • Open a Command Prompt on Computer
        1. Open File Explorer, click the platform-tools folder ==> click the folder icon (left side of address bar) to highlight it type cmd and press enter.
        2. Open a Powershell Command Prompt on Computer: Open File Explorer, click the platform-tools folder ==> click the folder icon (left side of address bar) to highlight it type powershell and press enter.
        3. Notes:
          • Enable USB Debugging, on your phone: Settings ==> System ==> Advanced ==> Developer options ==> Scroll down to USB debugging and enable it.
          • When using the Powershell Command Prompt Commands must be preceeded with ./: i.e, ./fastboot devices
          • If you do not want to open a Command Prompt every time you want to use the fastboot command, add the path to the Platform-tools folder to Windows environment variables.
      • Boot fastboot mode (bootloader):
        • Power off phone, press and hold the power and volume down buttons until you see Start.
      • Boot Recovery
        • Power off phone, press and hold the power and volume down buttons until you see Start. Use volume up/down button until you see Recovery mode. Press power button.
    2. Test fastboot

      • Enable Developer Options - Tap Settings > About phone > Build number 7 times or until you should see 'you are a Developer'.
      • Enable USB Debugging - Tap Settings > System > Advanced > Developer options >
        Enable USB Debugging.
      • Open a Command Prompt on your computer in the Platform-tools folder.
      • Boot fastboot mode on your phone (#1)
      • Connect the phone to the Computer.
      • At the prompt type: fastboot devices to verify communication with phone. It should return your phone's serial number.
    3. Unlock Bootloader/Return Phone to Stock/Lock Bootloader

      • Unlock Bootloader

        1. This will erase all user data from the device!
        2. Backup your data
        3. Activate Developer Options: Tap Settings > About Phone > Tap Build Number 7 times or until you see you are a Developer. Tap back > System > Advanced > Developer Options. Enable OEM Unlock and, USB Debugging.
        4. Boot fastboot mode
        5. Connect the phone to the Computer with USB cord.
        6. Open a Command Prompt on your computer and type fastboot flashing unlock and press enter.
        7. You should see a request for confirmation on your phone, use the volume keys to scroll and the power key to select.
        8. Allow the process to complete and then type fastboot reboot at the Command Prompt and press enter.
        9. When your phone reboots disconnect your usb cable.
          Notes: After unlocking your bootloader, you'll see a warning: The bootloader is unlocked and... You will see this warning until, you relock the bootloader.
          Do not relock your bootloader until you have returned the device to Stock.
      • Return Phone to Stock

        1. Backup your data/Internal storage
        2. Settings > System > Advanced > Reset Options > Erase all data (factory reset)
        3. Log in
        4. Set up phone
      • Lock Bootloader

        1. Return the phone to Stock before locking the bootloader, failure to do so could brick your phone
        2. This will erase all user data from the device!
        3. Boot fastboot mode
        4. Open a Command Prompt and type this at the Prompt: fastboot flashing lock
        5. You should see a request for confirmation on your phone, use the volume keys to scroll and the power key to select.
        6. Allow the process to complete, then type this at the Command Prompt: fastboot reboot
        7. Enable Developer Options: Settings > About phone > Tap Build number 7 times or until you see 'you are a developer'.
        8. Tap Back > Developer options and toggle OEM Unlock off.
    4. Install/Update Factory Image keep data or wipe data

      • Important Note(s):
        1. If you are upgrading your phone to Android 12 a wipe is, absolutely necessary, if you want to root your phone after the upgrade. Subsequent, factory image updates do not require a wipe.
        2. If you are updating your phones firmware (factory image) and your phone was rooted: Disable all magisk modules and restore back Magisk app name if you hid it and reboot. Why? The magisk modules you are using may need updating to work with the updated firmware. Incompatiable modules cause bootloops. :(
        3. Always verify you have the latest version of SDK Platform-Tools installed on your computer before installing the Factory Image: Pixel 5 - redfin.
        4. If you get an error: while flashing, try one of these options:
          • Change the USB port to a non charging USB port.
          • Change the USB cord.
          • Change Computers.
        5. Backup your data
        6. Download the latest Factory Image: Pixel 5 - redfin to your Computer.
        7. Extract the factory Image to a folder.
      • Flash Factory Image Keep Data

        • Open the folder you extracted the Factory Image to and Edit the flash-all.bat file with a file editor i.e., DroidEdit app.
          1. Change this line: fastboot -w update image-redfin-aa9a.999999.999.zip
          2. to this: fastboot --disable-verity --disable-verification update image-redfin-sp1a.999999.999.zip
          3. Note: If you do not remove the -w your internal storage will be wiped.
        • After, you have edited the flash-all.bat file. Copy/Move these files to the Platform-tools folder:
          1. bootloader-redfin-....img
          2. flash-all.bat
          3. image-redfin-....zip
          4. radio-redfin-....img
        • Open a Command Prompt on your computer in the Platform-tools folder and type: flash-all at the Command Prompt and press enter.
        • The phone will reboot when flashing is completed.
        • Go-to 7. Root/Reroot with Magisk and Pass SafetyNet, • Patching the boot.img - to root/reroot.
      • Flash Factory Image Wipe Data

        • Open the folder you extracted the Factory Image to and Edit the flash-all.bat file with a file editor i.e., DroidEdit app.
          1. Change this line: fastboot -w update image-redfin-aa9a.999999.999.zip
          2. to this: fastboot -w --disable-verity --disable-verification update image-redfin-sp1a.999999.999.zip
          3. This will wipe your phone's Internal Storage.
        • Open the folder you extracted the Factory Image to and Copy/Move these files to the Platform-tools folder:
          1. bootloader-redfim-....img
          2. flash-all.bat
          3. image-redfin-....zip
          4. radio-redfin-....img
        • Open a Command Prompt on your computer in the Platform-tools folder and type: flash-all at the Command Prompt and press enter.
        • The phone will reboot when flashing is complete.
        • Setup phone
        • Enable Developer Mode and USB Debugging
          1. Setup => About phone => Tap Build number 7 times or untill you see you are a 'Devloper'.
          2. Setup => System => Developer options => Enable Developer options => enable USB Debugging
        • Go-to 7. Root/Reroot with Magisk and Pass SafetyNet, • Patching the boot.img - to root/reroot.
    5. ADB Sideload

    6. Extract/Flash boot.img

      • Extract boot.img

        1. Download the latest Factory image to your phone.
        2. Extract the Factory Image file (redfin-spa1.999999.999-factory-99a9a99a.zip) to a folder.
        3. Open the folder and, extract the Image file (image-redfin-spa1.999999.999.zip) into the folder.
        4. Copy the boot.img file to the computer's Platform-tools folder.
      • Flash boot.img

        1. Flashing the boot.img removes root.
        2. Open the folder you extracted the 'image...zip' file to and copy the boot.img file to your computer's platform-tools folder or to the folder that has fastboot.exe in it.
        3. Boot fastboot mode
        4. Connect the phone to the Computer
        5. Open a Command Prompt and type the following command at the prompt:
          fastboot flash boot --slot all boot.img
        6. Reboot
    7. Root/Reroot with Magisk and Pass SafetyNet.

      • Android 12

        1. Upgrading to Android 12 and rooting your phone
          • OP, Index, 4. Install/Update Factory Image keep data or wipe data
        2. You wiped your phone when upgraded to Android 12. You want to update the factory image and re-root it.
          • OP, Index, 4. Install/Update Factory Image keep data or wipe data
      • Patching the boot.img - to root/reroot.

        1. Do #6 - Extract boot.img
        2. Install Magisk Canary 23015
          Note: Tap 3 dot menu across from canary => Tap Go to file => Download, app-debug.apk
        3. Open Magisk Canary App
        4. Set the Update Channel Canary.
        5. Tap Install (next to Magisk)
        6. Tap, Select and Patch a File
        7. Select the boot.img file you extracted from the latest factory image.
        8. Tap the ✓ (Check Mark)
        9. Tap Let's Go
        10. When you see done, the boot.img has been patched (magisk_patched_xxxxxx.img), and stored in the download folder.
        11. Reboot
        12. Copy the patched boot.img file to your computer's Platform-tools folder or the folder that has fastboot.exe in it.
        13. Boot fastboot mode
        14. Connect the phone to the Computer with USB cord.
        15. Open a Command Prompt in the folder you copied the patched boot.img to.
        16. Type fastboot flash boot "name of patched boot".img without the quote marks at the Prompt and press enter.
        17. Type fastboot reboot at the Prompt and press enter.
        18. Important Notes: If your phone boot loops try one of the following options:
          • Flash the 'stock' boot.img to both slots: fastboot flash boot boot.img --slot all
          • Boot Safe Mode - Press Power Off button ==> Press Power Off until you see boot Safe Mode ==> Press Ok.
      • Pass Safety Net with SafetyNet Fix 2.2.0

        1. Download File(s)
        2. Install SafetyNet Fix 2.2.0
          • Open Magisk
          • Tap Modules icon
          • Tap Install from storage
          • Navigate to the SafetyNetFix file you downloaded
          • Tap the SafetyNetFix file
          • Tap the check mark (✓ at the bottom) to start the installation.
          • After it installs tap the Save icon to save the log
          • Tap Reboot.
        3. Settings for Magisk Canary 23015
          • Open Magisk App
          • Tap the Setup icon.
          • Scroll down to App and set the Update Channel to Canary.
          • Scroll down to Check Updates and enable it.
          • Scroll down to Magisk and enable Zygisk and Enforce DenyList.
          • Tap Configure DenyList => Tap 3 Dot Menu => Check ✓ Show system apps => Check ✓ Google Play Store, Google Pay, etc.
          • Scroll down to Superuser and enable Enable Biometric Authentication.
        4. Get Device Certified Clear Google Play Services, Google Play Store, Google Pay, etc. data
          • Turn Airplane mode on
          • Open Settings
          • Tap Apps & notifications
          • Tap see all...
          • Tap three dot menu
          • Tap Show system
          • Scroll down to Google Play Store
          • Tap Storage and Cache
          • Tap Clear storage
            Note: Repeat the 3 steps above for Google Play Services, Google Pay, etc.
          • reboot
          • Turn Airplane mode off
        5. Check Device Certification
          • Open Google Play Store app
          • Tap Menu - Circle top right
          • Tap Settings
          • Tap About
          • Check Play protect certification.
    8. Set Magisk App Update Channel/Update Magisk

      • Set Magisk App Update Channel

        • Open Magisk App > Tap Settings icon > Update Channel > Select Stable, Beta, Canary or Custom.
      • Update Magisk

        1. When Magisk App notifies you of an update:
        2. Tap install.
        3. Select, Direct Install (Recommended)
        4. When it finishes installing
        5. Tap, Save Log
        6. Log location: /storage/emulated/0/Download
        7. Tap, Reboot
        8. Done!
    9. Custom ROMs

      • Need help with a Custom ROM?
        • First, read and follow the Installation Instructions. The installation instructions are in the OP.
        • Second, if you have a problem Installing it, Search the thread of the Custom ROM you are trying to install for a solution to problem: If you don't find a solution post your request for help on the thread.
      • ROMs
        1. Alpha/Beta

          • None
        2. Official
        3. Unofficial

          • None
    10. Apps/Mods/Scripts/Tethering/Themes
    11. T.W.R.P. Backup/Restore

      • Waiting for Android 12 T.W.R.P.
    5
    is there a magisk boot img with modules disabled?. i have a boot loop and need a boot img with it disabled.
    You should have your stock image you can push over. I do not think replacing the boot image with another patched image would disable anything. You can also use adb to remove any modules. Regardless heres my patched boot image and the command to remove modules. Power off, connect phone enter this command, hold power button to boot phone.

    adb wait-for-device shell magisk --remove-modules

    Patched December build boot image
    here
    4
    For people who are having bootloops with patched boot.img
    Please pay attention to this step in the guide
    Section 7
    Under Patching boot.img
    4- Depending on the version of Magisk Manager installed: Set the Update Channel to Beta or Canary.

    Even if you install beta / canary magisk apk, if you don't select the matching channel, you'd get a bootloop, so don't forget that important step.
    3
    Thank you for your help I really appreciate it!
    Absolutely, helping each other is what makes this community work.
    3
    Hi and thanks for your guide!
    Could you please explain step by step how to update to December patch without loosing data and get back root after?

    I'm used to flashing and rooting with twrp on my pixel 2 xl but this is something different and I don't wanna wipe anything 😂

    I've followed this guide but they don't share the how to update to latest patch.


    Thanks 🙏
    Read #4 Important Notes 3. - Magisk
    Do #4 'Keep data' to flash Factory image
    Do #7 to reroot