Rooting LineageOS 18.1 with Magisk

Minimal Computing

Updated:

Rooting Lineage OS with Magisk is necessary if you want to use privacy power apps such as AdAway (host blocker) and AFWall+ (firewall).

It is also slightly weird, which is why I want to summarize the official Magisk installation instructions from:

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

0.1

… just like a normal app, e.g. via F-Droid. No flashing necessary.

0.2

by opening the Magisk app and checking the Ramdisk info field.

Ramdisk availability informs whether to continue with boot.img or recovery.img. My Fairphone 2 has ramdisk, so I will assume it below.

Important: your device may not have ramdisk, so please check the original installation instructions.

0.3

Check your current LineageOS version e.g. by date under Settings -> Updater.

Download the zip archive of your current LineageOS version to your host machine from:

https://download.lineageos.org

Extract it, e.g. like this:

$ unzip lineage-18.1-*-nightly-FP2-signed.zip

You should find a boot.img file.

0.4

… and enable File Transfer under Settings -> Connected devices -> USB.

0.5

… from the host machine to the device:

$ adb push boot.img /sdcard/Download/

0.6

… by opening the Magisk app and following the install dialog.

Check the name of the output file in the provided log. Disregard the path shown. The actual file looks like this:

/sdcard/Download/magisk_patched-23000_uNQ1H.img

0.7

… back to the host machine, like this:

$ adb pull /sdcard/Download/magisk_patched-23000_uNQ1H.img

0.8

$ adb reboot bootloader

Wait until the Fairphone logo appears. The device is now in fastboot mode.

0.9

… onto the device:

$ sudo fastboot flash boot magisk_patched-23000_*.img
[sudo] password for david:
Sending 'boot' (6974 KB)                           OKAY [  0.313s]
Writing 'boot'                                     OKAY [  0.186s]
Finished. Total time: 0.507s

0.10

$ sudo fastboot reboot
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 0.050s

0.11

… in the Magisk app. It should now show a build number under Installed instead of N/A.

Notes:

  • In Magisk, tap the shield icon in the bottom row to manage superuser permissions for apps.
  • You may have to repeat these steps for each system upgrade.