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

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

Search This thread

thor.21

New member
Aug 22, 2021
2
0
I'm trying to unlock my new Pixel 4a. However, the OEM unlock doesn't work. When I check the option and push activate, it does nothing and is still deactivated. The option is NOT greyed out. Does anyone has an idea? Android 11 build 210805
 

tcat007

Senior Member
Jul 3, 2011
5,424
2,006
Austin, TX
I'm trying to unlock my new Pixel 4a. However, the OEM unlock doesn't work. When I check the option and push activate, it does nothing and is still deactivated. The option is NOT greyed out. Does anyone has an idea? Android 11 build 210805
You did all steps in OP?

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!
 

thor.21

New member
Aug 22, 2021
2
0
You did all steps in OP?

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!


The problem is that I can't enable "OEM unlocking". I have the option under developer options but if I push "enable OEM unlocking", it is not reacting. I know, that the option is greyed out for locked phones, but this is not the case here, the option is available.
 

a1291762

Senior Member
Nov 20, 2012
697
301
yasmar.net
I have a Pixel 4a since few days and look for root solutions. I only have a chromebook for pc.
Is there a way to do all steps from OP with that kind of pc ?
I haven't used a Chromebook but I believe you can install a Linux environment so that you can run Linux programs. From there you should be able to install adb and fastboot as you would on any other Linux device and then follow the steps to root your phone.

Here's a link that may help?
 

Sinykk

Member
Sep 3, 2015
48
8
toronto
So something strange happened over night. I've had my pixel 4a rooted for about half a year now with Magisk and of course I've been using Magisk hide. I'm on Magisk 23.0 from what I can see in the app. SafetyNet suddenly fails and I can't use Google Pay.

Edit: I was able to get it working with this
 
Last edited:

mikkoc

Senior Member
Mar 19, 2011
54
10
So something strange happened over night. I've had my pixel 4a rooted for about half a year now with Magisk and of course I've been using Magisk hide. I'm on Magisk 23.0 from what I can see in the app. SafetyNet suddenly fails and I can't use Google Pay.

Edit: I was able to get it working with this

I had the same issue today when trying to pay at the shop :(
The process described in the video seems very long, I'll wait a few days to see if a quicker method can be found by the smarter people.
 

bombadier

Senior Member
Jul 3, 2010
3,532
3,358
The Burgh
Google Pixel 3a
Google Pixel 4a
I'm trying to unlock my new Pixel 4a. However, the OEM unlock doesn't work. When I check the option and push activate, it does nothing and is still deactivated. The option is NOT greyed out. Does anyone has an idea? Android 11 build 210805
Have you kept it in airplane mode? , from memory I had to connect to WiFi once before I could toggle the OEM unlock
 

sapalot

Senior Member
Oct 31, 2010
87
6
So guys, what is the best way to take an OTA with magisk? The method described in this thread isnt active anymore? Help would be much appreciated.
 

a1291762

Senior Member
Nov 20, 2012
697
301
yasmar.net
So guys, what is the best way to take an OTA with magisk? The method described in this thread isnt active anymore? Help would be much appreciated.

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.
 

Joojoo1993

Senior Member
May 9, 2014
74
28
I had the same issue today when trying to pay at the shop :(
The process described in the video seems very long, I'll wait a few days to see if a quicker method can be found by the smarter people.

So with safetynet-fix v2.1.0 I am now passing SafetyNet again! :)

But, unfortunately I am still unable to use Google Pay. Any ideas how to solve this?

EDIT: OMG, I just forgot to close Google Pay and delete cache. Now it is working fine...
 
Last edited:

Codrea

Senior Member
May 22, 2012
287
29
Hi how to back up application data before unlock bootloader. I will back up my media to PC
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I tried extracting boot image from payload.bin. I was successful last month and many times earlier

    BUT
    With the November update it failed. Tried a variety of payload dumper tools but couldn't succeed. It throws up some error related to python_py.

    Has anyone been successful in doing this and how?

    @Zackptg5 has something changed with Android 12 (though I could do this on upgrading to 12)?
    I am still on A11. I have always grabbed the boot.img from the zip file, and I can see the boot.img file in the A12 ROM zip file (sunfish-sp1a.210812.015-factory-5a1091a3.zip) as well. I use 7Zip on a Win PC and that allows browsing down into a zip within a zip.
    1
    I tried extracting boot image from payload.bin. I was successful last month and many times earlier

    BUT
    With the November update it failed. Tried a variety of payload dumper tools but couldn't succeed. It throws up some error related to python_py.

    Has anyone been successful in doing this and how?

    @Zackptg5 has something changed with Android 12 (though I could do this on upgrading to 12)?
    I use superr kitchen and it works fine for me
    1
    It works for me:
    Magisk 23.0 stable
    Riru v 26.1.3.r513...
    Universal Safetynet Fix v2.1.2
  • 28
    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
    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
    How do you correctly update magisk on Pixel4a since patching boot.img and stuff. What are the steps ?
    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