yashsingh1/xdaforums huggingface dataset:
[Google Pixel 5a] V0latyle:
If you keep a master boot image, no. The boot image does not necessarily have to be from the same update to work; you can update via OTA, and keep using the same patched boot image to live boot with root (don't flash it) so that you can then Direct Install Magisk to the boot image on the device.
[Google Pixel 5a] GrandAdmiral:
I will keep that in mind. Thanks for that tip.
[Google Pixel 5a] proac:
4a 5G want to test this:D
[Google Pixel 5a] V0latyle:
I have written a similar guide in the 4a (5G) forum. Please keep posts relevant as these are device specific forums.
[Google Pixel 5a] proac:
Use fastboot boot <drag and drop master root.img here> to temporarily start it, and it fails. Only fastboot flash boot <drag and drop master root.img here>
[Google Pixel 5a] V0latyle:
That works too. If live booting the patched image doesn't work, just manually patch and flash the new boot image from the update.

Again, please keep your questions about your specific device in the relevant forum.
[Google Pixel 5a] dungm:
Got my 5a for couple of days. Should be rooted again after 10 years. Can't wait to go back Galaxy S2 generation.
[Google Pixel 5a] V0latyle:
I came to the Pixel 2 from the Galaxy S6. I'll never go back to Samsung if I can help it. To each his own, though.
[Google Pixel 5a] dungm:
Yeah, I meant it was the good time when playing around with it. But now no more Samsung stuff.
[Google Pixel 5a] cr1_1:
Hi,

Please reconsider the "deprecated" instructions about vbmeta :

fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img

The above command SAVED me.

I was stuck in a slow motion bootloop (Pixel 5A and 4A both had this behavior) when upgrading from Android 11 to Android 12 on rooted phones with Magisk (both stable and canary versions). Even clean installs with factory reset did not stop this bootloop.

What finally did was doing a factory wipe, clean install using full factory images then rebooting into recovery (before booting into system) and selecting restart bootloader. From the bootloader (and from a PC) I used

fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img

then rebooted into system. Rock solid stable.

So Magisk canary evidently doesn't do anything to the vbmeta flags. I still needed to explicitly disable the verfication settings.

Then I happily installed Magisk canary, configured the Zygist/Denylist, systemless hosts, and safety-net-fix 2.2.1.

All good, all stable.
[Google Pixel 5a] cr1_1:
Nuts. after about 2 hours, the bootloop is back, after I rebooted manually. Does vbmeta get reset on reboot?
[Google Pixel 5a] V0latyle:
No, and you shouldn't have needed to disable verity or verification. Magisk does not change these flags; what WAS fixed was the way Magisk handles the boot image header, so it preserves the vbmeta flags within the boot image so that disabling verity/verification are not necessary. This was implemented in Canary 23016, which at the time I write this is still the current canary.

What version of Magisk are you using?
[Google Pixel 5a] cr1_1:
Hi, thank you for responding. I am using Canary 23016. Enabled Zygist, configure the Denylist to hide Google Play services, Google Play store, my banking app and GPay. Also installed safety-net-fix 2.2.0 and systemless hosts.

The looping began after flashing the magisk-patched boot image (taken from the Dec 5, 2021 barbet full factory boot.img. Upon rebooting into system, the looping began.

I also did a factory reset, without restoring any of my apps, just as when the Pixel5a came out of the box. When I installed Canary 23016 and then flashed the magisk-patched boot img, the same bootloop behavior appeared.

Since then I did a complete factory reset, restored my apps, etc. But did not install anything Magisk and obiously no root. The phone is now stable. no bootloop.

By the way, what I am calling a bootloop means booting up into the system, logging in, and waiting between 10 and 60 secs. the phone then freezes, becoming unresponsive to any touch, and the clock time freezes. Within another 30 secs after this freeze, the phone will reboot itself without my doing anything. Even if I then do not login but just leave the phone at the login screen, the freezing and eventual rebooting will continue.

Also, this rebooting is strange in that the unlocked bootloader warning screen does not appear so maybe it's some kind of partial reboot?

Anyway, much thanks for any suggestions you might have.

p.s. I can flash the Pixel5a with Android 11 os from Oct 2021, and root with Magisk stable, Riru, etc and the phone is rock solid. Also, this behavior is identical to a Pixel 4a I have when I tried upgrading to Android 12 on that phone.

Something in the magisk-patched boot.img is making both phones unstable. or maybe flashing any boot.img patched or not causes the instability?
[Google Pixel 5a] V0latyle:
A properly patched boot image won't cause instability. You're having a unique issue.

Are you using the latest platform tools? Current version is 31.0.3

Can you try using another cable or PC?

Where did you download Magisk from?
[Google Pixel 5a] cr1_1:
hi,

I checked and made sure I am using platform-tools_r31.0.3-windows as linked from Google's latest factory image page. I downloaded Canary from TopJohnWu's GitHub page. Also tried several new USB cables.

I tried doing yet another factory reset, and clean install using flash-all.bat with wipe. I set up the phone without restoring any of my apps, just the few default included Google apps. Downloaded Canary again.

Just for grins, I extracted boot.img from the Android 12 OS Dec 5, 2021 release, which is the factory image I have been using, rebooted into the bootloader and fastboot flash boot boot.img to see if flashing was somehow corrupting the boot.img. Rebooted into system and it is rock solid.

The same problem of bootlooping after flashing magisk-patched image occurred with the Nov 2021 Android 12 factory image.

Then I flashed the magisk-patched boot image. Rebooted into system. The phone was stable for several minutes.

I then rebooted the phone. And the bootlooping started up again. Why does rebooting triggered the bootloop instability?

I downloaded and partially installed Canary 23016 (didn't flash the boot image, just installed app-debug.apk.) And no problems . It is the flashing of the patched boot image which somehow causes the bootlooping

Nothing like this happened with Magisk and Android 11. rock solid. Sigh.

Thank you for your suggestions. Hopefully this can be solved. And the problem appears on Pixel4A and Pixel 5A.
[Google Pixel 5a] manjaroid:
If you boot to the bootloader screen does it say it's unlocked?
[Google Pixel 5a] iamnitsuji:
Give V0latyle a standing ovation! These are the clearest root instructions I've ever followed. My last, older phone was fine with stable Magisk and no modules for passing SafetyNet. I am so glad I didn't try stable Magisk. I had no idea about Canary, Zygisk, and these modules. This was a piece of cake. Every app that cares, doesn't see that I'm rooted. Woo hoo! Thanks, man!
[Google Pixel 5a] V0latyle:
So patching the December update with Magisk was stable? I'm not sure I see the problem. If you're able to root on the latest update and are stable, why would you want anything else?

Again, why would you want to go back to November? Just use the latest release.

It shouldn't. As I mentioned previously, you seem to be having a unique issue. Since you mention this problem happening on two devices, you need to make sure you aren't confusing the software between the two of them. The 5a boot image won't work on the 4a and vice versa.

This is what I would do in your shoes:

Download the December factory image. Rename it so that you know what device it is for - i.e., "Pixel 5A Dec 2021.zip"

Reboot to bootloader, connect your phone via USB, and go to Android Flash Tool

Install the same factory update you downloaded. Make sure the build number matches. Check the "Wipe Data" and "Force Flash All Partitions" boxes.

When flashing is complete, set up your phone, and install Magisk 23016

Unzip the December factory image, then unzip the "image-device-buildnumber.zip" inside it. Copy boot.img from this zip to your device.

Patch boot.img in Magisk. Before you copy it back to your computer, delete ALL previously patched boot images. Make sure you rename the patched boot images so you know what device they are for, i.e., "Magisk 23016 5a.img"

Reboot your device to bootloader, and flash the patched boot image. MAKE SURE you are using the boot image for that specific device.

Again, I can't stress it enough - if you're doing this on more than one device, make sure you are segregating the files and folders so you don't accidentally flash the 5a firmware or boot image on the 4a and vice versa.

Also, make sure you are using Command Prompt, not PowerShell.
[Google Pixel 5a] goodjuju:
A stupid question - No need to unlock bootloader before rooting using this method?
[Google Pixel 5a] CarinaPDX:
Thanks for your work. I had issues of undetermined origin with 11, and had been delaying upgrading to 12, so as a result of the problems I wiped the 5a and did a Flash Tool install of the December factory image and then rooted with Magisk Canary; it worked well.

Today I tried 4 times to download and install the January OTA Security release, and each time it fails to finish the install after downloading. The instructions in post #1 say to take the OTA but don't mention any required prior steps. Could it be that I have to uninstall Magisk first? Or something else? Thanks for any help.
[Google Pixel 5a] V0latyle:
Did you read the OP? Rooting is not possible without an unlocked bootloader.

Nothing else should be required. I personally don't update via OTA; I use the factory image. It's normal for the OTA to fail on a rooted device, although sometimes retrying it will succeed.

Uninstalling Magisk should not be necessary. I just updated my 5 and wife's 5a without changing anything - just updated using factory image, flashed patched boot image, and done.

For those who are wondering, this is how I updated my wife's 5a (and my Pixel 5):

Download and extract the factory image

Extract boot.img from the factory update image

Copied boot.img to device, patched in Magisk, copied patched boot image back to update folder

Reboot device to bootloader

Apply update:

fastboot update device-image-buildnumber.zip

Let device boot and finish update; reboot to bootloader

Boot patched image:

fastboot boot magisk_patched-23016_xxxxx.img

Open Magisk, tap Install, Direct Install, then reboot.

Done.

You can potentially save a couple steps by using --skip-reboot when applying the update, then simply rebooting to bootloader and flashing the patched boot image.
[Google Pixel 5a] peikojose:
Doing that you need to flash the new bootloader and radio, right? I don't see you did that.
[Google Pixel 5a] CarinaPDX:
OK, thanks for that. I would rather get the OTA working as that is a lot smaller than the 2GB+ factory image to download. If I select Uninstall in Magisk and then restore images would that end up wiping or encrypting my data?
[Google Pixel 5a] CarinaPDX:
A full factory image has all images included. It is optional to install all partitions or just those that need updating. The whole point is that you end up with a complete OEM firmware with all partitions at a known good release. In the past, and possibly in the future, OTAs (i.e. partial updates) have on occasion not resulted in everything working right - requiring a factory image to fix. The advantage of OTAs is that they try to migrate data if there is a change of format for certain config files (especially between full releases such as 11 to 12), but this is also a potential failure point.
[Google Pixel 5a] peikojose:
I mean using this fastboot update device-image-buildnumber.zip

I don't think that will update radio and bootloader
[Google Pixel 5a] CarinaPDX:
If you flash the factory image it's shell script will work properly. An update command may not get you where you want to go. I have always used the command line tools but the install of 12 I did with the Android Flash Tool web app and it was very easy and clear. You should back up (sync) everything before proceeding of course.
[Google Pixel 5a] V0latyle:
The bootloader and baseband version in the January update are the same as December. Updating them is only necessary if the versions are different; the system update will fail if the bootloader and baseband versions don't match expected.

No. But, if you do not already have a Magisk 23016 patched boot image handy, you're still going to need that.

Uninstalling Magisk is not necessary to update.

I don't use the shell script - I manually compared the bootloader and baseband versions, and simply applied the system update. There is no need to reflash bootloader and baseband if they haven't been updated.
[Google Pixel 5a] goodjuju:
Thanks VOlatyle for the unlocked bootloader clarification. My bad. Missed the very firt line when read the instructions.
[Google Pixel 5a] nijel8:
Just in case sharing a tip for a situation I have encountered multiple times while building and testing TWRP boot.img,

This will happen if you try to boot any broken(corrupted) unbootable boot.img.

Fastboot sends the image to device and bootloader reports with unsupported. You reboot and phone goes straight to recovery with 2 options - try again or wipe data. You can't boot to Android keeping data any more despite the fact that you didn't flash anything and boot_a/b partitions are still good. In that case the only way out is to do "fastboot boot <known good boot.img>" and then do normal reboot with no lost of data.

Hope this never happens, but now you know if it does...
[Google Pixel 5a] V0latyle:
TWRP hasn't been updated to work with Android 12 yet. Nor has this been a concern in tis context. Please don't post solutions to problems that are not relevant here, as they can be confusing to some users.

But yes, in all circumstances, if there is a problem with the patched boot image, the user can always reflash the factory boot image.
[Google Pixel 5a] nijel8:
TWRP works just fine with Android 12 and what I posted can happen to everyone patching the boot.img... You should know better files get corrupted all the time...

And I am not even tallking about flashing... Just booting bad boot.img puts the phone in wipe-data state.
[Google Pixel 5a] V0latyle:
Not always, the bootloader will generally reject the boot image altogether, due to dm-verity.

TWRP does not work with Android 12 on the 765G platforms. It won't decrypt data, and in my case on the Pixel 5, gets stuck at the TWRP loading screen.
[Google Pixel 5a] GrandAdmiral:
So I am trying to install the latest update using the OTA option (already on Android 12 using the same process), but the system update screen keeps tells me that it can't install the update (message says "Installation problem"). I'm currently plugged up and the battery is over 50% charged. Anyone encounter this before?
[Google Pixel 5a] V0latyle:
Yes, sometimes this occurs on rooted devices. Keep trying, or use a different method.
[Google Pixel 5a] Jeroen1000:
@V0latyle Maybe I am doing it wrong on my 5a but I end up on the same SW-version as before my upgrade. I may assume wrongly here your instructions can also be applied to the Pixel 5a. Can you please offer your insights?:)

Device is on 12.0.0 (SQ1A.211205.008, Dec 2021) and going to 12.0.0 (SQ1A.220105.002, Jan 2022)

View attachment 5507707

@Oswald Boelcke Apologies for posting in the wrong forum. I had (obviously) not checked there was a similar topic here. It does appear @V0latyle answer got lost: I got an e-mail that he replied but the reply cannot be found
[Google Pixel 5a] V0latyle:
I replied then remembered we were in the wrong forum so I deleted my reply.

Nothing actually appears wrong with your commands.

Is your master root image from a previous release? If so, make sure you're using Direct Install in Magisk to patch the new boot image, then reboot.
[Google Pixel 5a] Jeroen1000:
I'll try not to make it a habit posting in the wrong place.

So I got my phone and updated it to the 12.0.0 (SQ1A.211205.008, Dec 2021) SW. At this point it was _not_ rooted. Then I downloaded the factory image for SQ1A.211205.008. I patched boot.img and flashed that. tl;dr Bascially what your tutorial explains in the initial root section.

The only thing different I do is instead of rebooting to recovery, I did

adb.exe reboot sideload

So when I boot the master boot image using

fastboot boot <drag and drop master root.img here>

I did select direct instal in magisk. Nothing odds happens*. I am not sure I understand Magisk is patching the correct boot.img though. I even booted to the inactive slot to check the upgrade ended up there. But it didnt.

* believe my phone did reboot twice. That might be unexpected behaviour?
[Google Pixel 5a] V0latyle:
What happens when you boot to the inactive slot? Check the build number. I believe Magisk may be trying to patch the inactive slot. So, if one slot is "old" and the other slot is "new", just boot the "old" slot, which probably still has a patched boot image, and select Direct Install in Magisk.

Personally I just use the factory image method as it flashes both slots.
[Google Pixel 5a] Jeroen1000:
@V0latyle I booted to the inactive slot (see below) and it was on the very same version 12.0.0 (SQ1A.211205.008, Dec 2021). The full factory image comes with a Google warning I decided not to ignore "Note that it's typically easier and safer to sideload the full OTA image instead."

View attachment 5507739
[Google Pixel 5a] V0latyle:
I'm confused, are you trying to update to January?

Is either slot rooted?

The reason why OTA updates are generally "safer" is because they install to the inactive slot; if booting the inactive slot fails for whatever reason, the system will revert to the original slot.

More details here

Basically this is how it works:

Pixel devices have A/B slots

While system is running on slot A, it can download and install OTA update to Slot B, then command a reboot

If boot is successful, Slot B is set as active; the next OTA will be installed to Slot A

If boot is not successful, system reboots to Slot A (the non-updated slot) and the update can be attempted again.

The idea here is that the device has a degree of "self recovery" wherein it will revert to a usable state if the update fails for whatever reason. This works regardless of whether the bootloader is unlocked.

Flashing the factory image only works on an unlocked bootloader for two reasons:

Partitions are flashed directly from PC

Partition images cannot be verified for integrity and authenticity

ADB sideload basically works the same way as the seamless system update, just from recovery. The OTA image is checked against a known hash before it is flashed.

All that being said, it's pretty much moot for those of us with unlocked bootloaders, to a degree - if something goes wrong, it's most likely your own fault, and you have to fix it yourself - the device won't be able to fix it for you. For instance, if something goes wrong with the factory flash for whatever reason, you'll have to figure out why and ensure a subsequent flash is successful. Or, if you accidentally wipe data during the update, you're screwed - there is no way to recover user data once wiped. The OTA on the other hand never touches user data. The factory update in of itself doesn't either - the update process might, specifically the script included, as it incorporates the -w option by default to wipe data. So, if User Johnny Knucklehead skims over a few guides that aren't specific to his device, and decides to update by downloading the factory image and running the script without editing or learning the commands...then he'll have to start from scratch when things go wrong.
[Google Pixel 5a] Jeroen1000:
@V0latyle slot A is currently rooted. Hence, the phone is booting off slot A. Not sure about slot B. And yes, I am updating to January. A/B seems to work the same as it does on my OP7T judging from your excellent recap.

Anyway, I noticed some "suspicous" behaviour.

1. after the sideload procedure completes, I boot to bootloader and boot the master boot image.

2. The phone starts booting (displays the G with the progress bar animation below) and then...it reboots again as I get to see the warning screen (again) about having an unlocked boot loader.

Believe this would fall into the "If boot is not successful, system reboots to Slot A (the non-updated slot) and the update can be attempted again." catergory. So I am now assuming my Full OTA updates fail. As to why, I do not know.
[Google Pixel 5a] V0latyle:
It's pretty much an Android standard now, almost all contemporary devices do it.

I think what's going on here is you're immediately trying to boot the patched image instead of letting the update boot by itself. This is why:

You actually just said why without realizing it.

After the OTA is installed and the device attempts to boot the updated slot, the system checks to make sure everything was updated correctly. What's happening here is you're interrupting that process, and forcing the older boot image to boot, so when the system attempts boot, it sees a mismatch between the January system update and the older patched boot image. It then decides the update was not successful, marks that slot as "unsuccessful boot", and reboots to Slot A.

So, here's what you have to do:

Sideload the OTA

Reboot to system, do NOT interrupt the process, allow system to boot without root

Allow update to complete (watch notifications, it'll say something about completing update)

When update is complete, reboot to bootloader

Boot patched image

Direct Install in Magisk.

Let me know how that works out; if that's the ticket, I need to update my OTA instructions.

Failing that, I would say just download the January factory image and update that way, and manually patch the January boot image in Magisk.
[Google Pixel 5a] Jeroen1000:
@V0latyle Yes that did the trick indeed. Thank you! Guess there is no way escaping a full boot to let the update finish.

Did this behaviour change in Android 12 perhaps (maybe you wrote the insturctions for Android 11)?
[Google Pixel 5a] V0latyle:
Nope, it's always been true of seamless system updates since at least Android 9. It must have slipped my mind when I was writing the guide. I'll update it soon.
[Google Pixel 5a] GrandAdmiral:
And to confirm, I'm still able to use a master boot image (original update to Android 12's not image) to live boot and then direct install?
[Google Pixel 5a] canibuz:
Might want to add the latest safety net fix 2.2.1 doesn't require riru anymore.

Releases · kdrag0n/safetynet-fix

Google SafetyNet attestation workarounds for Magisk - kdrag0n/safetynet-fix

github.com
[Google Pixel 5a] V0latyle:
Riru doesn't work with Zygisk so it's pretty much moot at this point

I don't provide support for Magisk or its modules
[Google Pixel 5a] CarinaPDX:
As mentioned earlier, after flashing a factory image to get to 12 and installing Magisk all was well. But the OTA didn't complete the install for the January update, and even restoring images in Magisk didn't help. So now I need to update in another way. This recipe is clear but IIUC the data will be wiped (factory images have the -w switch in the shell script). Is it possible to do this but delete "-w" so as to not wipe my data? Or perhaps I should just flash the OTA? Thanks for the help.
[Google Pixel 5a] V0latyle:
You literally just quoted the instructions you need to follow.
[Google Pixel 5a] CarinaPDX:
My question was about preserving data. Your instructions would seem to wipe my data, IIUC. Is that correct? And if it is how to do it without wiping data? Of course I can flash the factory image at every update but the effort to replace my data would be huge. And right now, for reasons I do not understand, Titanium Backup never finishes: it gets stuck in the 60%-70% range. Without Ti working replacing the data is a massive PITA.
[Google Pixel 5a] V0latyle:
My instructions do not include wiping data. Please go back to the OP and read again. Flashing the factory update does not wipe data in of itself. Follow the instructions to update and root using the factory image.