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

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

Search This thread

andyxo

Member
Aug 30, 2019
21
2
What timing just came back to add an update! I had to swap my sim for the day because couldnt focus on it, but last night i hooked it up and used the Chrome Flash Tool - took a bit, but everything came right back up (sigh of relief). So back running, but havent re-tired Magisk yet but will give it some testing later this afternoon!

that sound issue would be frustrating! Good luck!

Hey, thanks :)

So today ended up installing Magisk Manager 8.0.2 which ended me up with Stable Magisk 22.1 (not 23.0 which was the goal) and redid the whole boot patch rigamarole with the stock RQ3A.2106.05.005 boot file. Have rebooted my device now a bunch of times and my sound problem seems to have gone away (for the interim).

So after that have now have reinstalled DiamondJohn's recommended Android 11 V4A file (which he has linked to many places) and that's working too (well it was working before too when I was actually able to boot properly). Have rebooted now again a few times and am cautiously optimistic...

So I guess the moral of the story is that for those who are rooting their 4a (4G) phones for the first time with RQ3A.2106.05.005 and Magisk 23.0, keep on eye out on your sounds (cuz you might not have any after reboots). I enabled Touch Sounds under Sound & Vibration as an easy check by slapping the home key after each reboot.

And of course this will all prbly change once Magisk 23.x gets released or when we get a new OTA... then we will have new problems haha
 

XDAUser1234

Member
Sep 5, 2014
39
3
Quebec City
Hey, thanks :)

So today ended up installing Magisk Manager 8.0.2 which ended me up with Stable Magisk 22.1 (not 23.0 which was the goal) and redid the whole boot patch rigamarole with the stock RQ3A.2106.05.005 boot file. Have rebooted my device now a bunch of times and my sound problem seems to have gone away (for the interim).

So after that have now have reinstalled DiamondJohn's recommended Android 11 V4A file (which he has linked to many places) and that's working too (well it was working before too when I was actually able to boot properly). Have rebooted now again a few times and am cautiously optimistic...

So I guess the moral of the story is that for those who are rooting their 4a (4G) phones for the first time with RQ3A.2106.05.005 and Magisk 23.0, keep on eye out on your sounds (cuz you might not have any after reboots). I enabled Touch Sounds under Sound & Vibration as an easy check by slapping the home key after each reboot.

And of course this will all prbly change once Magisk 23.x gets released or when we get a new OTA... then we will have new problems haha

so you ended up with straing/new(ish) Magisk now right? no more Magisk Manager PLUS Magisk, but just straight Magisk 22.1? Do we still need the canary version?
 

andyxo

Member
Aug 30, 2019
21
2
so you ended up with straing/new(ish) Magisk now right? no more Magisk Manager PLUS Magisk, but just straight Magisk 22.1? Do we still need the canary version?

Well, I read in this thread (ya, a lot to read) people started reporting successful rooting with stable Magisk 21.0 and since v21.0 is a single standalone app yup, no more manager.

After installing the older Manager 8.0.2 yesterday I did update only the app to the latest v23.0 but did not update the Magisk itself from 22.1 just in case coz of my sound booting problems. The app shows Magisk installed 22.1 with an "Update" blue square next to it which I'm not gonna mess with ;-)
 
Last edited:

DiamondJohn

Recognized Contributor
Aug 31, 2013
5,538
5,280
Sydney
so you ended up with straing/new(ish) Magisk now right? no more Magisk Manager PLUS Magisk, but just straight Magisk 22.1? Do we still need the canary version?
But first test with the latest stable Magisk. @andyxo has issues with the latest, but its (23.0 and app 23.0) running perfectly fine on mine. NB: I do not try to get SafetyNet passing on my device.
 
  • Like
Reactions: XDAUser1234

XDAUser1234

Member
Sep 5, 2014
39
3
Quebec City
That's not a current fastboot because it doesn't know how to turn 'boot' into 'boot_a' or 'boot_b' based on the current slot.

If you can't upgrade to the current fastboot, you can try one of these options.

1. Find your current slot and boot that:
fastboot getvar current-slot # will be 'a' or 'b'
fastboot flash boot_a magisk_patched.img # or boot_b

2. Boot the patched image and get Magisk Manager to do the permanent installation.
fastboot boot magisk_patched.img
# use Magisk Manager to install (direct)

Option #2 got me rooted :). Booted the patched image, and as suggested used Magisk (23.0) do the direct install. Good to go with that trick! :).
 
Thought I'd report my experience in case it helps any newcomers like me.

Just picked up a P4a since my old phone finally died after 3+ years. Went through the rooting process as described in the first post using build rq3a.210705.001, stable Magisk v23.0, and SafetyNet fix v1.2.0. Everything seems to be working so far and TiBu is reporting root access. Magisk is also reporting successful SafetyNet.

I'll report back if I've missed anything that's not working. One thing I did have to do was manually load Android USB drivers to get my phone recognized in Fastboot mode, but maybe that's to be expected.

Thanks to @Zackptg5 for posting this guide, and for all the helpful comments throughout the thread. This is probably the smoothest rooting process I've had so far, but I am coming over from Sony devices.
 

Makishima

Senior Member
Jun 3, 2013
254
41
Xiaomi Mi A3
Google Pixel 4a
Could I get a definitive guide on how to update to the newest security update whilst rooted? I'm currently running the April update and latest Magisk canary and reading this thread I'm none the wiser what I should actually do to update... My system says I'm up to date so I can't get OTA and then reflash Magisk. Should I disable my modules, grab the latest boot.img, patch it and flash, is that enough, or do I need to install the whole zip?
 

a1291762

Senior Member
Nov 20, 2012
665
294
yasmar.net
Could I get a definitive guide on how to update to the newest security update whilst rooted?
Google doesn't seem to offer OTAs to people who are rooted. Maybe not even if your bootloader is unlocked? I have never been offered an OTA even after unrooting.

So you have to install a full OTA package manually, or install a factory image (after removing the -w flag) in order to update to the new image. You get these direct from Google and they're around 2Gb in size. Pros and cons to each.

Then you have to root again.

I prefer to patch boot.img myself but if you trust people, there are usually patched boot.img files floating around. Make sure you get one that matches your version and Magisk though.

I use factory images because it's simpler to get boot.img out. I patch boot.img with Magisk manager then boot the patched image before patching the real boot with Magisk manager.

But there's probably half a dozen different ways people do it...
 
  • Like
Reactions: Makishima

DiamondJohn

Recognized Contributor
Aug 31, 2013
5,538
5,280
Sydney
Could I get a definitive guide on how to update to the newest security update whilst rooted? I'm currently running the April update and latest Magisk canary and reading this thread I'm none the wiser what I should actually do to update... My system says I'm up to date so I can't get OTA and then reflash Magisk. Should I disable my modules, grab the latest boot.img, patch it and flash, is that enough, or do I need to install the whole zip?

Google doesn't seem to offer OTAs to people who are rooted. Maybe not even if your bootloader is unlocked? I have never been offered an OTA even after unrooting.

So you have to install a full OTA package manually, or install a factory image (after removing the -w flag) in order to update to the new image. You get these direct from Google and they're around 2Gb in size. Pros and cons to each.

Then you have to root again.

I prefer to patch boot.img myself but if you trust people, there are usually patched boot.img files floating around. Make sure you get one that matches your version and Magisk though.

I use factory images because it's simpler to get boot.img out. I patch boot.img with Magisk manager then boot the patched image before patching the real boot with Magisk manager.

But there's probably half a dozen different ways people do it...
I use Viper & VancedYT which is installed via Magisk. If you boot without Magisk running, you lose all your config & settings for these apps.

I manually flash my updates, and found this command line option to skip the boot, allowing me to flash the modified boot image, and then reboot.
fastboot --skip-reboot update image-sunfish-rq3a.210705.001.zip

Of course the big thing is the "-skip-reboot", and the above was for the July patch.

One way I have not tried myself, is downloading the smaller OTA image and flashing only that (ie not the full image). I think its "side loaded", the instructions are where you download it.
 
  • Like
Reactions: a1291762

Makishima

Senior Member
Jun 3, 2013
254
41
Xiaomi Mi A3
Google Pixel 4a
I use Viper & VancedYT which is installed via Magisk. If you boot without Magisk running, you lose all your config & settings for these apps.

I manually flash my updates, and found this command line option to skip the boot, allowing me to flash the modified boot image, and then reboot.
fastboot --skip-reboot update image-sunfish-rq3a.210705.001.zip

Of course the big thing is the "-skip-reboot", and the above was for the July patch.

One way I have not tried myself, is downloading the smaller OTA image and flashing only that (ie not the full image). I think its "side loaded", the instructions are where you download it.
So you don't disable the modules, you just flash the zip on top of your normal setup and then the patched boot image?

EDIT: Tried it and got this
Code:
Device version-bootloader is 's5-0.3-7062598'.
Update requires 's5-0.3-7241803'.

fastboot: error: requirements not met!
 
Last edited:

DiamondJohn

Recognized Contributor
Aug 31, 2013
5,538
5,280
Sydney
So you don't disable the modules, you just flash the zip on top of your normal setup and then the patched boot image?
Yep.

But I do have to come clean, It has come undone and ended in tears (ie boot loop) at least once. However, just yesterday (I shutdown every night and boot every morning), I booted and didn't log into (ie unlock) my phone for a but of time, and when I did, it ended in a boot loop (stuc on something like "device is starting"). My phone is highly customised. So I think its all my other stuff ,and not skipping a non magisk enabled boot. That has worked at least twice.

PS: Disabling the modules would be irrelevant if you do not flash a magisk enabled boot image.
 

Makishima

Senior Member
Jun 3, 2013
254
41
Xiaomi Mi A3
Google Pixel 4a
Yep.

But I do have to come clean, It has come undone and ended in tears (ie boot loop) at least once. However, just yesterday (I shutdown every night and boot every morning), I booted and didn't log into (ie unlock) my phone for a but of time, and when I did, it ended in a boot loop (stuc on something like "device is starting"). My phone is highly customised. So I think its all my other stuff ,and not skipping a non magisk enabled boot. That has worked at least twice.

PS: Disabling the modules would be irrelevant if you do not flash a magisk enabled boot image.
Well, it doesn't sound like the reason for this is skipping the reboot in the first command. It's pretty much dirty flashing so I guess it's expected, but I really don't want to format everything again... I also used Viper and Vanced (though the latter is no longer installed through Magisk I think) plus a few more mods so I might have similar problems.

Anyways, now I have to find out how I can update the bootloader first. Oh wait. I just did your command but not the flash-all.sh first... Will update with news.

EDIT: Managed to flash it. Took me hours to make platform-tools work on Fedora, the ones provided by the distro are way too out of date. Didn't try the skip-reboot method but had no problem with viper nor vanced. Thanks everyone.
 
Last edited:

DiamondJohn

Recognized Contributor
Aug 31, 2013
5,538
5,280
Sydney
Well, it doesn't sound like the reason for this is skipping the reboot in the first command. It's pretty much dirty flashing so I guess it's expected, but I really don't want to format everything again... I also used Viper and Vanced (though the latter is no longer installed through Magisk I think) plus a few more mods so I might have similar problems.

Anyways, now I have to find out how I can update the bootloader first. Oh wait. I just did your command but not the flash-all.sh first... Will update with news.

EDIT: Managed to flash it. Took me hours to make platform-tools work on Fedora, the ones provided by the distro are way too out of date. Didn't try the skip-reboot method but had no problem with viper nor vanced. Thanks everyone.
Regarding Vanced. It is "installed" via the manager app that explicitly creates the magisk module. So the daily running IS through magisk.

Just an FYI, this is the log of the steps I used to do my last flash. Its windows shell and I manually run each line. I do not run it as a single "flash all" and hence there are no wait steps, I simply wait.
Code:
adb kill-server

PATH=%PATH%;"%SYSTEMROOT%\System32";"C:\Java\x86\Android\android-sdk\platform-tools";
cd /d G:\flash_stock

fastboot devices
fastboot flash bootloader bootloader-sunfish-s5-0.3-7241803.img
fastboot reboot-bootloader

fastboot flash radio radio-sunfish-g7150-00047-210319-b-7220401.img
fastboot reboot-bootloader

fastboot --skip-reboot update image-sunfish-rq3a.210705.001.zip

fastboot reboot-bootloader

fastboot devices
fastboot flash boot magisk_patched-23000_UjTik.img

fastboot reboot

adb kill-server
 
Last edited:

DozenMadder

Senior Member
Jan 29, 2012
89
25
New England
I'm having difficulty at the "fastboot flash boot magisk_patched.img" stage of this process.
I'm using a new laptop so I installed fresh platform-tools and usb drivers (in the last couple days).
My p4a (carrier unlocked) came with RQ3A.210605.005 (June) and I unlocked the bootloader at this point.
Next I downloaded and adb sideloaded RQ3A.210705.001 (July) to be sure I had A11 on both slots.
Then I downloaded factory RQ3A.210705.001 and extracted root.img with the intention of patching it.

Here is where the trouble begins:
I can't remember what version of Magisk I installed first. Sorry, I've tried so many (both with and without updating).
They all produce a patched image but none have successfully flashed to the boot partition.
I keep getting the "partition not found" message. Does anyone have thoughts on this?
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
5,538
5,280
Sydney
I'm having difficulty at the "fastboot flash boot magisk_patched.img" stage of this process.
I'm using a new laptop so I installed fresh platform-tools and usb drivers (in the last couple days).
My p4a (carrier unlocked) came with RQ3A.210605.005 (June) and I unlocked the bootloader at this point.
Next I downloaded and adb sideloaded RQ3A.210705.001 (July) to be sure I had A11 on both slots.
Then I downloaded factory RQ3A.210705.001 and extracted root.img with the intention of patching it.

Here is where the trouble begins:
I can't remember what version of Magisk I installed first. Sorry, I've tried so many (both with and without updating).
They all produce a patched image but none have successfully flashed to the boot partition.
I keep getting the "partition not found" message. Does anyone have thoughts on this?
It may be helpfull if you actually post ALL your shell commands and the responses you receive. It may just be simple obvious typo. For example, in your post you say "root.img" which should be "boot.img" ;)
 
Last edited:
  • Like
Reactions: DozenMadder

a1291762

Senior Member
Nov 20, 2012
665
294
yasmar.net
I can't remember what version of Magisk I installed first.

Just run Magisk Manager and see? The version is the same.

They all produce a patched image but none have successfully flashed to the boot partition.
I keep getting the "partition not found" message. Does anyone have thoughts on this?

Your fastboot is too old. Use a newer one (that understands "boot" to mean boot_a or boot_b, depending on the active slot), or use fastboot boot patched.img to temporarily get root and then use Magisk Manager to install (DIRECT) to make it stick.
 
  • Like
Reactions: DozenMadder

a1291762

Senior Member
Nov 20, 2012
665
294
yasmar.net
I manually flash my updates, and found this command line option to skip the boot, allowing me to flash the modified boot image, and then reboot.
fastboot --skip-reboot update image-sunfish-rq3a.210705.001.zip
Nice find. I was able to avoid booting up without Magisk using this.
Download the factory image.
Extract boot.img and push to the phone.
Use Magisk to patch it and pull back to the PC.
Change flash-all.sh to use --skip-reboot and not use -w.
Run it. Wait.
Get back to real fastboot: fastboot reboot-bootloader
Boot the patched image: fastboot boot patched.img
Use Magisk to install (direct).
(I know you can flash the image from fastboot but this way I can use Magisk to revert to stock without needing a PC).
 

DozenMadder

Senior Member
Jan 29, 2012
89
25
New England
Just run Magisk Manager and see? The version is the same.



Your fastboot is too old. Use a newer one (that understands "boot" to mean boot_a or boot_b, depending on the active slot), or use fastboot boot patched.img to temporarily get root and then use Magisk Manager to install (DIRECT) to make it stick.
Sorry, I was unclear with my different versions statement. I installed and uninstalled many releases hoping for success.
I guess it doesn't matter now because your suggestion with temporary root worked flawlessly. Thanks a bunch!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    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
    1
    Same happened to me. Safetynet fail yesterday out of nowhere. I was rooted for a year. The vid Sinykk posted worked for me too but only after I also installed Universal SafetyNet Fix which I wasn't using before.
    1
    Also lost safetynet. Haven't tried @Sinykk's posted solution as I don't really use anything that requires safetynet. Odd that we all of a sudden lost it though.
    We all no longer have safety net because the magisk repo dev said he is removing the app hide feature
  • 26
    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