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

[Guide] Flash Magisk on Android 12

Search This thread
No worries. I was able to upgrade without wipe based on your help and the information you provided. It worked as you described so thank you again!
Anytime, I do what I can!
I'm playing around with my Pixel 2. Just succesfully used OTA sideload to upgrade from A10 to A11. Can't test it with A12 but I don't think it should matter too much for the purposes I'm testing

No rescue mode on the P2 either so I can't test that with a wiped partition
 
Last edited:

prgopala

Senior Member
Jun 10, 2010
510
116
Sydney
Google Pixel 6 Pro
Update: I found my old P3 XL (w/ A10) and used it as a test mule with success, this is what I did:

1) Sideload OTA A12b5

2) Reboot into bootloader

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

4) fastboot flash boot --slot all magisk_patched.img

5) Start

It booted with zero issues, data intact, and is rooted! Now I need to work on getting past SafetyNet. I though I read that the A11 method still works?

@V0latyle many thanks for your help! Cheers!
So i followed this to the tee, still cannot get the phone to reboot after flashing the patched magisk image. It just comes back to recovery saying data is corrupt.

Here are the steps
- was on android 11, rooted. Patched boot.img from beta 5 A12 using magisk canary.
- side loaded A12 beta 5
(Did not reboot, is it required?)
- reboot into bootloader
- fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
- fastboot flash boot --slot all magisk_patched.img

To atleast get the phone working i flashed vbmeta without the flags and flashed the stock boot img. Then it boots fine.

Also i can boot directly to magisk img using
Fastboot boot magisk.img (allows root till next reboot)

What am i doing wrong?
 

snovvman

Senior Member
Jun 6, 2008
1,530
511
So i followed this to the tee, still cannot get the phone to reboot after flashing the patched magisk image. It just comes back to recovery saying data is corrupt.

Here are the steps
- was on android 11, rooted. Patched boot.img from beta 5 A12 using magisk canary.
- side loaded A12 beta 5
(Did not reboot, is it required?)
- reboot into bootloader
- fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
- fastboot flash boot --slot all magisk_patched.img

To atleast get the phone working i flashed vbmeta without the flags and flashed the stock boot img. Then it boots fine.

Also i can boot directly to magisk img using
Fastboot boot magisk.img (allows root till next reboot)

What am i doing wrong?

It looks like you followed my procedure correctly. I did not boot after sideloading. From recovery, I went directly into bootloader and fastbooted verity and patched boot. So far, I had zero issues doing it this way with my P3XL and P4XL. Both phones booted with root the first time. I see no difference with what you did.. My Magisk version is 23001.
 

prgopala

Senior Member
Jun 10, 2010
510
116
Sydney
Google Pixel 6 Pro
It looks like you followed my procedure correctly. I did not boot after sideloading. From recovery, I went directly into bootloader and fastbooted verity and patched boot. So far, I had zero issues doing it this way with my P3XL and P4XL. Both phones booted with root the first time. I see no difference with what you did.. My Magisk version is 23001.
Stupid question, what vbmeta.img did you flash? Android 11 or the android 12 beta?
 
You don't need to use the --slot all flag when flashing boot.

Please explain exactly what the problem is you're running into - it almost sounds like you're unable to boot when you have the patched image flashed to boot? Do you get an error message?

Have you tried reflashing vbmeta? That's where I would start first if I had the same problem.

Failing that, maybe dirty flash the factory image with the disable flags? Data wipe should not be necessary.
 
Last edited:

prgopala

Senior Member
Jun 10, 2010
510
116
Sydney
Google Pixel 6 Pro
You don't need to use the --slot all flag when flashing boot.

Please explain exactly what the problem is you're running into - it almost sounds like you're unable to boot when you have the patched image flashed to boot? Do you get an error message?

Have you tried reflashing vbmeta? That's where I would start first if I had the same problem.

Failing that, maybe dirty flash the factory image with the disable flags? Data wipe should not be necessary.
Thanks for replying.
- So when i am flashing magisk patched image i get failed/error boot img as expected
- Following this i flash fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
- when i boot it goes back to recovery saying data error

To recover from this i need to fastboot flash vbmeta vbmeta.img and then again flash stock boot.img.

The only way i can get root is to boot directly the magisk patched img from fastboot.
 

vandyman

Senior Member
Jul 30, 2012
552
219
S.Jersey
Google Pixel 5
Google Pixel 6
Thanks for replying.
- So when i am flashing magisk patched image i get failed/error boot img as expected
- Following this i flash fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
- when i boot it goes back to recovery saying data error

To recover from this i need to fastboot flash vbmeta vbmeta.img and then again flash stock boot.img.

The only way i can get root is to boot directly the magisk patched img from fastboot.
I am willing to bet that you did not uninstall Magisk before installing the ota. Or at least uninstall all Magisk modules.
 
Thanks for replying.
- So when i am flashing magisk patched image i get failed/error boot img as expected
- Following this i flash fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
- when i boot it goes back to recovery saying data error

To recover from this i need to fastboot flash vbmeta vbmeta.img and then again flash stock boot.img.

The only way i can get root is to boot directly the magisk patched img from fastboot.
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.
 
elong7681 said:
Can someone help me out I installed a magisk module that caused a bootloop and I tried the adb wait-for-device shell magisk --remove-modules and it doesn't work for me I'm on the P5 a12 beta 5 I have since flashed the stock boot.img. What can I do to remove this module?

Please ask in the Magisk Support/Discussion thread.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 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.
    4
    Assume this only works where you have wiped and clean installed android 12 for the first time.
    I had updated from Android 11 -> Android beta 12.5 -> Android 12 and had those 'data corrupt' warnings. I have not wiped my phone yet and was using temp root by booting the magisk boot image.

    I followed the above steps with the Nov security update and alas the 'data corrupt' warnings still pop up.
    So i think a wipe is required at some point.
    Yes - if boot verification was not disabled the last time Android System was running, a data wipe is required.
    3
    Universal SafetyNet Fix 2.2.0 is out on public release for those of you who want to use the new Zygisk.
    2
    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.
    I did the same, except I extracted the images from the factory zip.

    I successfully did both OTA sideload and dirty factory flash with no issues.

    Oddly, I'm still seeing a software update available...
    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.
  • 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