[GUIDE] Pixel 3a XL "bonito": Unlock Bootloader, Update, Root, Pass SafetyNet

Search This thread

V0latyle

Forum Moderator
Staff member
If you are looking for my guide on a different Pixel, find it here:
For best results, use the latest stable Magisk release.
Discussion thread for migration to 24.0+.
Note: Magisk prior to Canary 23016 does not incorporate the necessary fixes for Android 12+.


WARNING: YOU AND YOU ALONE ARE RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOUR DEVICE. THIS GUIDE IS WRITTEN WITH THE EXPRESS ASSUMPTION THAT YOU ARE FAMILIAR WITH ADB, MAGISK, ANDROID, AND ROOT. IT IS YOUR RESPONSIBILITY TO ENSURE YOU KNOW WHAT YOU ARE DOING.

Prerequisites:


Android Source - Setting up a device for development


  1. Follow these instructions to enable Developer Options and USB Debugging.
  2. Enable OEM Unlocking. If this option is grayed out, unlocking the bootloader is not possible.
  3. Connect your device to your PC, and open a command window in your Platform Tools folder.
  4. Ensure ADB sees your device:
    Code:
    adb devices
    If you don't see a device, make sure USB Debugging is enabled, reconnect the USB cable, or try a different USB cable.
    If you see "unauthorized", you need to authorize the connection on your device.
    If you see the device without "unauthorized", you're good to go.
  5. Reboot to bootloader:
    Code:
    adb reboot bootloader
  6. Unlock bootloader: THIS WILL WIPE YOUR DEVICE!
    Code:
    fastboot flashing unlock
    Select Continue on the device screen.

  1. Install Magisk on your device.
  2. Download the factory zip for your build.
  3. Inside the factory zip is the update zip: "device-image-buildnumber.zip". Open this, and extract boot.img
  4. Copy boot.img to your device.
  5. Patch boot.img with Magisk: "Install" > "Select and Patch a File"
  6. Copy the patched image back to your PC. It will be named "magisk_patched-23xxx_xxxxx.img". Rename this to "master root.img" and retain it for future updates.
  7. Reboot your device to bootloader.
  8. Flash the patched image:
    Code:
    fastboot flash boot <drag and drop master root.img here>
  9. Reboot to Android. Open Magisk to confirm root - under Magisk at the top, you should see "Installed: <Magisk build number>

  1. Before you download the OTA, open Magisk, tap Uninstall, then Restore Images. If you have any Magisk modules that modify system, uninstall them now.
  2. Take the OTA update when prompted. To check for updates manually, go to Settings > System > System Update > Check for Update
  3. Allow the update to download and install. DO NOT REBOOT WHEN PROMPTED. Open Magisk, tap Install at the top, then Install to inactive slot. Magisk will then reboot your device.
  4. You should now be updated with root.

  1. Download the OTA.
  2. Reboot to recovery and sideload the OTA:
    Code:
    adb reboot sideload
    Once in recovery:
    Code:
    adb sideload ota.zip
  3. When the OTA completes, you will be in recovery mode. Select "Reboot to system now".
  4. Allow system to boot and wait for the update to complete. You must let the system do this before proceeding.
  5. Reboot to bootloader.
  6. Boot the master root image (See note 1):
    Code:
    fastboot boot <drag and drop master root.img here>
    Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
  7. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
  8. Reboot your device. You should now be updated with root.
Note: You can use Payload Dumper to extract the contents of the OTA if you want to manually patch the new boot image. However, I will not cover that in this guide.

Please note that the factory update process expects an updated bootloader and radio. If these are not up to date, the update will fail.
  1. Download the factory zip and extract the contents.
  2. Reboot to bootloader.
  3. Compare bootloader versions between phone screen and bootloader.img build number
    Code:
    fastboot flash bootloader <drag and drop new bootloader.img here>
    If bootloader is updated, reboot to bootloader.
  4. Compare baseband versions between phone screen and radio.img build number
    Code:
    fastboot flash radio <drag and drop radio.img here>
    If radio is updated, reboot to bootloader.
  5. Apply update:
    Code:
    fastboot update --skip-reboot image-codename-buildnumber.zip
    When the update completes, the device will be in fastbootd. Reboot to bootloader.
  6. Boot the master root image (See note 1):
    Code:
    fastboot boot <drag and drop master root.img here>
    Note: If you prefer, you can manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
  7. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
  8. Reboot your device. You should now be updated with root.
Note: If you prefer, you can update using the flash-all script included in the factory zip. You will have to copy the script, bootloader image, radio image, and update zip into the Platform Tools folder; you will then have to edit the script to remove the -w option so it doesn't wipe your device.
The scripted commands should look like this:
Code:
fastboot flash bootloader <bootloader image name>
fastboot reboot bootloader
ping -n 5 127.0.0.1 > nul
fastboot flash radio <radio image name>
fastboot reboot bootloader
ping -n 5 127.0.0.1 > nul
fastboot update  --skip-reboot <image-device-buildnumber.zip>
Once this completes, you can reboot to bootloader and either boot your master patched image, or if you patched the new image, flash it at this time.

PixelFlasher by @badabing2003 is an excellent tool that streamlines the update process - it even patches the boot image for you.
The application essentially automates the ADB interface to make updating and rooting much easier. However, it is STRONGLY recommended that you still learn the "basics" of using ADB.

For instructions, downloads, and support, please refer to the PixelFlasher thread.

  1. Follow the instructions on the Android Flash Tool to update your device. Make sure Lock Bootloader and Wipe Device are UNCHECKED.
  2. When the update completes, the device will be in fastbootd. Reboot to bootloader.
  3. Boot the master root image (See note 1):
    Code:
    fastboot boot <drag and drop master root.img here>
    Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
  4. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
  5. Reboot your device. You should now be updated with root.

SafetyNet has been deprecated for the new Play Integrity API. More information here.

In a nutshell, Play Integrity uses the same mechanisms as SafetyNet for the BASIC and DEVICE verdicts, but uses the Trusted Execution Environment to validate those verdicts. TEE does not function on an unlocked bootloader, so legacy SafetyNet solutions will fail.

However, @Displax has modified the original Universal SafetyNet Fix by kdrag0n; his mod is able to force basic attestation instead of hardware, meaning that the device will pass BASIC and DEVICE integrity.

Mod available here. Do not use MagiskHide Props Config with this mod.

This is my configuration that is passing Safety Net. I will not provide instructions on how to accomplish this. Attempt at your own risk.

Zygisk + DenyList enabled
All subcomponents of these apps hidden under DenyList:
  • Google Play Store
  • GPay
  • Any banking/financial apps
  • Any DRM media apps
Modules:
  • Universal SafetyNet Fix 2.3.1 Mod - XDA post
To check SafetyNet status:
To check Play Integrity status:
I do not provide support for Magisk or modules. If you need help with Magisk, here is the Magisk General Support thread. For support specifically with Magisk v24+, see this thread.

Points of note:
  • The boot image is NOT the bootloader image. Do not confuse the two - YOU are expected to know the difference. Flashing the wrong image to bootloader could brick your device.
  • While the Magisk app is used for patching the boot image, the app and the patch are separate. This is what you should see in Magisk for functioning root:
    screenshot_20230323-072859-3-png.5870161
  • "Installed" shows the version of patch in the boot image. If this says N/A, you do not have root access - the boot image is not patched, or you have a problem with Magisk.
  • "App" simply shows the version of the app itself.
  • If you do not have a patched master boot image, you will need to download the factory zip if you haven't already, extract the system update inside it, then patch boot.img.
  • If you prefer updating with the factory image, you can also extract and manually patch the boot image if desired.
  • Some Magisk modules, especially those that modify read only partitions like /system, may cause a boot loop after updating. As a general rule, disable these modules before updating. You are responsible for knowing what you have installed, and what modules to disable.


Credits:
Thanks to @badabing2003 , @pndwal , @Displax , @Az Biker , @ipdev , @kdrag0n , @Didgeridoohan , and last but not least, @topjohnwu for all their hard work!
 
Last edited:

Cheetah_Bear

New member
May 30, 2022
3
2
Hi, thank you for the guide. I am very new here and I have some questions that I hope you can answer before I proceed.

First of all, I assume I should back up my device on an external medium if I screw the pooch. With that in mind, do you have any suggestions/ links on guides that can help me with that? If not, I'm sure I can do some good digging to find something suitable.

Second, I'm not exactly sure what "Bonito" is and from what I have seen from googling, it seems to be connected to the LineageOS operating system. Is this different from the current, factory OS that my phone is running? Is there a way to root my device without changing the factory OS if that's the case? If not, that's okay, I don't mind switching to an open-source OS that seems to have a good reputation.

Third, is the guide supposed to be followed sequentially with the first step being, "Spoiler: Downloads" and the last step being, "Spoiler: Pass SafetyNet?" Or are the first 3 steps, "Spoiler: Downloads", "Spoiler: Unlock Bootloader" and, "Spoiler: Initial Root / Create Master Root Image" are essential steps and the subsequent steps afterwards are based on personal needs? Ideally, using Android Flash Tool seems painless and foolproof which is perfect for me. Afterwards, I will attempt to copy the Spoiler: Pass SafetyNet" step.

Fourth, what is your take on using Android Flash Tool vs TOOL ALL IN ONE for flashing? TOOL ALL IN ONE seems even more painless and fool-proof and apart from backing up, seems easier. But I would love your take on this?

Feel free to answer any or none of these questions. I know it's a lot but id rather ask questions to a staff member before proceeding?

Thanks again for the guide!
 

V0latyle

Forum Moderator
Staff member
Hi, thank you for the guide. I am very new here and I have some questions that I hope you can answer before I proceed.

First of all, I assume I should back up my device on an external medium if I screw the pooch. With that in mind, do you have any suggestions/ links on guides that can help me with that? If not, I'm sure I can do some good digging to find something suitable.
Without root, there is no way to do a full backup including app data. The best you can do is sync your Pixel with your Google account.
Second, I'm not exactly sure what "Bonito" is and from what I have seen from googling, it seems to be connected to the LineageOS operating system. Is this different from the current, factory OS that my phone is running? Is there a way to root my device without changing the factory OS if that's the case? If not, that's okay, I don't mind switching to an open-source OS that seems to have a good reputation.
"Bonito" is Google's internal name for the device and has little to do with the software. The Pixel 5 is "redfin", the 5a is "bramble", the Pixel 2 was "walleye".

As far as rooting your device, yes - if you follow this guide, you will gain root on the stock OS. I am currently using my Pixel 5 with the OEM firmware, patched with Magisk.
Third, is the guide supposed to be followed sequentially with the first step being, "Spoiler: Downloads" and the last step being, "Spoiler: Pass SafetyNet?" Or are the first 3 steps, "Spoiler: Downloads", "Spoiler: Unlock Bootloader" and, "Spoiler: Initial Root / Create Master Root Image" are essential steps and the subsequent steps afterwards are based on personal needs? Ideally, using Android Flash Tool seems painless and foolproof which is perfect for me. Afterwards, I will attempt to copy the Spoiler: Pass SafetyNet" step.
This guide is not sequential; I provided different instructions for different scenarios. The downloads are simply the resources you will need. To attain root, simply follow the instructions under "Initial Root". When the June update is released, you can update using your method of choice, and follow the relevant instructions to regain root.
Fourth, what is your take on using Android Flash Tool vs TOOL ALL IN ONE for flashing? TOOL ALL IN ONE seems even more painless and fool-proof and apart from backing up, seems easier. But I would love your take on this?
I personally do not like using third party tools, and I simply use adb/fastboot. The Android Flash Tool is simply for flashing factory firmware and cannot flash custom images.
Feel free to answer any or none of these questions. I know it's a lot but id rather ask questions to a staff member before proceeding?
No worries. It sounds like you have a lot to learn but you're at the right place; XDA is full of knowledgeable people who can help you out.
Thanks again for the guide!
Thank you for your appreciation.
 
  • Like
Reactions: Cheetah_Bear

Cheetah_Bear

New member
May 30, 2022
3
2
Well, with a bit of hard work and head-bashing into my desk, my phone is fully rooted and backed up. I want to extend my thanks again for this guide. I'll be sure to return when the next updates roles around.

I am still trying to play around with Safety Net and my financial app. YASNAC says my Saftey Net passes, but my finance app won't open because it's still, somehow, detecting root, even after being placed under the Deny List.

Regardless, that is a problem for another day. Today is a day of celebration because my phone is rooted and rocking. 🥳🥳

Thank you again.
 
  • Like
Reactions: V0latyle

V0latyle

Forum Moderator
Staff member
Well, with a bit of hard work and head-bashing into my desk, my phone is fully rooted and backed up. I want to extend my thanks again for this guide. I'll be sure to return when the next updates roles around.

I am still trying to play around with Safety Net and my financial app. YASNAC says my Saftey Net passes, but my finance app won't open because it's still, somehow, detecting root, even after being placed under the Deny List.

Regardless, that is a problem for another day. Today is a day of celebration because my phone is rooted and rocking. 🥳🥳

Thank you again.
Make sure you're using USNF and MHPC; DenyList alone won't do it.

You may also have to block the Play Store due to Play Protect.
 

BadRx

Senior Member
Dec 15, 2014
51
8
47
Azusa, CA
Google Pixel 3a XL
Moto G 5G
Most likely not. There is no way to force unlock. If you bought a branded variant like Verizon, unlocking the bootloader is not possible.
Why is that? I find that sooo... disturbing. From a hobbyist point of view this is just so unacceptable. You mean to tell me that I can't flash the chips somehow on this phone? Now there was a way carrier lock... you mean to tell me there is no way to carrier unlock? Not even the carrier? That's... just hard to believe.
 

V0latyle

Forum Moderator
Staff member
Why is that? I find that sooo... disturbing. From a hobbyist point of view this is just so unacceptable. You mean to tell me that I can't flash the chips somehow on this phone? Now there was a way carrier lock... you mean to tell me there is no way to carrier unlock? Not even the carrier? That's... just hard to believe.
I'm talking about bootloader unlock. It is a well known fact, having been established since the original Pixel (if not the Nexus series) that Google devices sold through carriers such as Verizon are not bootloader unlockable. This is why if you want a completely unlocked device, you must buy directly from Google.

As far as carrier unlock...that depends on the carrier. If you bought your device from Google, it's already carrier unlocked. But if you bought it through a carrier, they may or may not unlock it depending on their own policies. I don't know what Verizon's is, but most US carriers will allow carrier unlock as long as 1) there is no lien on the device (it's paid off) and 2) your account is not under contractual obligations.

It may seem weird to you, but they're protecting their investments. You can't reasonably expect a carrier to provide you a device at a discount with no restrictions. Either buy used from Swappa, or new full price from Google, and use the carrier only as a carrier. If you buy a phone through them, don't expect the same freedom.
 

4L3xN3t

Senior Member
Jan 12, 2009
192
8
39
Rome
Hi, before spamming all my stuff here, is this the right place to ask for help in the process of rooting (installing magisk and patching the boot.img) my pixel 3a XL?
thank you

Alex
 

4L3xN3t

Senior Member
Jan 12, 2009
192
8
39
Rome
Did you read the OP?
yes, I spent much more time on reading it and preparing the needed stuff than doing the process :)
if you're referring to the warning, yes, I'm quite familiar with ADB, Magisk, Android and Root, but not 100%. I've played with some devices in the past, but the last before the 3aXL was a Nexus6 and a lot of thing changed in the root process and I'm a bit confused.
anyway, if it's ok, I would try to explain what's appening, I got a bootloop at the last step of rooting

Alex
 

V0latyle

Forum Moderator
Staff member
yes, I spent much more time on reading it and preparing the needed stuff than doing the process :)
if you're referring to the warning, yes, I'm quite familiar with ADB, Magisk, Android and Root, but not 100%. I've played with some devices in the past, but the last before the 3aXL was a Nexus6 and a lot of thing changed in the root process and I'm a bit confused.
anyway, if it's ok, I would try to explain what's appening, I got a bootloop at the last step of rooting

Alex
What Android build are you on? Did you update?

What version of Magisk are you using?

What process did you use to root?
 

4L3xN3t

Senior Member
Jan 12, 2009
192
8
39
Rome
What Android build are you on? Did you update?

What version of Magisk are you using?

What process did you use to root?
ok, well, so, as I said I've an unlocked Pixel 3aXL with a stock ROM (bonito-sp2a.220505.006).
I'm on a fresh configured PC and just downloaded the latest platform-tools, USB driver, factory image, Magisk 25.2 canary.
Followed the guide in this page for the initial root, so I installed magisk, took the boot.img from the factory image, copied into the phone and patched via Magisk app. copied the patched boot.img into my platform-tools folder and flashed on the phone from the recovery via fastboot.

Now, after rebooting, the bootloop came. I just fix it flashing back the factory image, but of corse i'm still not rooted.

Maybe something related to the two boot_a and boot_b slots?
reading the boot.img flashing log it said it was flashed on boot_a (unfortunately i didn't check the actual slot before, I suppose was still boot_a) but then when i flashed the factory image to get rid of the bootloop it went on boot_b.
So I suspect I could have a misalignment beetween the two slot, but I'm not sure at all and anyway don't know exactly how to align them.

thank you
 

V0latyle

Forum Moderator
Staff member
ok, well, so, as I said I've an unlocked Pixel 3aXL with a stock ROM (bonito-sp2a.220505.006).
I'm on a fresh configured PC and just downloaded the latest platform-tools, USB driver, factory image, Magisk 25.2 canary.
Followed the guide in this page for the initial root, so I installed magisk, took the boot.img from the factory image, copied into the phone and patched via Magisk app. copied the patched boot.img into my platform-tools folder and flashed on the phone from the recovery via fastboot.

Now, after rebooting, the bootloop came. I just fix it flashing back the factory image, but of corse i'm still not rooted.

Maybe something related to the two boot_a and boot_b slots?
reading the boot.img flashing log it said it was flashed on boot_a (unfortunately i didn't check the actual slot before, I suppose was still boot_a) but then when i flashed the factory image to get rid of the bootloop it went on boot_b.
So I suspect I could have a misalignment beetween the two slot, but I'm not sure at all and anyway don't know exactly how to align them.

thank you
No, there's no "misalignment" between slots. Each slot has its own partitions, and the system will boot from whatever slot is active. So, since you're on Slot A, the system will load the boot image from /boot_a, and run the system from /system_a. It doesn't cross over.

When I asked "what build" are you running, I meant which Android release, not your phone type. I also asked how you updated - factory image or OTA?

Where did you download Magisk from? There is no "25.2 canary". The current Canary is 25203, but Stable should work just fine.

I suspect you may be doing something wrong, hence the bootloop. Rule of thumb: When you encounter a problem. ALWAYS make sure you're doing everything right, and don't assume there's something wrong with the system until you have gone back through the instructions and made sure you're doing everything correctly.

Word of advice: When someone asks you specific questions, make sure you answer all of them with as much detail as possible. The more information we have, the better we are able to help you.
 
  • Like
Reactions: 4L3xN3t

4L3xN3t

Senior Member
Jan 12, 2009
192
8
39
Rome
No, there's no "misalignment" between slots. Each slot has its own partitions, and the system will boot from whatever slot is active. So, since you're on Slot A, the system will load the boot image from /boot_a, and run the system from /system_a. It doesn't cross over.

When I asked "what build" are you running, I meant which Android release, not your phone type. I also asked how you updated - factory image or OTA?

Where did you download Magisk from? There is no "25.2 canary". The current Canary is 25203, but Stable should work just fine.

I suspect you may be doing something wrong, hence the bootloop. Rule of thumb: When you encounter a problem. ALWAYS make sure you're doing everything right, and don't assume there's something wrong with the system until you have gone back through the instructions and made sure you're doing everything correctly.

Word of advice: When someone asks you specific questions, make sure you answer all of them with as much detail as possible. The more information we have, the better we are able to help you.
ok, sorry, you're right, I lost something.
I wrote "bonito-sp2a.220505.006" because it thought it gives the information that I'm on the last available update for this phone of android 12.1. I always updated via OTA (I think it could be also interesting to know that I hadn't Magisk installed or any other modification at the time of the last update).
about Magisk I assumed that "25203" means "a release (the third?) of the 25.2", my fault...but anyway yes, I have the canary 25203, used it instead of the stable because sometimes in the past with other phones using it was the solution to some installation issues but I think this is not the problem.

I repeated the process (only the 9 steps of the "Spoiler: Initial Root / Create Master Root Image" guide) more than once, so I'm trying to understand if there might be something else wrong or corrupted.

partially unrelated question about the slots: if I force to boot from the slot A I'm supposed to go back to the bootloop, right?

Did you have anything in mind about this?

thank you
 

V0latyle

Forum Moderator
Staff member
ok, sorry, you're right, I lost something.
I wrote "bonito-sp2a.220505.006" because it thought it gives the information that I'm on the last available update for this phone of android 12.1. I always updated via OTA (I think it could be also interesting to know that I hadn't Magisk installed or any other modification at the time of the last update).
about Magisk I assumed that "25203" means "a release (the third?) of the 25.2", my fault...but anyway yes, I have the canary 25203, used it instead of the stable because sometimes in the past with other phones using it was the solution to some installation issues but I think this is not the problem.

I repeated the process (only the 9 steps of the "Spoiler: Initial Root / Create Master Root Image" guide) more than once, so I'm trying to understand if there might be something else wrong or corrupted.

partially unrelated question about the slots: if I force to boot from the slot A I'm supposed to go back to the bootloop, right?

Did you have anything in mind about this?

thank you
I generally recommend against switching slots unless absolutely necessary, and especially not if you update via OTA. The reason for this is if you force the device to boot from the "old" slot, Anti-Rollback Protection will kick in and cause a boot loop.

Since you're able to boot with the unpatched image, just flash that for the time being. Your device has to finish up the update after booting, and the rooted image can sometimes cause a problem with this. Once the device has been running for a bit, say 10 minutes or so, you should be able to safety flash the patched image.

Were you rooted before?
 

4L3xN3t

Senior Member
Jan 12, 2009
192
8
39
Rome
I generally recommend against switching slots unless absolutely necessary, and especially not if you update via OTA. The reason for this is if you force the device to boot from the "old" slot, Anti-Rollback Protection will kick in and cause a boot loop.

Since you're able to boot with the unpatched image, just flash that for the time being. Your device has to finish up the update after booting, and the rooted image can sometimes cause a problem with this. Once the device has been running for a bit, say 10 minutes or so, you should be able to safety flash the patched image.

Were you rooted before?
The last update was done in May, so I think I waited way more than 10minutes :)

I really can't remember if I rooted when I bought it, with android 10, but if so (with magisk anyway), after the upgrade to 11 I didn't root again for sure.
 

V0latyle

Forum Moderator
Staff member
The last update was done in May, so I think I waited way more than 10minutes :)

I really can't remember if I rooted when I bought it, with android 10, but if so (with magisk anyway), after the upgrade to 11 I didn't root again for sure.
Hmm. I am not sure why you are having problems now. The only thing I can suggest is flash the factory image using the instructions in the OP; you can also use the Android Flash Tool. You shouldn't need to wipe your device. Double and triple check to make sure you're patching the correct boot image, maybe post some screenshots or something (use spoilers) to show what you're doing. 99% of the time, if you are using the correct software, the problem is likely Magisk modules or incorrect patching.
 
  • Like
Reactions: 4L3xN3t

4L3xN3t

Senior Member
Jan 12, 2009
192
8
39
Rome
Hmm. I am not sure why you are having problems now. The only thing I can suggest is flash the factory image using the instructions in the OP; you can also use the Android Flash Tool. You shouldn't need to wipe your device. Double and triple check to make sure you're patching the correct boot image, maybe post some screenshots or something (use spoilers) to show what you're doing. 99% of the time, if you are using the correct software, the problem is likely Magisk modules or incorrect patching.
when I flash the factory image (as I did l 2days ago), I use the "flash-all.bat" included in the original zip after I delete the "-w" from "fastboot -w update imagexyz.zip" and this way it doesn't wipe the phone.

I'll try again in the nex days (hope to have time in the weekend) doing some screenshot

stay tuned.
thank you
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    If you are looking for my guide on a different Pixel, find it here:
    For best results, use the latest stable Magisk release.
    Discussion thread for migration to 24.0+.
    Note: Magisk prior to Canary 23016 does not incorporate the necessary fixes for Android 12+.


    WARNING: YOU AND YOU ALONE ARE RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOUR DEVICE. THIS GUIDE IS WRITTEN WITH THE EXPRESS ASSUMPTION THAT YOU ARE FAMILIAR WITH ADB, MAGISK, ANDROID, AND ROOT. IT IS YOUR RESPONSIBILITY TO ENSURE YOU KNOW WHAT YOU ARE DOING.

    Prerequisites:


    Android Source - Setting up a device for development


    1. Follow these instructions to enable Developer Options and USB Debugging.
    2. Enable OEM Unlocking. If this option is grayed out, unlocking the bootloader is not possible.
    3. Connect your device to your PC, and open a command window in your Platform Tools folder.
    4. Ensure ADB sees your device:
      Code:
      adb devices
      If you don't see a device, make sure USB Debugging is enabled, reconnect the USB cable, or try a different USB cable.
      If you see "unauthorized", you need to authorize the connection on your device.
      If you see the device without "unauthorized", you're good to go.
    5. Reboot to bootloader:
      Code:
      adb reboot bootloader
    6. Unlock bootloader: THIS WILL WIPE YOUR DEVICE!
      Code:
      fastboot flashing unlock
      Select Continue on the device screen.

    1. Install Magisk on your device.
    2. Download the factory zip for your build.
    3. Inside the factory zip is the update zip: "device-image-buildnumber.zip". Open this, and extract boot.img
    4. Copy boot.img to your device.
    5. Patch boot.img with Magisk: "Install" > "Select and Patch a File"
    6. Copy the patched image back to your PC. It will be named "magisk_patched-23xxx_xxxxx.img". Rename this to "master root.img" and retain it for future updates.
    7. Reboot your device to bootloader.
    8. Flash the patched image:
      Code:
      fastboot flash boot <drag and drop master root.img here>
    9. Reboot to Android. Open Magisk to confirm root - under Magisk at the top, you should see "Installed: <Magisk build number>

    1. Before you download the OTA, open Magisk, tap Uninstall, then Restore Images. If you have any Magisk modules that modify system, uninstall them now.
    2. Take the OTA update when prompted. To check for updates manually, go to Settings > System > System Update > Check for Update
    3. Allow the update to download and install. DO NOT REBOOT WHEN PROMPTED. Open Magisk, tap Install at the top, then Install to inactive slot. Magisk will then reboot your device.
    4. You should now be updated with root.

    1. Download the OTA.
    2. Reboot to recovery and sideload the OTA:
      Code:
      adb reboot sideload
      Once in recovery:
      Code:
      adb sideload ota.zip
    3. When the OTA completes, you will be in recovery mode. Select "Reboot to system now".
    4. Allow system to boot and wait for the update to complete. You must let the system do this before proceeding.
    5. Reboot to bootloader.
    6. Boot the master root image (See note 1):
      Code:
      fastboot boot <drag and drop master root.img here>
      Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
    7. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
    8. Reboot your device. You should now be updated with root.
    Note: You can use Payload Dumper to extract the contents of the OTA if you want to manually patch the new boot image. However, I will not cover that in this guide.

    Please note that the factory update process expects an updated bootloader and radio. If these are not up to date, the update will fail.
    1. Download the factory zip and extract the contents.
    2. Reboot to bootloader.
    3. Compare bootloader versions between phone screen and bootloader.img build number
      Code:
      fastboot flash bootloader <drag and drop new bootloader.img here>
      If bootloader is updated, reboot to bootloader.
    4. Compare baseband versions between phone screen and radio.img build number
      Code:
      fastboot flash radio <drag and drop radio.img here>
      If radio is updated, reboot to bootloader.
    5. Apply update:
      Code:
      fastboot update --skip-reboot image-codename-buildnumber.zip
      When the update completes, the device will be in fastbootd. Reboot to bootloader.
    6. Boot the master root image (See note 1):
      Code:
      fastboot boot <drag and drop master root.img here>
      Note: If you prefer, you can manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
    7. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
    8. Reboot your device. You should now be updated with root.
    Note: If you prefer, you can update using the flash-all script included in the factory zip. You will have to copy the script, bootloader image, radio image, and update zip into the Platform Tools folder; you will then have to edit the script to remove the -w option so it doesn't wipe your device.
    The scripted commands should look like this:
    Code:
    fastboot flash bootloader <bootloader image name>
    fastboot reboot bootloader
    ping -n 5 127.0.0.1 > nul
    fastboot flash radio <radio image name>
    fastboot reboot bootloader
    ping -n 5 127.0.0.1 > nul
    fastboot update  --skip-reboot <image-device-buildnumber.zip>
    Once this completes, you can reboot to bootloader and either boot your master patched image, or if you patched the new image, flash it at this time.

    PixelFlasher by @badabing2003 is an excellent tool that streamlines the update process - it even patches the boot image for you.
    The application essentially automates the ADB interface to make updating and rooting much easier. However, it is STRONGLY recommended that you still learn the "basics" of using ADB.

    For instructions, downloads, and support, please refer to the PixelFlasher thread.

    1. Follow the instructions on the Android Flash Tool to update your device. Make sure Lock Bootloader and Wipe Device are UNCHECKED.
    2. When the update completes, the device will be in fastbootd. Reboot to bootloader.
    3. Boot the master root image (See note 1):
      Code:
      fastboot boot <drag and drop master root.img here>
      Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
    4. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
    5. Reboot your device. You should now be updated with root.

    SafetyNet has been deprecated for the new Play Integrity API. More information here.

    In a nutshell, Play Integrity uses the same mechanisms as SafetyNet for the BASIC and DEVICE verdicts, but uses the Trusted Execution Environment to validate those verdicts. TEE does not function on an unlocked bootloader, so legacy SafetyNet solutions will fail.

    However, @Displax has modified the original Universal SafetyNet Fix by kdrag0n; his mod is able to force basic attestation instead of hardware, meaning that the device will pass BASIC and DEVICE integrity.

    Mod available here. Do not use MagiskHide Props Config with this mod.

    This is my configuration that is passing Safety Net. I will not provide instructions on how to accomplish this. Attempt at your own risk.

    Zygisk + DenyList enabled
    All subcomponents of these apps hidden under DenyList:
    • Google Play Store
    • GPay
    • Any banking/financial apps
    • Any DRM media apps
    Modules:
    • Universal SafetyNet Fix 2.3.1 Mod - XDA post
    To check SafetyNet status:
    To check Play Integrity status:
    I do not provide support for Magisk or modules. If you need help with Magisk, here is the Magisk General Support thread. For support specifically with Magisk v24+, see this thread.

    Points of note:
    • The boot image is NOT the bootloader image. Do not confuse the two - YOU are expected to know the difference. Flashing the wrong image to bootloader could brick your device.
    • While the Magisk app is used for patching the boot image, the app and the patch are separate. This is what you should see in Magisk for functioning root:
      screenshot_20230323-072859-3-png.5870161
    • "Installed" shows the version of patch in the boot image. If this says N/A, you do not have root access - the boot image is not patched, or you have a problem with Magisk.
    • "App" simply shows the version of the app itself.
    • If you do not have a patched master boot image, you will need to download the factory zip if you haven't already, extract the system update inside it, then patch boot.img.
    • If you prefer updating with the factory image, you can also extract and manually patch the boot image if desired.
    • Some Magisk modules, especially those that modify read only partitions like /system, may cause a boot loop after updating. As a general rule, disable these modules before updating. You are responsible for knowing what you have installed, and what modules to disable.


    Credits:
    Thanks to @badabing2003 , @pndwal , @Displax , @Az Biker , @ipdev , @kdrag0n , @Didgeridoohan , and last but not least, @topjohnwu for all their hard work!
    1
    Hi, thank you for the guide. I am very new here and I have some questions that I hope you can answer before I proceed.

    First of all, I assume I should back up my device on an external medium if I screw the pooch. With that in mind, do you have any suggestions/ links on guides that can help me with that? If not, I'm sure I can do some good digging to find something suitable.
    Without root, there is no way to do a full backup including app data. The best you can do is sync your Pixel with your Google account.
    Second, I'm not exactly sure what "Bonito" is and from what I have seen from googling, it seems to be connected to the LineageOS operating system. Is this different from the current, factory OS that my phone is running? Is there a way to root my device without changing the factory OS if that's the case? If not, that's okay, I don't mind switching to an open-source OS that seems to have a good reputation.
    "Bonito" is Google's internal name for the device and has little to do with the software. The Pixel 5 is "redfin", the 5a is "bramble", the Pixel 2 was "walleye".

    As far as rooting your device, yes - if you follow this guide, you will gain root on the stock OS. I am currently using my Pixel 5 with the OEM firmware, patched with Magisk.
    Third, is the guide supposed to be followed sequentially with the first step being, "Spoiler: Downloads" and the last step being, "Spoiler: Pass SafetyNet?" Or are the first 3 steps, "Spoiler: Downloads", "Spoiler: Unlock Bootloader" and, "Spoiler: Initial Root / Create Master Root Image" are essential steps and the subsequent steps afterwards are based on personal needs? Ideally, using Android Flash Tool seems painless and foolproof which is perfect for me. Afterwards, I will attempt to copy the Spoiler: Pass SafetyNet" step.
    This guide is not sequential; I provided different instructions for different scenarios. The downloads are simply the resources you will need. To attain root, simply follow the instructions under "Initial Root". When the June update is released, you can update using your method of choice, and follow the relevant instructions to regain root.
    Fourth, what is your take on using Android Flash Tool vs TOOL ALL IN ONE for flashing? TOOL ALL IN ONE seems even more painless and fool-proof and apart from backing up, seems easier. But I would love your take on this?
    I personally do not like using third party tools, and I simply use adb/fastboot. The Android Flash Tool is simply for flashing factory firmware and cannot flash custom images.
    Feel free to answer any or none of these questions. I know it's a lot but id rather ask questions to a staff member before proceeding?
    No worries. It sounds like you have a lot to learn but you're at the right place; XDA is full of knowledgeable people who can help you out.
    Thanks again for the guide!
    Thank you for your appreciation.
    1
    Well, with a bit of hard work and head-bashing into my desk, my phone is fully rooted and backed up. I want to extend my thanks again for this guide. I'll be sure to return when the next updates roles around.

    I am still trying to play around with Safety Net and my financial app. YASNAC says my Saftey Net passes, but my finance app won't open because it's still, somehow, detecting root, even after being placed under the Deny List.

    Regardless, that is a problem for another day. Today is a day of celebration because my phone is rooted and rocking. 🥳🥳

    Thank you again.
    1
    ok, well, so, as I said I've an unlocked Pixel 3aXL with a stock ROM (bonito-sp2a.220505.006).
    I'm on a fresh configured PC and just downloaded the latest platform-tools, USB driver, factory image, Magisk 25.2 canary.
    Followed the guide in this page for the initial root, so I installed magisk, took the boot.img from the factory image, copied into the phone and patched via Magisk app. copied the patched boot.img into my platform-tools folder and flashed on the phone from the recovery via fastboot.

    Now, after rebooting, the bootloop came. I just fix it flashing back the factory image, but of corse i'm still not rooted.

    Maybe something related to the two boot_a and boot_b slots?
    reading the boot.img flashing log it said it was flashed on boot_a (unfortunately i didn't check the actual slot before, I suppose was still boot_a) but then when i flashed the factory image to get rid of the bootloop it went on boot_b.
    So I suspect I could have a misalignment beetween the two slot, but I'm not sure at all and anyway don't know exactly how to align them.

    thank you
    No, there's no "misalignment" between slots. Each slot has its own partitions, and the system will boot from whatever slot is active. So, since you're on Slot A, the system will load the boot image from /boot_a, and run the system from /system_a. It doesn't cross over.

    When I asked "what build" are you running, I meant which Android release, not your phone type. I also asked how you updated - factory image or OTA?

    Where did you download Magisk from? There is no "25.2 canary". The current Canary is 25203, but Stable should work just fine.

    I suspect you may be doing something wrong, hence the bootloop. Rule of thumb: When you encounter a problem. ALWAYS make sure you're doing everything right, and don't assume there's something wrong with the system until you have gone back through the instructions and made sure you're doing everything correctly.

    Word of advice: When someone asks you specific questions, make sure you answer all of them with as much detail as possible. The more information we have, the better we are able to help you.
    1
    The last update was done in May, so I think I waited way more than 10minutes :)

    I really can't remember if I rooted when I bought it, with android 10, but if so (with magisk anyway), after the upgrade to 11 I didn't root again for sure.
    Hmm. I am not sure why you are having problems now. The only thing I can suggest is flash the factory image using the instructions in the OP; you can also use the Android Flash Tool. You shouldn't need to wipe your device. Double and triple check to make sure you're patching the correct boot image, maybe post some screenshots or something (use spoilers) to show what you're doing. 99% of the time, if you are using the correct software, the problem is likely Magisk modules or incorrect patching.