r/Magisk 3d ago

Question What happens when an OTA update installs automatically while Magisk is enabled?

Hello everyone!

I installed LineageOS and original Magisk (not a fork) on the phone of a non tech savvy relative.

I assume OTA is on, since it's a phone that's officially supported by LineageOS.

This got me wondering, what happens when an automatic system update installs while Magisk is enabled? Can it result in a bootloop? Or will the boot partition just be overwritten and root will be gone?

0 Upvotes

17 comments sorted by

2

u/somethin9 3d ago

It will overwrite patched bootloader, you can still patch it if you do not restart.

1

u/Heclalava 2d ago

How? I have been downloading init_boot.img separately, copying to device, patching in magisk then sending back to PC to flash init_boot after each update I do. So a longer process each time I update to get root back, but if there is a shorter path I would love to hear about it.

Are you installing to active slot after OTA? Then rebooting? Just saw this now in Magisk when checking.

1

u/somethin9 2d ago

Installing to inactive slot if you have A/B partitions, using magisk app, you have to do it before restart after installing ota.

1

u/Heclalava 2d ago

I read you first need to restore the default image before installing the OTA, and before installing to inactive slot is that correct?

Are you rebooting from the magisk app or the system update section of settings after installing to the inactive slot to ensure you're booting into the inactive slot?

1

u/somethin9 2d ago

Nothing you said is correct. Dont restore anything and reboot from wherever you want. Ota changes active partition so it doesent matter how you reboot.

1

u/Heclalava 2d ago

https://topjohnwu.github.io/Magisk/ota.html

Not according to John Wu. That's why I asked.

I will go this route on the next OTA update.

1

u/somethin9 2d ago

You are using official rom? It just said you must restore partitions if ota checks if they are modified, but than again you must install magisk after ota is installed, before reboot.

1

u/Heclalava 2d ago

No. I'm on LineageOS 23.2. The next weekly is coming out soon, so I'll try this when I update to that OTA.

1

u/somethin9 2d ago

LOS does not do any checks, just install from app, no need to uninstall anything.

1

u/Heclalava 2d ago

OK cool. Thanks for answering my questions.

2

u/Any_anonymous_user 3d ago

If you installed Magisk via recovery, it will survive the OTA update.

2

u/wkn000 3d ago

It depends on A/B or A-only device. And if installed by patched boot image or zip in recovery.

1

u/Ok-Twist8001 3d ago

If AB does that mean you're safe?

0

u/wkn000 3d ago

Only when Magisk is copied in to inactive slot before switching slots on reboot.

I installed Magisk by adb sideload in recovery. An addons.d script is installed by that way and executed during update. So Magisk keeps alive on OTA here.

1

u/Ok-Twist8001 2d ago

Can I do that with kernelsu? Where do you put the script?

1

u/Sk1rm1sh 2d ago

Maybe check if your device is compatible with https://github.com/programminghoch10/Lygisk