[Guide] Flash Magisk on Android 12

Search This thread

Krsmqn

Senior Member
Jan 23, 2012
1,210
334
OnePlus 7 Pro
Google Pixel 5
Two question:
- What model phone do you have?
- Are you on Android 11 or Android 12?
Pixel 5
A12

I solved the issue by patching boot.img with latest app, then flashing magisk_patched-boot.img in fastboot.
 

Attachments

  • Screenshot_20211120-081505.png
    Screenshot_20211120-081505.png
    126.2 KB · Views: 131

caretoexplain

Member
Feb 17, 2022
6
2
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.
What I did to fix the magisk error was quite simple really and should help any one reading this thread. This is for the folks who already have TWRP installed fyi.

1. Download the Magisk apk file from github
2. Use an apk to zip converter. I use ezyZip.
3. After downloading the converted file it should look like just a File. Rename the file to a zip and accept the warning.
4.Plug your phone in and go to Developer options -> Default USB configuration -> File transfer
5. Reboot into recovery mode and move the new Magisk file into your phone.
6. Flash the file.

If yall have any questions let me know.
 
  • Like
Reactions: myhuky3

93fuelslut

Senior Member
Jul 1, 2012
2,983
443
Nexus 6
Does anyone know how to flash the core patch so I can install Spotify which is a modded version? Supposedly a12 doesn't like different or changed signatures so it doesn't want those apps installed and the core patch deals with that.
But I'm not sure if you flash via magisk or you need riru or lsposed?

Pixel 6pro stock rom rooted
 

jons99

Senior Member
Nov 5, 2019
242
290

Top Liked Posts

  • There are no posts matching your filters.
  • 21
    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