DEV Community

Vitor Mattos
Vitor Mattos

Posted on Edited on

Install Magisk

Every time I update LineageOS, I lose root access and need to patch the new boot image with Magisk again.

Install Magisk APK:

https://github.com/topjohnwu/Magisk/releases/latest

More details:

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

For POCO F3 (alioth) using LineageOS for microG:

https://download.lineage.microg.org/alioth/

Follow these steps:

  • Check the LineageOS build installed on the phone:
  adb shell getprop ro.lineage.build.version
  adb shell getprop ro.build.date.utc
  adb shell getprop ro.build.fingerprint
Enter fullscreen mode Exit fullscreen mode
  • Download the boot.img from the same build installed on the phone.

For example:

  lineage-23.2-20261002-microG-alioth-boot.img
Enter fullscreen mode Exit fullscreen mode

Older versions of this guide used recovery.img, but current alioth builds provide a separate boot.img, which is the image used here.

Do not use vendor_boot.img, dtbo.img or vbmeta.img for this procedure.

  • Copy the image to the phone:
  adb push lineage-23.2-20261002-microG-alioth-boot.img \
      /sdcard/Download/boot.img
Enter fullscreen mode Exit fullscreen mode
  • Open Magisk and select Install.

  • Select Select and Patch a File and choose:

  /sdcard/Download/boot.img
Enter fullscreen mode Exit fullscreen mode
  • Click LET'S GO and wait until Magisk finishes.

  • Check the generated filename:

  adb shell ls -lh /sdcard/Download/magisk_patched*
Enter fullscreen mode Exit fullscreen mode
  • Copy the patched image back to the computer:
  adb pull /sdcard/Download/magisk_patched-[random-string].img \
      ~/patchedboot.img
Enter fullscreen mode Exit fullscreen mode
  • Reboot the phone into the bootloader:
  adb reboot bootloader
Enter fullscreen mode Exit fullscreen mode
  • Check that fastboot can see the device:
  fastboot devices
Enter fullscreen mode Exit fullscreen mode
  • Flash the patched image:
  fastboot flash boot ~/patchedboot.img
Enter fullscreen mode Exit fullscreen mode
  • Reboot:
  fastboot reboot
Enter fullscreen mode Exit fullscreen mode

After the phone starts, open Magisk and check that root access is working again.

Important: always use the boot.img from the exact same LineageOS build installed on the phone. Do not reuse a boot image from an older build.

Top comments (0)