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

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

Search This thread

ukgoat

New member
Oct 21, 2021
4
1
I'm on Android 11, rooted with Magisk. How can I upgrade to Android 12 without messing something up or losing data? Can I just take the OTA via settings app or do I need to sideload it?
Everyone in Pixel 4A threads seems to be sideloading it.. is taking the OTA via settings -> system update bad?

I'm also skeptical about sideloading because Google's instructions say the Settings app should say "Your system is up to date", while mine says "System update available". Could that be a problem?

This is my first time doing a major Android update with unlocked bootloader / rooted, sorry for newbie questions. :oops:
 

beeshyams

Senior Member
Dec 29, 2014
1,612
547
Bangalore
I'm on Android 11, rooted with Magisk. How can I upgrade to Android 12 without messing something up or losing data? Can I just take the OTA via settings app or do I need to sideload it?
Everyone in Pixel 4A threads seems to be sideloading it.. is taking the OTA via settings -> system update bad?

I'm also skeptical about sideloading because Google's instructions say the Settings app should say "Your system is up to date", while mine says "System update available". Could that be a problem?

This is my first time doing a major Android update with unlocked bootloader / rooted, sorry for newbie questions. :oops:
1. Google recommendation doesn't make any difference. Logically, if you are already on latest why would you want to update? I did the same despite being more than 4 months late in updating

2. One needs to anyway download the ROM to extract the boot image, if you plan to download, so sideload is easier. You can safely install OTA update. Only if your device is rooted, make sure to uninstall Magisk completely to avoid any issues
 

themalic

New member
Feb 23, 2018
3
0
To answer myself, yes the same method works. Unistalled Magisk completely, sideloaded Android 12, patched boot using Magisk 23.0 stable and rooted
Hi, I have update my Pixel 4a, Android 12 using web Android Flash Tool and works well. But I never succes to root it like typical way during Android 11 which are patching boot using Magisk and flash it via fastboot. Do you have any idea why I have this issue since you were successfully did it?
 

beeshyams

Senior Member
Dec 29, 2014
1,612
547
Bangalore
Hi, I have update my Pixel 4a, Android 12 using web Android Flash Tool and works well. But I never succes to root it like typical way during Android 11 which are patching boot using Magisk and flash it via fastboot. Do you have any idea why I have this issue since you were successfully did it?
No idea TBH. Probably sideload and try again? Not that it should make a difference. Best of luck
 

a1291762

Senior Member
Nov 20, 2012
697
301
yasmar.net
Hi, I have update my Pixel 4a, Android 12 using web Android Flash Tool and works well. But I never succes to root it like typical way during Android 11 which are patching boot using Magisk and flash it via fastboot. Do you have any idea why I have this issue since you were successfully did it?

Try fastboot boot patched.img and see if Magisk manager thinks Magisk is running. If it is, install (direct) to make it stick.
 

beeshyams

Senior Member
Dec 29, 2014
1,612
547
Bangalore
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)?
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
5,724
5,556
Sydney
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.
 

Attachments

  • Capture.PNG
    Capture.PNG
    82.5 KB · Views: 20
  • Like
Reactions: beeshyams

Zackptg5

Recognized Developer
Sep 18, 2014
4,105
6,809
zackptg5.com
Google Pixel 4a
Google Pixel 5a
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
 
  • Like
Reactions: beeshyams

stereo007

Member
Sep 25, 2013
36
8
Hello all. I am new to the Pixel 4a. I have done everything according to instructions. However, I get at SafetyNet ctsProfile no ok. Did I miss something?
 

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