NicolasWebDev / reinstall-magisk-on-lineageos

Small bash script to reinstall magisk after each LineageOS update
72 stars 15 forks source link

Support A/B Boot Partitions #26

Open hinneLinks opened 1 year ago

hinneLinks commented 1 year ago

My Phone, a Fairphone 3 uses A/B Boot (see https://source.android.com/docs/core/ota/ab#life-of-an-a-b-update). So the flash didn't work for me:

$ fastboot flash boot /tmp/patched-boot.img
fastboot: error: boot partition is smaller than boot image

Instead i had to find the active boot slot and then use that one:

$ fastboot getvar slot-active:a
slot-active:a: No
Finished. Total time: 0.010s

$ fastboot getvar slot-active:b
slot-active:b: Yes
Finished. Total time: 0.001s

$ fastboot flash boot_b /tmp/patched-boot.img

Also I wonder, if I should somehow switch the active slot to boot_a and flash that one, too? Or does the other one somehow magically updated after a successful boot - has anybody experience with this? Using fastboot flash --slot=all seems dangerous to me, if an error happens, both slots are broken.

dwildstr commented 1 year ago

On A/B phones there's already a pretty good built-in mechanism for Magisk to stay installed after an update (update without rebooting, use the Magisk Manager to patch the inactive slot, and then reboot), so this script is hopefully not something A/B phone users have to use that often anyways.

MMK21Hub commented 10 months ago

While that process sounds more convenient, it requires you to know about it before performing the LineageOS update, which is by no means a given - I didn't notice any warnings in the documentation or from within LineageOS itself about this occurring. Therefore, I still think that it would be useful if this supported A/B Boot devices.

With my Moto G7 Power, the script appeared to complete successfully without any errors, Magisk was not installed upon the phone rebooting, so clearly something failed silently.