Development [DEV][EOL] Vbmeta Patcher, Devinfo Patcher, and Boot Image Tool

Search This thread

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
So say I have magisk 24102 on the December update and I want the easiest way to update with root (and not lose my data). How would I do it? Can I system update?
I use the OTA instructions in the OP:

  1. Uninstall -> Restore Images in the Magisk app.
  2. Take the OTA in System Update. Do NOT reboot.
  3. Install -> Install to Inactive Slot in the Magisk app.
  4. Reboot (NOT in System Update).

Or if you prefer something a bit more visual:

1. In the Magisk app, click Uninstall Magisk.

5539899


2. Click Restore Images.

5539901


This should result in a toast message that says Restoration Done.

3. In System Update, click Check for Update.

5539903


4. Click Resume.

5539905


The installer will perform two steps:

Downloading and installing update
Optimizing your device, this may take a while

5. Do NOT click restart from within the System Update app.

5539907


6. In the Magisk app, click Install Magisk.

5539909


7. Click Install to Inactive Slot (After OTA).

5539911


8. Click Ok.

5539913


9. Click Let's Go.

5539915


10. Click Reboot.

5539917
 
Last edited:
  • Like
Reactions: mkhcb

mkhcb

Senior Member
Nov 2, 2012
332
344
I use the OTA instructions in the OP:

  1. Uninstall -> Restore Images in the Magisk app.
  2. Take the OTA in System Update. Do NOT reboot.
  3. Install -> Install to Inactive Slot in the Magisk app.
  4. Reboot (NOT in System Update).

Or if you prefer something a bit more visual:

1. In the Magisk app, click Uninstall Magisk.

5539899


2. Click Restore Images.

5539901


This should result in a toast message that says Restoration Done.

3. In System Update, click Check for Update.

5539903


4. Click Resume.

5539905


The installer will perform two steps:

Downloading and installing update
Optimizing your device, this may take a while

5. Do NOT click restart from within the System Update app.

5539907


6. In the Magisk app, click Install Magisk.

5539909


7. Click Install to Inactive Slot (After OTA).

5539911


8. Click Ok.

5539913


9. Click Let's Go.

5539915


10. Click Reboot.

5539917
Thanks for the visual instructions. My OTA keeps failing to install the update, so I guess I am stuck with flashing the update with my computer this weekend. This however is much simpler and something I'll use for the March update! Thanks!
 

airtower

Senior Member
Sep 9, 2010
1,101
360
Arlington, TX
Google Pixel 6
So say I have magisk 24102 on the December update and I want the easiest way to update with root (and not lose my data). How would I do it? Can I system update?
System update by itself won't even work if rooted. Some have been able to restore images, take the OTA, then flash Magisk to the inactive slot, but this doesn't work for many (including me) and could put your device in a unbootable state.

Since you don't seem to be in a rush, just dirty flash the full factory image. There are several threads here outlining this process, which keeps root and data intact.
 

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
System update by itself won't even work if rooted. Some have been able to restore images, take the OTA, then flash Magisk to the inactive slot, but this doesn't work for many (including me) and could put your device in a unbootable state.
Those that have this issue seem to be in the relative minority. Are you still planning to record logs of the process for the March update? It is expected to be released on March 7. I'm planning to record the logs on my devices, as well. Hopefully between the good and bad logs, we'll be able to find the cause of the issue.

It might also be interesting to see the output of bootctl get-current-slot and bootctl get-active-boot-slot before taking the update and before and after flashing to the inactive slot. You can download bootctl from the Magisk repo here.
 

airtower

Senior Member
Sep 9, 2010
1,101
360
Arlington, TX
Google Pixel 6
Those that have this issue seem to be in the relative minority. Are you still planning to record logs of the process for the March update? It is expected to be released on March 7. I'm planning to record the logs on my devices, as well. Hopefully between the good and bad logs, we'll be able to find the cause of the issue.

It might also be interesting to see the output of bootctl get-current-slot and bootctl get-active-boot-slot before taking the update and before and after flashing to the inactive slot. You can download bootctl from the Magisk repo here.
I'll be on it!
 
  • Like
Reactions: capntrips

mkhcb

Senior Member
Nov 2, 2012
332
344
System update by itself won't even work if rooted. Some have been able to restore images, take the OTA, then flash Magisk to the inactive slot, but this doesn't work for many (including me) and could put your device in a unbootable state.

Since you don't seem to be in a rush, just dirty flash the full factory image. There are several threads here outlining this process, which keeps root and data intact.
I however would love the ability to unroot, then use system update, and then re-root. That be phenomenal!
 

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
I took the March OTA on a Pixel 5a and logged everything. One quirk was the grepped output piped into tee was always a few lines behind the logcat in an adb shell. It didn't flush the last of the lines until the device restarted or was unplugged. If I interrupted the process first, it did not flush.

Hopefully the Pixel 6 update drops in the next few days.
 
  • Like
Reactions: acuicultor

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
@airtower (and anyone else that wants to log the OTA process), it looks like the March update for Pixel 6 is scheduled for the 21st.

In addition to the various logs and the output from the bootctl commands, it might be handy to grab the modified boot image that Magisk generates. After seeing some people have similar issues when freshly rooting or installing a custom kernel, I wonder if there's something off with the vbmeta image embedded in boot.

It might even make sense to grab both the one installed directly to the inactive slot and one from Patch a File, just in case there is a difference (if booting fails initially, you might try to fastboot flash the latter before completely reinstalling, to test that theory).

The simplest method to acquire the new stock boot image after the OTA would likely be using Boot Image Tool in the OP. Clicking Download in the section for the inactive slot will put a copy of that image in the Download folder. If you do it again after installing Magisk to the inactive slot, it will do the same for the patched image.

Alternatively, you can run something like this for the appropriate slot:

cat /dev/block/platform/14700000.ufs/by-name/boot_a > boot_a.img

You could also pull the stock one from the backup that Magisk creates in /data, after installing to the inactive slot, though you'll still need to use one of the other methods to acquire the patched image written to the inactive slot.

For quick reference, here are the steps:
  1. Run getprop ro.boot.slot_suffix to get the current slot and note the output.
  2. Run bootctl get-current-slot and bootctl get-active-boot-slot and note the output. Both should match the current slot (zero indexed).
  3. Run adb logcat | grep update_engine | tee update.log. See the notes about output flushing in my previous post.
  4. Check for and install the OTA in System Update. Do NOT reboot.
  5. Run bootctl get-current-slot and bootctl get-active-boot-slot and note the output. I initially expected no change from step 2, but the active boot slot had changed at this point on a Pixel 5a.
  6. Download the stock boot image from the inactive slot with Boot Image Tool.
  7. Install Magisk to the inactive slot.
  8. Save the Magisk log.
  9. Run bootctl get-current-slot and bootctl get-active-boot-slot and note the output. This will likely be the same as step 5.
  10. Download the patched boot image from the inactive slot with the cat command noted above.
  11. In the Magisk app, patch the stock boot image downloaded in step 6. It might make sense to compare the two patched images using sha1sum, at this point.
  12. Save the Magisk log.
  13. Reboot (NOT in System Update).
  14. Run adb logcat | grep update_engine | tee reboot.log. The wait for device flag for adb might be appropriate here, but I didn't have to use it when I did the trial run on a Pixel 5a, granted on a successful boot.
  15. If possible, run bootctl get-current-slot and bootctl get-active-boot-slot and note the output. The current slot should have changed and the active slot should match.
Then post the log files (logcat and Magisk), any unexpected output from the commands, and all three boot images (stock, inactive patched, and file patched). I'll perform all of the same steps and post all of the same files. Hopefully some difference that can be used to isolate the issue will be apparent.

I'm planning to use the latest canary (24303, at the time of this post). If you would prefer to use the latest stable, just let me know, and I'll switch channels.

Edit: I made a test build of Magisk based on 24303 with AVBv2 signing enabled. It is basically a simplified version of this PR updated to build against 24303. I'm sure there are posts from that time period in this thread, if anyone wants additional details. After the above steps have been completed, I'll add a signed boot image, as well, in case steps 7 and 11 don't work for anyone, and they want to test one more thing.
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
grep needs its argument in quotes though right? grep "update_engine"?
Since the argument contains no whitespace, quotes are optional.

Edit: You'll need to chmod +x the bootctl binary and call it with an absolute (/data/local/tmp/bootctl) or relative (./bootctl) path, since it is unlikely to be on your PATH. You can get the binary here. If you have trouble with bootctl, you should be able to use Devinfo Patcher from the OP to get the active slot.
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
The OTA did not go smoothly for me. I ended up at the red eio screen, which changed to the usual orange unlocked screen then to the charging screen. After holding the power button for 30 seconds, it rebooted back into the previous slot on the Feb update. Fortunately, I took the extra step of doing a direct install after installing the OTA, so I was still rooted.

I rebooted into the bootloader, changed the slot back to the March update and tried a variety of fastboot flash and fastboot boot commands with no success.

I let my slot switch again, and booted back into the Feb update. I opened System Update and was immediately given the post install screen with the reboot button. Upon clicking reboot, it gave me a the Downloading and installing screen, which completed in just under a minute and rebooted without an additional prompt [1]. I restored the stock image in Magisk during that time, but I have no idea if that mattered.

This time it booted into the (stock) March update successfully. I watched update_engine in logcat, and when it completed merging [2], I rebooted into the bootloader and fastboot booted the patched image. This time it booted without issue, so I direct installed in Magisk and rebooted, again successfully.

I suspect the merges [2] were related the abbreviated update process [1]. I'm going to try to switch my slot back to the Feb update to see if it will let me do the entire operation a second time. If not, I may try installing the Feb update with the flash tool, to see if that works.

During the scramble, I lost track of which logs go with which operation, but I'll try to organize and post them when I've tried a few more things.
 
Last edited:

airtower

Senior Member
Sep 9, 2010
1,101
360
Arlington, TX
Google Pixel 6
The OTA did not go smoothly for me. I ended up at the red eio screen, which changed to the usual orange unlocked screen then to the charging screen. After holding the power button for 30 seconds, it rebooted back into the previous slot on the Feb update. Fortunately, I took the extra step of doing a direct install after installing the OTA, so I was still rooted.

I rebooted into the bootloader, changed the slot back to the March update and tried a variety of fastboot flash and fastboot boot with no success.

I let switch my slot again, and booted back into the Feb update. I opened System Update and was immediately given the post install screen with the reboot button. Upon clicking reboot, it gave me a the Downloading and installing screen, which completed in just under a minute and rebooted without an additional prompt [1]. I restored the stock image in Magisk during that time, but I have no idea if that mattered.

This time it booted into the (stock) March update successfully. I watched the update_engine in logcat, and when it completed merging [2], I rebooted into the bootloader and fastboot booted the patched image. This time it booted without issue, so I direct installed in Magisk and rebooted, again successfully.

I suspect the merges [2] were related the abbreviated update process [1]. I'm going to try to switch my slot back to the Feb update to see if it will let me do the entire operation a second time. If not, I may try installing the Feb update with the flash tool, to see if that works.

During the scramble, I lost track of which logs go with which operation, but I'll try to organize and post them when I've tried a few more things.

I was unsuccessful as well, but had a different experience. I PM'd you the info and logs as requested.
 
  • Like
Reactions: capntrips

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
I was unable to go back to the Feb update, as it would require a data wipe due to a bootloader update.

Here are the update and restart logs from my first attempt, where the update initially seemed to complete as usual but failed to boot and rolled back to the previous slot. It caught me offguard when it booted into the previous slot, so I didn't catch the first few seconds of the reboot log:

update.log
reboot.log

Here are the update and restart logs from my second attempt, there the update took less than a minute and rebooted without an additional prompt. The system booted into a stock March update:

update.log
reboot.log

Some quick notes:

All above used Magisk 24304. In step 5, the active boot slot was still unchanged, so this was different from a Pixel 5a. The patched images from steps 10 and 11 were identical, and is the exact image I'm now using on a functional March update. I did not get a chance to test the signed version before the phone booted into the previous slot. I did attempt to use it after changing the slot back, but the update was marked as failed by that point.

In the next day or two, I'll try to compare the logs against the test run on a Pixel 5a from earlier in the month.
 

shoey63

Recognized Contributor
Successful March OTA update for me. Zero issues.
Pixel 6 with latest Magisk Alpha 24301 (saves the need to "hide" the app with a random package id/name)
- First I disabled zygisk and modules and rebooted.
- Restored stock boot with uninstall/restore images function.
- Took OTA update
- Installed to inactive slot (also direct install in case of failed update)
- Rebooted while in Magisk.

It fired straight up with March update installed.

The method is sound but it looks like the latest Canary is somewhat borked.
Many issues on various threads.
 

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
The method is sound but it looks like the latest Canary is somewhat borked.
Glad to hear it worked on a Pixel 6. It sounds like my issue was likely with Magisk 24304. I might have to transfer all of my data to my Pixel 5a, so I can wipe and run some tests (or better yet, just wipe the Pixel 5a and see if the March update fails with 24304 on there, as well).
 
  • Like
Reactions: shoey63

airtower

Senior Member
Sep 9, 2010
1,101
360
Arlington, TX
Google Pixel 6
Successful March OTA update for me. Zero issues.
Pixel 6 with latest Magisk Alpha 24301 (saves the need to "hide" the app with a random package id/name)
- First I disabled zygisk and modules and rebooted.
- Restored stock boot with uninstall/restore images function.
- Took OTA update
- Installed to inactive slot (also direct install in case of failed update)
- Rebooted while in Magisk.

It fired straight up with March update installed.

The method is sound but it looks like the latest Canary is somewhat borked.
Many issues on various threads.
My OTA failed (bootlooped while running post update cleanups), but 24.3 is now running fine after a March full image flash with USNF, Systemless, and Zygisk enabled.

I didn't disable anything in magisk, but I wonder if direct installing post-OTA is a factor in your success.
 

capntrips

Senior Member
Aug 29, 2020
221
432
OnePlus 6T
Google Pixel 6
I installed the April update with 24305 and got the dm-verity corruption screen. I let it bootloop once and it rolled back to the March slot. I moved to my Pixel 5a over the weekend, so I'll do a full wipe with flash tool and start over with 24.3 stable and see if that works.

I did compare the 5a March update logs to both my and @airtower's Pixel 6 logs, but I didn't see anything obvious. I would be interested in seeing the full logcat output (no grep) on a failed reboot without corruption.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    The original purpose of these three apps was to help deal with the changes in Android 12 when taking an OTA. Most of the functionality has been superseded by the newest builds of Magisk.

    Vbmeta Patcher is still useful when migrating from Magisk builds before 23016, and Boot Image Tool can still be used for downloading backups of newly installed boot images or restoring missing backups for Magisk.

    I'll leave the links and descriptions below, but future development of these apps is unlikely.

    Vbmeta Patcher screenshot
    Devinfo Patcher screenshot
    Boot Image Tool screenshot


    Vbmeta Patcher is an Android app that toggles the disable flags of the vbmeta partitions.

    Devinfo Patcher is an Android app that marks the inactive slot as successful on devices with a valid devinfo partition.

    Boot Image Tool is an Android app that helps juggle boot images for OTAs.
    1. Uninstall -> Restore Images in the Magisk app.
    2. Take the OTA in System Update. Do NOT reboot.
    3. Install -> Install to Inactive Slot in the Magisk app.
    4. Reboot (NOT in System Update).

    Latest Updates

    2022-05-01 Boot Image Tool v1.0.0-alpha03
    2021-11-19 Devinfo Patcher v1.0.0-alpha02
    2021-11-19 Vbmeta Patcher v1.0.0-alpha04
    10
    I made a new build of Magisk that will detect the vbmeta partition, set KEEPVBMETAFLAGS, and AVBv2 sign the boot image after patching. This allows you to root without patching vbmeta or wiping data.

    It also has the updated bootctl binary, so you can flash to the inactive slot after an OTA.

    I updated the related pull request, but it will remain in draft status until it is compatible with all of the possible algorithm types.

    The steps to take an OTA with this will be:
    1. Restore Images in the Magisk app.
    2. Take the OTA in System Update. Do NOT reboot.
    3. Install Magisk to the Inactive Slot in the Magisk app.
    4. Reboot (NOT in System Update).
    If you're taking the OTA on with vbmeta patched with disable flags, you'll have to restore vbmeta in Vbmeta Patcher, first. After that, vbmeta will remain stock.

    Edit: I pulled the build, patching vbmeta is not required since 23016.
    8
    Devinfo Patcher has been released. See the OP for usage details.

    Until there is movement on the Magisk end, you'll have to use my builds of Magisk to enable flashing to the inactive slot.

    As I noted previously, I would rather not maintain ongoing builds of Magisk, so depending on what, if anything, ends up in Magisk in the near future, I may make an all-in-one tool. In that case, I imagine I'll stop developing the individual apps, but I'll leave up the final builds of each, if that happens.
    8
    I made a new build of Magisk that will patch and restore the vbmeta partition on Magisk install and uninstall. It also includes the bootctl binary from the previous release. I made a draft pull request (closed in favor of #5018) to start the process of getting this into mainline.

    Once all of the backups are in place, the steps to take an OTA with this will be:
    1. Restore Images in the Magisk app (which will also restore the stock vbmeta partition from backup).
    2. Take the OTA in System Update. Do NOT reboot.
    3. (optional, but recommended) Direct Install Magisk in the Magisk App (which will also patch and backup the vbmeta partition in the active slot).
    4. Install Magisk to the Inactive Slot in the Magisk App (which will also patch and backup the vbmeta partition in the inactive slot, mark the inactive slot as active, and mark it as successful during the first boot).
    5. Reboot (NOT in System Update).
    The first time you restore images, you'll have to restore vbmeta in Vbmeta Patcher. After that, Magisk will keep backups of the stock images.

    Note: This is now obsolete. Recent builds no longer a need to patch the vbmeta partition.
    6
    Any address to donate to?
    I look at it as my contribution back to the community. If you really want to make a monetary contribution, I suggest Code.org or EFF.