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

[Guide] Flash Magisk on Android 12

Search This thread

jshbrmn

Member
Jun 18, 2021
5
7
There are other methods that will likely be developed and supported, but this one will remain an option for the finished version of 12.
 

tauio111

Senior Member
Feb 27, 2011
572
371
Google Pixel 5
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
Ach right, so you can pass the arguments to a fastboot update command and not just flashing vbmeta. Hoped so, but did not find a single hint on Google about it actually working. Haven't tried it yet though.
 

bleez99

Senior Member
May 1, 2011
260
183
Do you think this will be necessary once the finished version of Android 12 is out?
Probably. How hard is it to modify flash-all.sh?
I apply the monthly updates myself, I always modify the shell script.

Keep --disable-verity --disable-verification in the fastboot command line. You don't need the others I'm showing, it's just how I approach updates. I flash the current slot, no reboot, change the slot, flash again. That way I flip flop slots each month. Just my OCD showing. The --skip-secondary option is my preference when flashing both a and b slots. I'll reboot myself when finished.
I wouldn't recommend the --skip-secondary when only flashing the current slot.

fastboot --skip-reboot --skip-secondary --disable-verity --disable-verification update image-redfin-spb3.210618.013.zip
 

bleez99

Senior Member
May 1, 2011
260
183
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.
 

Attachments

  • Screenshot_20210717-192000.png
    Screenshot_20210717-192000.png
    80.1 KB · Views: 30
  • safetynet-fix-SPB3-v1.2.0.zip
    1.4 MB · Views: 37
Last edited:

bleez99

Senior Member
May 1, 2011
260
183
Ach right, so you can pass the arguments to a fastboot update command and not just flashing vbmeta. Hoped so, but did not find a single hint on Google about it actually working. Haven't tried it yet though.
I did - you'll be good to go. And I have safetynet.
Google Pay is set up, no rejected cards, but I haven't made a purchase yet. Confidence is high.
 

Jiggs82

Senior Member
Dec 22, 2010
5,836
2,744
The Bronx, NY

pndwal

Senior Member
Can this be installed over the official magisk app (canary) ?
Need to replace App to see Alpha channel (it's not John's).

I had no issues just installing app with Canary App installed; you can try. Others needed to uninstall it first (due to different signing keys?).

Nb. Data / modules / settings are not lost or affected simply by uninstalling App as they remain in /data/adb unless Uninstall (full) is run from App or recovery. 👍 PW
 
  • Like
Reactions: Jiggs82

yoyo linuxien

Member
Feb 7, 2008
26
9
Seems no-one here tried @vvb2060 Magisk Alpha yet. 😉

Nb. Target SDK (API) bumped to 31
https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-85350767

Latest changes commits (link above for others):
  • App adapted to Android 12
  • Android 12+ super user hides the screen overlay when the window pops up
🤠 PW
Tried it on a Pixel 4a 5G. I am on Android 12 beta 3, never disabled verity because I don't want to wipe it.

I still get the same error at boot : failed to load/verify ...
 

bgboii

Senior Member
Jan 7, 2013
641
60
www.youtube.com
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
could I do this with ota?
 

bleez99

Senior Member
May 1, 2011
260
183
Ah okay. Will this wipe my data? I'm trying to avoid wiping data
You may have to. Going with a flash from 11 to 12 may pose problems with stability if you don't wipe. There is an example command line a few posts up that show how to disable verity and the command line I displayed excludes the -w for wiping. You may get lucky and have a good running phone. You may run into issues. If you do you'll have to wipe. I fully recommend backing up your sdcard data before doing anything. Simply taking the ota or sideloading it will be fine until you apply magisk. Then you'll pull your hair out. If you do a full flash, modifying the last line in the flash.bat or sh as shown will give you success. Read up on fastboot and the command line options. As I stated in an earlier post I flash both a and b slots, then manually restart. That's what my example command line facilitates. Read up on switching the active slot as well. My command line isn't for everyone, it's how I flash. It's an example. If you do use my example, you must flash twice, once on the current slot, then on other.
 
  • Like
Reactions: bgboii

jshbrmn

Member
Jun 18, 2021
5
7
Full flash of the latest system image or the OTA only ?

I followed the process I posted on page 4 to move from 3 to 3.1 without issue....just to be clear:

- 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.

This is only confirmed working from version to version (and subversion). I'd imagine it would work even while skipping a version, but it is untested.
 

Eiad Ajam

Senior Member
Jul 24, 2012
393
111
Homs
100% working

Easy update and root and keep your data

You can always update to the latest build and keep your data

Like the first time installation with more 1 step


  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. make sure Wipe Device , Lock Bootloader , Force Flash all Partitions are unchecked .​

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


and finally Patch & flash boot.img
This is working perfectly with me
thank you
 
  • Like
Reactions: dvx2550

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi ! I'm on on Android 11 August update can flash the Ota Android 12 Beta 4 only update it with Adb sideload the Ota over Android 11 or do make a clean install. Do you know if Magisk work on Android 12 Beta 4 ?
    Yhanks
    Check out the Magisk thread, it is always wise to do a little research and reading before modding your device.
    1
    Not sure what I'm doing wrong here....

    Enrolled in the beta and installed via OTA (unlocked bootloader, Magisk rooted A11 Sept update)

    Beta installed fine, obviously lost root

    Tried to boot TWRP test 9, stuck on the TWRP screen (as expected)

    Installed Magisk Canary (f822ca5b, 23001), patched the beta 5 boot.img

    Now this is where I get stuck. If I attempt to flash the patched boot.img to /boot, I get a verification error:
    Code:
     failed to load/verify boot images
    I can, however, boot the patched boot.img as long as the stock boot.img is in /boot.

    Update:

    So I started fresh and used the flash tool, and disabled verity/verification. After doing so, I was able to flash and successfully boot the patched boot.img.

    I did wipe the device; I am not sure if this can be skipped, but at least I got it to work and am now on rooted Beta 5.
    1
    When I update via online flashtool and check/unchecked options the right options. Do it work without losing daten and reflashend the parched boot.img from the official release?
    Leave "wipe data" unchecked, but check both "disable verity" and "disable verification". I did wipe data on mine but I believe that has nothing to do with being able to boot a patched image.
    1
    Thanks for your Guide, but can you please add how to update? For example from beta 3/4 to beta 5 or from beta 5 to finally Android 12 (when available).


    How I would update to beta 5 from beta 3/4 or beta 5 to Android 12 stable.

    !!Just MY THEORY and NOT TESTED!!


    - download the factory image and unzip it.
    - extract the boot.img from the image.zip and put it on the storage of your P5.
    - now patch the boot.img with Magisk and move it to your ADB folder on your computer
    - to update Bootloader & Radio from the factory.zip just extract and run these commands;

    - use the ADB and flash the Stable A12 Image with following command:

    - after the successful flash you reboot into fastboot Mode and flash the patch boot.img with following command:

    - Reboot and enjoy (fastboot reboot)

    Really interested if it work or not 🙈
    You already asked this question; it's unnecessary to ask more than once.

    I doubt we will have to disable verity or verification. The 12 stable release should install just like any other OTA.

    The easiest way to do this will be using the Android Flash Tool; uncheck all the boxes as they shouldn't be necessary.

    Alternatively, one could download the factory zip and flash bootloader, radio, and the update manually.

    It is possible that dm-verity and vbmeta verification will need to be disabled to use a patched boot.img, but let's just see what happens when the update drops Oct 4th. This wasn't necessary on Android 11.
  • 13
    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.
    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
    Hey just wondering how you achieved root with beta 2? I've tried a few things and haven't seem to be able to get it working (bootloop).

    Is there a definitive process out there?
    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
    4
    The problem is you just need to disable verity and verificaion once (only possible with a full wipe).

    I'm using the Android Flash Tool for Beta 2.1:
    https://flash.android.com/preview/beta2.1

    I'm using the Android Flash Tool for Beta 3:
    https://flash.android.com/preview/beta3

    Also download the latest factory image (and extract boot.img):
    https://developer.android.com/about/versions/12/download

    Within the flash tool uncheck every option (just to be sure).
    Only check "Disable Verity" and "Disable Verificaion" and click on flash.
    Boot into OS and reboot again.
    Patch original boot.img with Magisk.
    Reboot to fastboot and flash boot patched_magisk.img.
    Done.

    You can do this with every update. Always be sure that "Disable Verity" and "Disable Verificaion" are checked when upgrading (and nothing else like Lock Bootloader and so on).

    You may need to wipe once. But after the first initial wipe, you don't need to wipe when you upgrade. You just need to be sure "Disable Verity" and "Disable Verificaion" are checked when upgrading.

    I'm doing it this way since the first beta an everything is working and I didn't need to wipe again till this day.