back to the beginning

Retaining root access with Magisk on stock 8.1

Obtaining root for the first time is different from retaining it. Mainly, disabling Magisk prior to the OTA update and the method for obtaining the boot image is different. Flashing the boot image and Magisk are identical.

These instructions are for retaining root access using Magisk.

If you do not already have root access, you need to follow the instructions for obtaining root access for the first time.

Retaining root access

    These first steps are all performed in your phone's settings menu.

  1. Use Magisk to restore changes made during installation
  2. Run the Magisk app and have it restore images by pressing the Uninstall button and choosing Restore Images.

  3. Install the OTA (over the air) update and wait at least for step 2 of the install before you proceed.
  4. Note: If you don't want a rooted phone anymore just reboot now.

  5. Disable lock screen code
  6. Settings - Security - Screen Lock - None

    If you forget to unlock your phone before you do the next steps you will have to reflash your boot image to stock, reboot your phone, turn of the lock screen and start over.

  7. Turn on developer options
  8. Settings - System - About phone - Build number

    Tap Build number until developer options are enabled

  9. Turn on adb debugging
  10. Settings - System - Developer options - USB debugging

    Connect your phone to your computer with a USB cable and give your computer permission to do USB debugging with your phone.

  11. Dump new boot image
  12. You will need to capture the new boot image to re-install Magisk. This is much easier to do now that you already have root access on your device.

  13. Reboot the phone to complete the update and make sure everything installed correctly.
  14. Reboot to recovery
  15. Restart the phone again and depress the volume down button while the phone restarts.

  16. Install TWRP
  17. We need to install TWRP to this partition so we can re-install Magisk.

    sudo fastboot flash boot twrp-mata_11.img

    Now press the volume down button to select booting to recovery mode and press the power button to select. After a few moments TWRP will start.

  18. Move Magisk to your phone
  19. Magisk may still be on your phone from when you first rooted.

    You may have a different version of Magisk so instead of FILENAME use the name of the Magisk file you download:

    sudo adb push /sdcard/
  20. Flash boot.img and Magisk
  21. In TWRP press the INSTALL button.

    Note: TWRP has a button to select if you want to flash an .img or a .zip file. You have to press "Install Image" to see the boot.img file and again later to see the Magisk file on the /sdcard partion of your phone.

    Note: In TWRP you need to use the back button as well as the interface buttons for navigation.

    Scroll down until you see the boot image you previously saved. Touch it and select the radio button labeled "Boot". Swipe to confirm flash. This actually overwrites TWRP with the boot image you extracted. At this point the phone is back to stock but we still have TWRP running.

    When that has completed select and flash Magisk by pressing the Back button, the phone's back button, the Install Zip button, touch Magisk file, swipe to confirm flash.

  22. Reboot the phone without installing TWRP
  23. There is no need to have TWRP installed as an app on your phone.

  24. Disable USB debugging
  25. Settings - System - Developer options - USB debugging

    It is safest to keep USB debugging disabled until you need it. Go to the developer options menu in settings and disable it.

    You can also now set your lockscreen.

    Settings - Security - Lockscreen

back to the beginning