Install Magisk via TWRP - problem with slots (?)

Hey everyone,

I actually try to install Magisk via TWRP. At all, it seems to work, but if I restart /e/, the app still says its not installed. My guess: I installed TWRP on slot a, while /e/ is on slot b, so I think TWRP only installs it “slotwise”. Is there a possibility for TWRP to install Magisk to slot b while itself is on slot a?
If not, how would you install Magisk?

Thank you!

Regain your privacy! Adopt /e/ the unGoogled mobile OS and online servicesphone

Hello @eUser123. It would be helpful to indicate the make and model of your device as that would make it easier to see what suggestions to make, or even better use the device codename and do a search for it on the forum here. That would also tell us if you have a phone with A/B partitioning.

Assuming this is the case I would advise following the Magisk Installation instructions that topjohnwu, its creator, maintains. You will see that you can’t use TWRP on this type of phone unless you have already created a modified boot image, because there is no longer a separate recovery partition. His instructions are detailed but quite clear and I have installed (and reinstalled after major version updates) Magisk in this way on my A/B device.

You will probably need a tool to extract the boot image from the eOS zip file as Magisk needs this on your device to create a patched image. Using Linux payload-dumper is the usual tool to “dump” all the image files from the zip file. I believe a version exists for Windows and Mac, but not having these systems I can’t help you there.

Hey Grendel, thanks for your answer and sorry for only giving a few infos.
I use a FP3+ with TWRP on Slot A and /e/ on Slot B. I already tried to do it that way by using the “boot.img” within the *.zip from the download of the /e/ software. But as I would need to flash it, I guess my data would be lost, wouldn’t it?
Sorry for all the nooby questions, but unfortunately an App thats quiet important to me stopped working and I hope it’ll work again with Magisk - thats the reason I’m doing things that are way above my (technical) horizon.

I have never used a FP3+ so I’m just guessing how they work as you say you’ve got TWRP on slot A. Presumably it allows you to set the slot to boot from when you are in the recovery mode. But as far as I know you can’t use it to install Magisk to the other slot unless the boot image has been patched. Flashing the boot image or sideloading it does not touch the data partitions so you won’t lose your apps or personal data.

The normal procedure with the latest Magisk 24.3 is to install the apk file from their website and then on opening it and asking it to install it to the boot image, it will ask you where it is located and then do the patching for you. You end up in Downloads with a file called “magisk_patched-24300-xxx.img” where the last part is a random code. You than have to copy it across to you PC and from there use ADB to flash this image file. On reboot, the Magisk app will confirm that you have it installed correctly.

My advice just to be sure I’ve got it right would be to send a personal message to @AnotherElk as I know that he is active on the Fairphone forums as well and knows this device well. Otherwise create a new message string in the Fairphone section of this forum and someone more knowledgeable than me will pick up your query there.

Thanks for the kind words, but neither do I install TWRP permanently to my Fairphone 3, nor do I use Magisk, so I’ve got no helpful clue here.
Sorry.

Forum searches for the Magisk TWRP combo here and in the Fairphone forum indeed can’t hurt.

Hope you didn’t mind me mentioning you in this thread. Thanks for the quick reply.
In fact unless @eUser123 can be more specific about the app he wants to fix, I’m not sure rooting the phone would solve his problem, not to mention the security risk involved if you don’t know what you’re doing.

Thanks for your answers!

My phone is already rooted, because I wanted to be able to back it up.
For everyone who wants to install Magisk: The Instruction @Grendel already linked worked perfectly fine and didn’t delete any data at all. You have to download /e/OS (the version you use!) and extract the boot.img, save it to your phone and follow the instructions.

Unfortunately, I still don’t pass SafetyNet. I installed some other Modules for Magisk (-> xda-forum has a lot of info therefore) and got it to pass the Basic Integrity, but the CTS profile match won’t work. Seems to be a known issue and the dev seems to work on it.

So, thanks for your help and if anyone needs more informations about what I did feel free to ask :slight_smile:

Perhaps this post by @petefoth might be useful for you as he has experimented with different backup solutions. I normally use Titanium Backup but have been testing Neo Backup which is the new name of OAndBackupX available on F-Droid. The latest alpha version has lots of features and seems to work with the few apps that I have tested it with.

up to e-1.5.1-s it worked on my FP3 to install TWRP and flash Magisk from there.
Now I have to switch to the patching method.
Extracting the boot.img seems very complicated to me.

e-1.7-s…FP3…zip contains only payload.bin (Updated to 1.7 today)

Can I take the old boot.img
from IMG-e-1.4-r-20220922220394-dev-FP3.zip
or
IMG-e-1.2-r-20220727206630-dev-FP3.zip
to patch for Magisk on the actual system?

What puzzles me: I’ve read you should take boot.img from stock rom
(versions of /e/ 1.2 and 1.4 for FP3 are not identical - I get different sha256-values for them using 7zip)

(I want to use Titanium backup again)

The internet should have something for you if you search for “extract payload.bin” or for “payload dumper”.

On my OnePlus 9 with stock e/OS recovery I just and only sideloaded the magisk.apk (renamed to magisk.ZIP) via ADB. That worked immediately.

Strangely on my OnePlus 7pro Magisk stays after OTAs (did 3 of them). On the OnePlus 9 I lost root after 1.6 → 1.7 but I could just sideload the zip-file again and got root back.

Thanks for the idea. I hadn’t used sideload method yet. Unluckily it doesn’t work in my case.(Magisk-v23.0.zip) Output looked similar to installation from TWRP.