The Epic Saga of Installing Magisk on LineageOS on PH-1


I'm a big fan of LineageOS and Magisk and have used them for years.  Recently, LineageOS chose not to ship with a pre-installed root binary.  Instead, they recommend you use ADB to install Magisk.  Easy, right?  Wrong.  Essential Phone (PH-1) uses an A/B system that prevents direct Magisk patching from the app.  So, after a ton of research and trial and error, here's the process to get Magisk running on your LineageOS PH-1 phone:

Important: This guide assumes you have an unlocked bootloader and LineageOS installed on your phone.  If not, follow the LineageOS installation guide first.

1. On the Magisk releases page, find the latest Magisk Manager entry and expand the Assets section to download the apk file to your phone.

2. Locate the apk file on your phone, open it, and follow the instructions to install it.

3. After installation, open the app and you'll notice we're halfway there (yay!) but we still need to install Magisk

4. Make sure you have enabled Developer options, then enable Settings > System > Advanced Developer options > Android debugging

5. Connect the phone to your computer

6. On your computer, make sure you have Python, ADB, and Fastboot installed (sudo apt install -y python3 adb fastboot) and type adb devices (it should display your phone in the list)

7. On your computer find your phone in the left-hand column of the LineageOS download page and download the nightly OS zip file (not the recovery zip file) -- note: for some [conspiracy theory] reason my browser complained about the file being malicious so you may need to use curl/wget

8. Open the zip file and extract payload.bin

9. Download the payload_dumper zip file and extract the payload_dumper folder to your computer.

10. Move the payload.bin file from Step 8 into the payload_dumper folder in Step 9 then open a terminal to the payload_dumper folder and type: python3 -m pip install protobuf && python3 payload_dumper.py payload.bin

11. It will take a few minutes to extract all the image files from payload.bin so be patient :)

12. Once the image files have been extracted, copy boot.img to your phone

13. Open the Magisk Manager app, select Install for Magisk, then Install again, then Select and Patch a File:


14. Locate the boot.img file from Step 12 and Magisk Manager will patch it with Magisk and save it as magisk_patched.img

15. Copy magisk_patched.img to your computer and then run adb reboot bootloader to restart the phone in bootload mode

16. Once in bootloader mode run the following commands (assuming the img file is in your current terminal directory):

fastboot flash boot_a magisk_patched.img
fastboot flash boot_b magisk_patched.img

17. Once the boot partition has been overwritten successfully, type fastboot reboot to reboot the phone

18. Once the phone has booted normally, open the Magisk Manager app to verify Magisk has been installed successfully

19. Celebrate!

______________

References:

Comments

Popular Posts