Magisk: Provide alternate method for Restore Images

Created on 25 Sep 2019  Â·  10Comments  Â·  Source: topjohnwu/Magisk

I use Magisk with a Pixel 3. With the latest OTA that was pushed, I was unable to follow the OTA upgrade method, as I received a "Stock backup does not exist" error at the Restore Images step. I assume this is because the manual boot image patching installation method does not have a step where it is able to create the backup of the boot image. Normally, this would not be an issue because I could just reflash the stock boot image and install Magisk via the TWRP flash method, which would create the necessary backup. Unfortunately, there is no TWRP yet available for Android 10 and there may or may not be one, due to changes in the Android recovery process.

So my request is this, either:
Modify the manual boot image patching method to create the necessary backup

or

From the Restore Images uninstallation step, allow the user to supply a stock boot.img file from internal storage to complete the process

This would allow users to make use of the much simpler OTA upgrade process while there is no TWRP available.

Thanks for providing and maintaining this program, I very much appreciate being able to control adblocking processes manually, along with the many useful modules.

enhancement

Most helpful comment

The backups should be kept in /data (/data/stock_boot_\ You could probably edit /sbin/.magisk/config to point to the backup you want by putting your \

All 10 comments

I second this suggestion. Would be great to be able to manually point to a boot.img.

Only thing is you'd have to get the boot image from the updated firmware again every OTA, unless magisk can get it from the OTA and back it up then?

This would be a godsend for OTAs in Android 10 devices. Right now, without a working TWRP, the only methods are:

  • fastboot flashing stock boot first, then normal update or OTA sideload,
  • fastboot flashing full factory image without -w flag to keep data.

FWIW I've tried patching the stock boot.img file using Magisk Manager and, while it does state during the process that it is creating a backup, it does not seem to store it or keep it anywhere.

The backups should be kept in /data (/data/stock_boot_\ You could probably edit /sbin/.magisk/config to point to the backup you want by putting your \

Thanks! The SHA1 in /sbin/.magisk/config was correct, so I simply gzipped the stock boot image, renamed it and placed it in /data as instructed. Magisk Manager picked it up for uninstall, OTA applied and Magisk reinstalled without issue.

please, someone tell me if i'm doing something wrong ...
my file name is following the pattern "stock_boot_< sha1 >.img.gz", with the SHA1 coming from "boot.img" that is inside .gz file, and it's the same from "sbin/.magisk/config"... wouldn't it be like this?

I just tried that

The backups should be kept in /data (/data/stock_boot_.img.gz)
You could probably edit /sbin/.magisk/config to point to the backup you want by putting your after SHA1=

I just tried this and it worked without issues.
Only problem I see is that after that, the file under /data/stock_boot_.img.gz is removed again and the hash in /sbin/.magisk/config changed. Even though no file is stored under /data/...

I just tried that

The backups should be kept in /data (/data/stock_boot_.img.gz)
You could probably edit /sbin/.magisk/config to point to the backup you want by putting your after SHA1=

I just tried this and it worked without issues.
Only problem I see is that after that, the file under /data/stock_boot_.img.gz is removed again and the hash in /sbin/.magisk/config changed. Even though no file is stored under /data/...

what are the permissions and owner for this file? I think that another app had changed permissions for this file, maybe this is the reason to don't work for me

For me (also after reading the source) is not clear what is the difference between /data/magisk_backup_$SHA1 folder where a Boot.img.gz will be stored, and the
/data/stock_boot_hash.img.gz
are they not the same? Why it is needed to build up the file /data/stock_boot_hash.img.gz manually?

This seems like something a root app should handle, and not directly included into Magisk as there are already too many features to keep up with.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rakleed picture Rakleed  Â·  4Comments

Fs00 picture Fs00  Â·  3Comments

dg28gadhavi picture dg28gadhavi  Â·  3Comments

Ralozey picture Ralozey  Â·  4Comments

Madis0 picture Madis0  Â·  3Comments