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

[Guide] Flash Magisk on Android 12

Search This thread

zhuanyi

Senior Member
Jan 19, 2008
179
52
Think I know the answer for this one but just want to make sure:

once i used OTA update and rebooted there is no way I can root/get Magisk working without a data wipe correct? I tried to flash vbmeta with the flags suggested but that only brings a corrupted data warning and asked me to factory reset.

Is there anything that I can use to backup the phone that doesn't require root? I use Titanium so far but that requires root.
 

vandyman

Senior Member
Jul 30, 2012
550
220
S.Jersey
Google Pixel 5
Google Pixel 6
Think I know the answer for this one but just want to make sure:

once i used OTA update and rebooted there is no way I can root/get Magisk working without a data wipe correct? I tried to flash vbmeta with the flags suggested but that only brings a corrupted data warning and asked me to factory reset.

Is there anything that I can use to backup the phone that doesn't require root? I use Titanium so far but that requires root.
Appdash, edit : root is needed.
 

zhuanyi

Senior Member
Jan 19, 2008
179
52
That's odd.

Try flashing vbmeta with the disable flags, but leave the boot image stock. Then, boot the patched image, and in Magisk, select "direct install", then reboot.
Tried this method, after flashing with the vbmeta with flags (but not the boot image) and tried to boot with the patched boot (by using fastboot boot patched.img) the system won't boot up and ended up with corrupted data message again...
 

prgopala

Senior Member
Jun 10, 2010
511
116
Sydney
Google Pixel 6 Pro
That's odd.

Try flashing vbmeta with the disable flags, but leave the boot image stock. Then, boot the patched image, and in Magisk, select "direct install", then reboot.
I will try this and report. Appreciate your time on this mate.
Tried this method, after flashing with the vbmeta with flags (but not the boot image) and tried to boot with the patched boot (by using fastboot boot patched.img) the system won't boot up and ended up with corrupted data message again...
Same, after flashing vbmeta with flags (leaving the boot img still stock), i tried to boot with the magisk img, but it still comes back to recovery with 'corrupted data' msg.
So the only way root works for me is temporary by
- having stock boot img + stock vbmeta (no flags) and then booting directly the magisk img

Tried something else as well..
- with temp root i opened magisk and directly patched the stock img and then restarted the phone.
- as expected stuck at bootloader with failed boot img.
- flashed vbmeta with disable flag, reboot took it back to recovery with corrupt data msg.

So at this point i have come to believe that going from A11 to A12 beta requires a wipe if you want a permanent root (i understand that @snovvman did successfully update without wipe and has root but the same procedure did not work for me :( )

Though i am fine with having temp root, i rarely restart my phone and the only modules i have atm is the 'navbargone'. I can still backup my data if required.
Hoping to upgrade to Pixel 6, and since that is quite near now happy to live with temporary root for the while :).

Thanks for all the assistance guys. Everyone is awesome in the group and very helpful.
 

prgopala

Senior Member
Jun 10, 2010
511
116
Sydney
Google Pixel 6 Pro
Think I know the answer for this one but just want to make sure:

once i used OTA update and rebooted there is no way I can root/get Magisk working without a data wipe correct? I tried to flash vbmeta with the flags suggested but that only brings a corrupted data warning and asked me to factory reset.

Is there anything that I can use to backup the phone that doesn't require root? I use Titanium so far but that requires root.
You can have temporary root by ...
- having stock boot img + stock vbmeta (no flags) and then booting directly the magisk img.
That will allow you to use titanium back up as rooted.
 
  • Like
Reactions: zhuanyi
I will try this and report. Appreciate your time on this mate.

Same, after flashing vbmeta with flags (leaving the boot img still stock), i tried to boot with the magisk img, but it still comes back to recovery with 'corrupted data' msg.
So the only way root works for me is temporary by
- having stock boot img + stock vbmeta (no flags) and then booting directly the magisk img

Tried something else as well..
- with temp root i opened magisk and directly patched the stock img and then restarted the phone.
- as expected stuck at bootloader with failed boot img.
- flashed vbmeta with disable flag, reboot took it back to recovery with corrupt data msg.

So at this point i have come to believe that going from A11 to A12 beta requires a wipe if you want a permanent root (i understand that @snovvman did successfully update without wipe and has root but the same procedure did not work for me :( )

Though i am fine with having temp root, i rarely restart my phone and the only modules i have atm is the 'navbargone'. I can still backup my data if required.
Hoping to upgrade to Pixel 6, and since that is quite near now happy to live with temporary root for the while :).

Thanks for all the assistance guys. Everyone is awesome in the group and very helpful.
I would try reflashing the factory image with the disable flags set, but don't wipe data. See my guide on how to do this.

Also, how did you first do the upgrade to A12?
 

prgopala

Senior Member
Jun 10, 2010
511
116
Sydney
Google Pixel 6 Pro
I would try reflashing the factory image with the disable flags set, but don't wipe data. See my guide on how to do this.

Also, how did you first do the upgrade to A12?
Yeah i tried flashing the factory images with flags disable, it would not boot and go back to recovery with the 'data corrupt' error.
Flashing without flags works of course.

I did the first upgrade by sideloading the ota, beta 5.
 
Yeah i tried flashing the factory images with flags disable, it would not boot and go back to recovery with the 'data corrupt' error.
Flashing without flags works of course.

I did the first upgrade by sideloading the ota, beta 5.
I hate to say this but I think your best option is a complete factory reflash. Use the Android Flash Tool, force flash all partitions, do not skip secondary, wipe data and check both disable flags. It sounds to me like you need to start fresh. It's hard to say what is corrupted and why, and if a dirty factory flash didn't fix it, it's time to reflash everything and start with a clean slate.
 

snovvman

Senior Member
Jun 6, 2008
1,530
511
I just threw the idea out there.
I know when I was on A11. I had to remove Magisk before I flashed the monthly updates. If I didn't, I could not boot a patched boot Magisk image.

Interesting that you had to do that. For me, and I've read the same from others, we never needed to remove Magisk. For as long as I can recall A9, 10, 11, etc., I simply flashed the image each month without -w, then immediately reboot into boolaoder, flashed patched boot. This way, the first boot after the update immediately has permanent root. I did this to prevent Playstore becoming uncertified. Not once had I to remove Magisk. It was a very reliable procedure.
 

vandyman

Senior Member
Jul 30, 2012
550
220
S.Jersey
Google Pixel 5
Google Pixel 6
Interesting that you had to do that. For me, and I've read the same from others, we never needed to remove Magisk. For as long as I can recall A9, 10, 11, etc., I simply flashed the image each month without -w, then immediately reboot into boolaoder, flashed patched boot. This way, the first boot after the update immediately has permanent root. I did this to prevent Playstore becoming uncertified. Not once had I to remove Magisk. It was a very reliable procedure.
That is how I always done it.
But with A12, I used the flash tool without wiping data. I will be using the flash tool from here on out.
I always uninstalled Magisk before.
 

snovvman

Senior Member
Jun 6, 2008
1,530
511
I just threw the idea out there.
I know when I was on A11. I had to remove Magisk before I flashed the monthly updates. If I didn't, I could not boot a patched boot Magisk image.

Interesting that you had to do that. For me, and I've read the same from others, we never needed to remove Magisk. For as long as I can recall A9, 10, 11, etc., I simply flashed the image each month without -w, then immediately reboot into boolaoder, flashed patched boot. This way, the first boot after the update immediately has permanent root. I did this to prevent Playstore becoming uncertified. Not once had I to remove Magisk. It was a very reliable procedure.
That is how I always done it.
But with A12, I used the flash tool without wiping data. I will be using the flash tool from here on out.
I always uninstalled Magisk before.

You previously wrote that unless you removed Magisk before flashing, the device would not boot. What were the errors you were experiencing? And once you removed Magisk, everything was fine? If the device did not boot, how did you recover from that? I'm looking for a nexus to the failed A12b updates.

It's curious to me that I was able to sideload A12b, flash verity, flash patched boot on two devices without any issues, while two others report seemingly the same procedures but get corrupted data.
 

vandyman

Senior Member
Jul 30, 2012
550
220
S.Jersey
Google Pixel 5
Google Pixel 6
You previously wrote that unless you removed Magisk before flashing, the device would not boot. What were the errors you were experiencing? And once you removed Magisk, everything was fine? If the device did not boot, how did you recover from that? I'm looking for a nexus to the failed A12b updates.

It's curious to me that I was able to sideload A12b, flash verity, flash patched boot on two devices without any issues, while two others report seemingly the same procedures but get corrupted data.
To recover from a boot loop.
I would try the safe boot method with temporary root. Or flash-all with the w as a last resort.
Edit; I was using EX kernel on A11, do not know if that was a factor or not.
 

prgopala

Senior Member
Jun 10, 2010
511
116
Sydney
Google Pixel 6 Pro
Interesting that you had to do that. For me, and I've read the same from others, we never needed to remove Magisk. For as long as I can recall A9, 10, 11, etc., I simply flashed the image each month without -w, then immediately reboot into boolaoder, flashed patched boot. This way, the first boot after the update immediately has permanent root. I did this to prevent Playstore becoming uncertified. Not once had I to remove Magisk. It was a very reliable procedure.
That depends on the magisk module that you are running.
For e.g.
I use centre clock + navbargone modules which would work fine (without disabling it in magisk) when flashing monthly security updates but would break for quarterly feature releases (may be due to system files getting changed in a quarterly update).
Hence i would just disable all modules before monthly update.
But i never needed to uninstall magisk itself.
 

vandyman

Senior Member
Jul 30, 2012
550
220
S.Jersey
Google Pixel 5
Google Pixel 6
That depends on the magisk module that you are running.
For e.g.
I use centre clock + navbargone modules which would work fine (without disabling it in magisk) when flashing monthly security updates but would break for quarterly feature releases (may be due to system files getting changed in a quarterly update).
Hence i would just disable all modules before monthly update.
But i never needed to uninstall magisk itself.
I use the CC and no battery icon module. Like you are saying there is something about modifying the systemui. For me it is easier to just hit the uninstall on the Magisk main screen. I keep a copy of Magisk.apk for a clean install, since it has to be patched anyways.
 

zhuanyi

Senior Member
Jan 19, 2008
179
52
question, now that Android 12 is out of beta, would i be able to flash a modified kernel without messing with vmeta (or the required data wipe)?

Tried it today, no luck, same errors as beta.

Ordered a pre-order Pixel6 today and when the device arrives I'll root and use migration tool to copy my P5 settings to P6, perhaps easier to do this than clean wipe P5 and start from scratch...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Universal SafetyNet Fix 2.2.0 is out on public release for those of you who want to use the new Zygisk.
    2
    thanks for the response.

    The phone is 100% stock, running 12.0 (current firmware), only thing I’ve done so far is unlock the boot loader and create the patched boot file.

    I’ll reflash the current firmware using the web-ui and force flash all partitions, and report back.
    Make sure you check "Disable Verity" and "Disable Verification" too.
    2
    Good evening.
    Yes I would do it like that next time.

    It's just that I wanted to explain the situation well and especially to know if it was necessary to flash the "vbmeta.img & verity & verification" to return to the original Boot.img and same for Re-Root and flash the "modified Boot.img".
    But you answered my question and thank you. it's not necessary ! only for an update.
    Have a good day thanks again
    Restoring the boot image does not require that you do anything with vbmeta. In fact I would recommend that you don't.
    1
    Really noob question sorry - first pixel device, I'm used to using Odin on Samsungs.

    I have bootloader unlocked

    PS C:\adb> fastboot flash boot magisk_patched.img
    target reported max download size of 268435456 bytes
    sending 'boot' (98304 KB)...
    OKAY [ 2.419s]
    writing 'boot'...
    FAILED (remote: Failed to write to partition Not Found)
    finished. total time: 2.565s


    Anyone know the reason this would be happening?
    Did you previously have a custom ROM on the device? It sounds like you should use Android Flash Tool and force flash all partitions.
    1
    Hi ! Please help me 🤪 I have mistake after flash module and loose Root Magisk. I'm on November update wipe data and root but loose it after install a module !? Don't know which module.
    I have flash again Magisk boot modified after flash vmbeta (verity & verification) but boot loop ?
    I have flash stock boot img after flash vmbeta (verity & verification) and restart.
    But I can't root it ? I don't understand ? Do dirty flash Rom for root it ?

    Resolve 😄 I can flash Magisk again but without "--slot=all" and all module are uncheck I remove it and install one by one but I think this is the last LSPosed Riru Zygist or Magisk Hide. Don't install MagiskHide I have USN 2.2 and Install stable LSPOSED not the last. 😊

    Hi think is MagiskHide make bootloop with last USN & LSPOSED Zygist and not necessary for pass safetynet
    If you have questions about a Magisk module, please post in the Magisk General Support Discussion thread or contact the developer of the module.
  • 19
    Trying to root the Pixel 5 running Android 12 by flashing a magisk-patched boot image results in the phone only booting to fastboot mode ("failed to load/verify boot images")
    Some users have reported that booting (instead of flashing) the patched boot image works and makes root temporarily available but i didn't have any success with that.
    The phone booted up but root didn't work.

    I won't explain how to unlock the bootloader or set up adb here.

    !Warning! This will wipe your phone so take a backup!

    Also i do not take any responsibility if you break your device.
    And if anything goes wrong just factory reset your device using the Android Flash Tool or by following this tutorial.

    Here's what i did to get Magisk v22.0 working on the first developer preview of Android 12:


    Install A12 with disabled AVB & dm-verity:
    1. Make sure USB-Debugging is enabled in developer-options and you have authorized the pc you're using on your phone.

    2. Boot your phone into fastboot mode.
      You can do this by turning it off and then starting it by holding Power + Volume Down
      until fastboot mode appears or just adb reboot bootloader

    3. Go here and click on the link for the Android Flash Tool.
      (I didn't copy the link directly so i don't have to update it everytime google releases a new update)

    4. It should ask you to allow the website to access ADB Keys. Click Ok.
      If the website somehow doesn't work, try using Google Chrome.

    5. Select your Pixel 5. If it's not showing up click add device.

    6. Click on the edit symbol (pen) in the box where the selected build is shown.

    7. Make sure Wipe Device, Disable Verity and Disable Verification are checked.

    8. Install and boot the phone when it's finished.

    Patch & flash boot.img
    1. Download and install the Magisk Canary App from GitHub.

    2. Download the factory image from here and extract boot.img from it.
      (Inside the downloaded zip-file is another zip file containing the boot image)

    3. Copy the extracted boot.img to your phone and open the magisk app.

    4. Click on Install -> Select and Patch a File and let it do its magic.

    5. Copy the magisk-patched boot image that should be found in your phones download folder back to your PC.

    6. Reboot into fastboot mode as i explained earlier and flash the patched boot image.
      (fastboot flash boot magisk_patched.img)
      Then reboot the device.

    Now root should be working. If it bootloops and says your phone has to be factory reset, do it.
    If for some reason you still get an AVB-Error and end up stuck in fastboot mode just flash the stock image and try to patch it again.

    This is my first post on here and i didn't have much time but i'm glad if it helped at least one person.
    6
    @Anonshe posted ths method in the Pixel 6 Pro thread. Does this work for the Pixel 4a 5(G), Pixel 5 or the Pixel 5a?
    Just updated my Pixel 5 to the November Sec Patch without any data loss. Since I'd disabled vbmeta before, steps were simple:
    - Used Payload Dumper to extract the boot and vbmeta images. Patched the former.
    - Rebooted to Recovery
    - Sideloaded the OTA package
    - Reboot to bootloader from the recovery menu
    Code:
    fastboot --disable-verification --disable-verity flash vbmeta vbmeta.img
    Code:
    fastboot boot magisk_patched.img

    After it booted up, opened Magisk Manager, installed via Direct Install. All works fine.
    5
    For those of you who don't have safetynet working, here.
    All credit goes to @kdrag0n, I just modified the shell scripts for B3

    Pull request done if you don't want my zip.
    4
    Has anyone sucefully rooted beta 3?
    Patched boot image with magisk canary if I only boot the image it starts
    Then tried to flash patched boot image and get stuck in bootloader
    For all the updates from beta 2 - 3 I've followed this process without fail:

    - extract boot.img and vbmeta.img from downloaded beta of your relevant device
    - add boot.img to phone (if downloaded, and extracted on another device)
    - patch boot.img in magisk (i like to rename it to patched_magisk.img)
    - move patched_magisk.img to desktop
    - download and install latest beta from the OTA provided
    - tap the reboot button on the OTA install screen once completed
    - once the reboot begins and your screen turns black hit the power and volume down button to get into fastboot
    - run
    fastboot --disable-verity --disable-verification flash vbmeta path/to/vbmeta.img (you can drag img from location)
    - then run
    fastboot flash boot path/to/patched_magisk.img (you can drag img from location)

    This has worked flawlessly, maintaining root while also keeping all my data.
    4
    Yeah I wouldn't do this unless you've started from the initial process op outlined. I did this moving from beta 2 to 2.1 and then beta 2.1 to beta 3. However beta 2 was my first android 12 install, which I used ops procedure to achieve.

    Do this:
    You don't need the Android flash tool. I have been manually flashing full images for a long time:
    I don't like things done behing my back.

    For beta 3:
    I flash both sides hence the skip secondary - it saves a few seconds.
    When flashing - watch what's scrolling by. The vbmeta.img is modified on the fly.
    No need to copy from another build or someone else's hack.
    Below is what I use. Successfully.

    Modify the last line in the flash-all.bat or.sh
    fastboot --skip-reboot --skip-secondary --disable-verity --disable-verification update image-redfin-spb3.210618.013.zip