[GUIDE] Unlock/Root/Safetynet for Pixel 4a

Search This thread

a1291762

Senior Member
Nov 20, 2012
751
319
yasmar.net
Yes, just confirming that is indeed the process I was using :) Moved the boot.img to my Pixel, use the updated Magisk Canary to patch it, move it back to to my PC, then fastboot flash it. No dice.

Maybe you have Magisk modules that are the problem? I've only seen that for major upgrades but 🤷 could try disabling all modules, upgrade, and then enable one at a time?

I've only used regular Magisk not canary or anything. But I also don't try to hide root or pass safetynet so regular Magisk is enough.

People used to post patched boot images. Not sure if there's a posted image for march.
 

acspdx

Member
Dec 2, 2016
23
4
I bought a refurbished unlocked Pixel 4a from Amazon and wanted to root it, but the "OEM Unlocking" toggle was greyed out. I did a factory reset and tried again, but it still didn't work. I even tried booting up with my existing phone's SIM card... still no luck.

Does this mean the one I was sent is in fact a Verizon version whose bootloader cannot be unlocked? If so, is there any way to tell whether you're getting a Verizon one, or is it just the luck of the draw?

EDIT: I chatted with Google's support, and they were able to confirm — via the IMEI — that it was indeed a Verizon-tainted model. I'm sending it back to the Amazon seller, and I ordered one on eBay that has "unlocked bootloader" in the item description.
 
Last edited:
  • Like
Reactions: Lada333

beflythis

Senior Member
Jan 2, 2008
200
21
I bought a refurbished unlocked Pixel 4a from Amazon and wanted to root it, but the "OEM Unlocking" toggle was greyed out. I did a factory reset and tried again, but it still didn't work. I even tried booting up with my existing phone's SIM card... still no luck.

Does this mean the one I was sent is in fact a Verizon version whose bootloader cannot be unlocked? If so, is there any way to tell whether you're getting a Verizon one, or is it just the luck of the draw?

EDIT: I chatted with Google's support, and they were able to confirm — via the IMEI — that it was indeed a Verizon-tainted model. I'm sending it back to the Amazon seller, and I ordered one on eBay that has "unlocked bootloader" in the item description.
Did you get answers to your questions? First one I received was OEM unlockable, but the screen died on it after I pushed OTA android 12 to it... the replacement they sent has OEM unlocked greyed out (as you describe) and my attempts to command line fastboot oem unlock it all result in "fails".

Curious if this is a hard blocker, or there are still advanced workarounds for this?
 

acspdx

Member
Dec 2, 2016
23
4
Did you get answers to your questions? First one I received was OEM unlockable, but the screen died on it after I pushed OTA android 12 to it... the replacement they sent has OEM unlocked greyed out (as you describe) and my attempts to command line fastboot oem unlock it all result in "fails".

Curious if this is a hard blocker, or there are still advanced workarounds for this?
I don't think there's any workaround for a phone that's been in Verizon's hands.
 

beflythis

Senior Member
Jan 2, 2008
200
21
Thnx. It's on Android 12... runs great out of box so not horribly mad, but would like custom kernel and de-bloated roms at least.

To you knowledge, are verizon phones at least rootable to some degree (in an effort to de-bloat?) Or totally hands-off / stock only?
 

stereo007

Senior Member
Sep 25, 2013
50
10
I dunno if this is the "best" way...

What I do (summarised) is
1 download the factory image
2 extract it and the embedded zip until you have boot.img
3 send that to the phone and use Magisk manager to patch it. Send it back to the pc
4 replace the -w in the flash_all script with --skip-reboot. Add these 3 extra lines to the end.
fastboot reboot-bootloader
sleep 5
fastboot boot patched.img
5 run the script
6 use Magisk manager to install (direct)

This is how I installed the September update yesterday.
I do not understand point 4.
Does "fastboot -w update image-sunfish-sp2a.220305.012.zip" become "fastboot --skip-reboot"?
Here on the example of March, is this correct?
flash-all.sh
fastboot flash bootloader bootloader-sunfish-s5-0.4-8048734.img
fastboot reboot-bootloader
sleep 5
fastboot flash radio radio-sunfish-g7150-00088-220106-b-8048734.img
fastboot reboot-bootloader
sleep 5
fastboot --skip-reboot
fastboot flash boot patched.img
 
Last edited:

beeshyams

Senior Member
Dec 29, 2014
1,674
610
Bangalore
My phone is rooted and passes safetynet but gpay doesn't work. I'm running android 13. Any suggestions for getting it working?

There's a dedicated thread . You are likely to get fix here


Edit : are you using any Xposed modules that block access to contacts? That was the problem for me on Android 13
 
  • Like
Reactions: Lada333

treypop

Senior Member
May 3, 2015
154
21
OnePlus 6T
Google Pixel 4a
There's a dedicated thread . You are likely to get fix here


Edit : are you using any Xposed modules that block access to contacts? That was the problem for me on Android 13
Thx that fixed it for me
 
  • Like
Reactions: beeshyams

dadnammit

Senior Member
Jun 24, 2013
62
13
Having trouble "re-rooting" after an update, and need troubleshooting suggestions. It's been a long time since I first rooted using the steps here: https://www.xda-developers.com/google-pixel-4a-how-to-unlock-bootloader-root-pass-safetynet/

I lost root after an OTA and am finally trying to do it again, but it's not working. Now running Android 13. I did several OTA updates while the root was lost.

STEPS:
- I extracted the boot.img from the firmware on my device: "13.0.0 (TQ1A.221205.011, Dec 2022)"
- Magisk-v25.2.apk is installed.
- Patched the boot.img using Magisk.
- Copied magisk_patched-25200_r1Bfr.img to my PC.
- Started phone in fastboot and ran: fastboot flash boot magisk_patched-25200_r1Bfr.img
- Got response of OKAY writing to boot_a

The phone starts fine, but it's not rooted.
:(

Ideas?

(Magisk has the SuperUser button greyed out, and a Root Checker detection app fails. But some banking apps now fail because I am "rooted.")
 
Last edited:

TheSayaMan

Senior Member
Sep 12, 2016
1,128
501
OnePlus 9 Pro
Having trouble "re-rooting" after an update, and need troubleshooting suggestions. It's been a long time since I first rooted using the steps here: https://www.xda-developers.com/google-pixel-4a-how-to-unlock-bootloader-root-pass-safetynet/

I lost root after an OTA and am finally trying to do it again, but it's not working.

STEPS:
- I extracted the boot.img from the firmware on my device: "13.0.0 (TQ1A.221205.011, Dec 2022)"
- Magisk-v25.2.apk is installed.
- Patched the boot.img using Magisk.
- Copied magisk_patched-25200_r1Bfr.img to my PC.
- Started phone in fastboot and ran: fastboot flash boot magisk_patched-25200_r1Bfr.img

The phone starts fine, but it's not rooted.
:(

Ideas?
Are you on official stock or a custom ROM? If custom, you can sideload magisk in recovery
adb sideload magisk apk
I haven't had this device in a few years. If there is a trwp available, you can also boot twrp and install that way with official and custom without patching the boot img
 

dadnammit

Senior Member
Jun 24, 2013
62
13
Thanks, TheSayaMan. I'm on a stock ROM. Found a TWRP, but it doesn't look like Magisk supports intall that way anymore since v24.3. How would I do it?
 
Last edited:

dadnammit

Senior Member
Jun 24, 2013
62
13
SOLVED!

The problem was an old hidden Magisk app package was present. I removed all Magisk app versions. Flashed the patched boot.img created previously by by Magisk v25.2, and then reinstalled Magisk Manager. All is working now!
 

Natakranta

Senior Member
Mar 19, 2013
3,246
6,170
Dublin
Has anyone found a way to fix Safetynet CTS test fail on Google February image rooted with Magisk 25.2 ?
 

Attachments

  • Screenshot_20230301-214007.png
    Screenshot_20230301-214007.png
    96.8 KB · Views: 41
  • Screenshot_20230301-214023.png
    Screenshot_20230301-214023.png
    135.9 KB · Views: 40

Koile

Senior Member
Oct 11, 2009
59
7
I could not figure out, if this also works with Lineage or PixelExperience. Can anyone confirm, if it does?

Edit: Also: Is the problem with the broken Safetynet CTS mentioned by Natakranta already fixed?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 32
    With the pixel 4a finally arriving for some (like me), figured I'd make a quick guide

    Note that unlocking your bootloader breaks safetynet. There's a workaround in this guide but no guarantee that it won't get patched out in the future.

    Also note that this only works with the unlocked carrier model. Cell providers typically lock you out from this unlock process.

    Unlocking Bootloader (this is for the unlocked mode, can't speak for other models)
    • Go to system settings -> About phone -> tap on 'Build number' several times until Developer Options is enabled
    • Back out into settings and go to System -> Advanced -> Developer Options -> Enabled 'OEM Unlocking'
    • Unplug your phone if it's plugged into anything and power it off
    • Boot into fastboot by holding Power + Vol Down
    • Plug into pc -> open terminal/shell/whatever
    • Type 'fastboot flashing unlock' -> Follow prompt on device to unlock bootloader (Note that this will FACTORY RESET device)
    • The bootloader is now unlocked!

    Rooting
    • Grab the boot img for your rom. If it's stock, get it from the official zip
    • Copy the boot.img to your device
    • Install Magisk manager (grab it from the release zip on github - it's in the common folder)
    • Open Magisk Manager -> select 'Beta'
    • Back on the main page of Magisk Manager, Select 'Install' -> 'Select and Patch File' -> select your boot.img file -> it'll output the patched boot img to your Downloads folder
    • Copy the magisk_patched.img to your pc
    • Reboot your device back into fastboot (see Unlock section above)
    • Open a terminal in the directory your patched boot img file is and type 'fastboot flash boot magisk_patched.img'
    • You're now rooted!
    • Disable "Automatic System Updates" in Developer Options so you aren't surprised with an OTA on boot and end up unrooted (see the OTA section below on proper way of updating)

    Passing SafetyNet
    As was discovered some time ago, google is switching to a hardware attestation method for safetynet. Fortunately, at the time of writing, there is a workaround thanks to @Didgeridoohan. As of January 2021, this fix no longer works. A new module by @kdrag0n now fixes the hardware attestation issue:
    • Enable MagiskHide in magisk manager
    • Download/Install his Safetynet-fix module from this xda thread
    • Reboot and verify you should hopefully pass safetynet!

    Taking an OTA While Rooted

    Note: Installing to Inactive slot has been disabled temporarily meaning that if you take an ota, you'll need to do the patch boot img method like you did initially. See here for more details.

    Note that you can download the rom from google's site here and extra the boot img from there for patching.
    TopJohnWu has a great guide on how to do this here along with some nice screen shots that complement this quick guide. I'll summarize the applicable stuff here:
    • When an OTA is available, ignore it at first
    • Open Magisk Manager and go to Uninstall -> Restore Images
    • Now go back to Settings -> System -> Advanced -> System Update and install the OTA but DO NOT REBOOT
    • Once the install is done (but before rebooting), go back into Magisk Manager -> Install -> Install to Inactive Slot
    • Once the install is done, choose the reboot option IN MAGISK MANAGER. It works some voodoo magic to switch to updated slot and skip post-ota verifications
    Having issues?

    Try magisk canary instead


    Note that this isn't a support thread but just a guide. You're welcome to post your tips/experiences/questions here but don't expect me to answer or reply to them.

    I'll try to keep this updated with other useful guides such as TWRP when/if it is released for this device :good:
    3
    Everytime I install magisk module and reboot I boot back up without root. Amy help?

    When you fastboot flash, make sure you flash the slot you're booting from. If you're feeling lazy, flash the patched boot.img into both slots
    Code:
    fastboot flash boot --slot all boot.img
    3
    It works for me:
    Magisk 23.0 stable
    Riru v 26.1.3.r513...
    Universal Safetynet Fix v2.1.2
    3
    Actually I'm on October update, with unlock bootloader and root with Magisk Canary, how can I update to November update? If someone can explain clearly, I'm little afraid with out TWRP...

    Hello,

    You could do easily.
    - First check the channel update in magisk. Change to beta (beta works well know for patching boot.img)
    - Update the manager, update magisk by direct install, update modules if needed --> reboot
    (it's better to limit risk of a bootloop)
    - After reboot, open magisk manager and uninstall magisk --> Restore images.
    - Know you could going to settings --> system --> advanced --> update (you will see the november update)
    - Update --- (wait wait wait) and reboot (it's actually impossible to keep root by reflashing from magisk before reboot), after this you have lost root when reboot

    - Download the last sunfish for pixel 4a from --> https://developers.google.com/android/images#sunfish
    (don't accept any other sources about boot.img) check that the version is the same as the one you just updated.
    - Extract boot.img from zip inside the zip archive -> transfert on phone (delete any old boot.img or patched on the phone, to avoid a mistake)
    - In magisk manager --> install magisk --> select and patch a file, choose the boot.img.
    - transfert the new makisk_patched.img on computer in adb folder for example(look the size, it must be the same as the original file)
    - power off phone
    - Boot into fastboot by holding Power + Vol Down
    - plug phone and open adb
    Code:
    d:\platform-tools>fastboot flash boot magisk_patched.img
    Sending 'boot_b' (65536 KB)                        OKAY [  1.629s]
    Writing 'boot_b'                                   OKAY [  0.294s]
    Finished. Total time: 2.265s
    
    d:\platform-tools>fastboot reboot
    Rebooting                                          OKAY [  0.044s]
    Finished. Total time: 0.052s

    That's all, your are re-rooted after update.
    2
    i was trying to create a patched boot.img but the file always ends up being about half the size of the original file and when i flash it i cant boot any longer.

    Is there a specific version/combination of softwares that i need to produce a valid patched boot image? im currently using magisk manager 8.0.3 and 11.0.0 (RQ1A.201205.008, Dec 2020)

    EDIT: got it sorted out, as many stated before i needed to use the Canary Magisk apk to make it work. it was not so obvious where to get and the provided links are not working. In case anyone is looking for the link its on the github page in the readme
    1608385790142.png