Preserve TWRP and/or Magisk after system update

I guess there’s no way to do an system update preserving TWRP and/or Magisk without the need to reflash it via fastboot?
Maybe somehow using TWRP for flashing the update?
Looks like the ZIP file from can’t be simply flashed with TWRP.

I like to keep my phone rooted all the time and without the need to have a computer with fastboot at hand.
I’m an experienced software developer / administrator and I never regretted having root/admin permission on all my computers since the 1992. And yes, I’d never root my parents phones because I know this is a power for experienced hands only :wink:

It seems you are coming from a Fairphone 2 to a Fairphone 3+.
Some things work differently now. Like many Android phones nowadays, the Fairphone 3/3+ is an A/B device.

When you installed TWRP, you will have noticed the different, more complicated procedure compared to just flashing it to the recovery partition on non-A/B phones.
Installing TWRP now alters the boot partition. This breaks Fairphone OS OTA updates (because the Updater there checks for altered partitions and quits the process in case there are any), and /e/ just restores an unaltered boot partition with its own recovery with every update.

The recovery is not needed for updates anymore. If you have a look into the update ZIP files, you’ll see how it’s just the partition images in there, no update script, no anything else.
When updating via the Updater, the update gets installed to the A/B slot you don’t currently have in use, this happens in the background while you are still using the phone, then the active slot gets simply switched with a reboot and you’re back with the new OS version without the installing delay of old.
If something went wrong, normally you could switch back to the OS state prior to the update, the data would be the same (only the OS is A/B).

I guess you need to check whether TWRP is able to install the images ony by one to the correct partition in the correct slot, emulating what the Updater does automatically.
TWRP should still be able to install images (like back on the Fairphone 2 you could install the TWRP image with TWRP to the boot partition or to the recovery partition), and TWRP can set the OS slot, but I don’t know whether TWRP now would give you the correct targets for the partition images.


Thanks for the answer!
Yes, I’m switching from FP2 to FP3+.
And I already heard a little about that A/B thing.

I was hoping there’s a mechanism where TWRP or Magisk could register. So the updater will reflash them automatically after applying the update.

Nevertheless, your answer brought me to another idea.
It sounds like the writing process of the update is fully completed before the reboot is triggered!?
And at this moment I still have Magisk root permissions in the running system.

So I’ll look for a way to flash TWRP and/or Magisk to the new system before doing the reboot out of the old system.
Theoretically this should work, correct?

You can’t simply flash TWRP.
But if Magisk or perhaps the TWRP App (which I never used, so wouldn’t know) have a way to install TWRP into the boot partition on the updated slot … why not.

Unfortunately the official TWRP app also doesn’t seem work for A/B devices (yet).

But there’s a Magisk module: TWRP A/B Retention Script (twrp-keep)
I’ll give it a try at the next eOS update.

Successfully tested when updating from to :slight_smile:

1 Like

This topic was automatically closed after 60 days. New replies are no longer allowed.