How to Fix Bootloops caused by Magisk Modules (Using TWRP Recovery or ADB)

How to Uninstall Magisk Modules in TWRP Recovery

Has your Android device entered a bootloop after installing a Magisk Module? Then this guide can help you fix that. In this guide, I will show you how to fix bootloops caused by Magisk Modules using two different methods. This could be done by either using the ‘Magisk Manager for Recovery Mode’ mod in TWRP recovery or by using a simple ADB command (In case you do not have TWRP installed).

Advertisement

Magisk is an all-powerful customization solution for Android that allows modifying the software without altering the /system partition. You can use it to install Magisk Modules, to gain extra features and functionality for a more tailored experience. But some times, a combination of various modules could lead your Android device to a bootloop, a boot state where your device is no longer able to enter the actual OS (system). This could be caused because of incompatibility issues between two, or some times even more than two modules.

Table of Contents

How to Fix Bootloops Caused by Magisk Modules

To fix bootloops caused by Magisk Module(s), you’d need to remove the problem-causing module or maybe even all the modules. But since your phone cannot enter the system (OS), you cannot use Magisk Manager. So how would you do it if your Android device is currently in a bootloop? The answer is quite simple actually. You can uninstall Magisk Modules in TWRP Recovery itself without erasing/wiping any data on the phone.

Now, as I mentioned initially, there are two methods/ways to fix bootloops that are caused by Magisk Modules. The first method is for when you have TWRP recovery installed on your device. Though you can also temporarily boot into TWRP using the ‘fastboot boot twrp.img’ command if you’ve rooted your phone using the Magisk patched boot image. But if you do not want to use TWRP at all, then you can use the second method, which involves executing a simple ADB command on the PC.

Note: In the majority of cases, the most recently installed module could be the cause of the bootloop. However, if deleting that individual module still doesn’t fix the problem, you can try deleting other/all installed modules as well.

Now without any further wait, let us get straight to the instructions.

Advertisement

Method 1: Remove Magisk Modules Using TWRP Recovery

This method uses the ‘Magisk Manager for Recovery Mode‘ mod by XDA member VR25. His mod uses the in-built Terminal in TWRP to manage the installed Magisk Modules on your phone. You can use it to disable or completely remove the module(s) that are causing the bootloop.

  1. Boot your Android device into TWRP recovery first.
  2. Go to the ‘Mount’ menu in TWRP and select ‘Enable MTP’.
  3. Connect your phone to the PC using the USB cable.
  4. Now, download the latest ‘Magisk Manager for Recovery Mode’ mod zip file from this link.
  5. Copy the downloaded file (‘mm-201904040.zip’) to the phone’s storage.
  6. Once the file has been copied successfully, disconnect the phone from the PC.
  7. Go to the TWRP main screen and tap on ‘Install’.
    Install 'Magisk Manager for Recovery Mode' mod in TWRP
  8. Select the mod zip file and swipe the button on the screen to install it.
  9. Once the mod has been successfully installed, go to the ‘Advanced’ menu in TWRP.
    Go to 'Advanced' menu in TWRP and Select 'Terminal'
  10. Select ‘Terminal’ to launch TWRP’s in-built Terminal.
  11. Enter the following command to launch the Magisk Manager interactive shell:
    sh /sdcard/mm
  12. Enter “r” to list all the install modules for removal.
    Launch Magisk Manager for Recovery Mode and Mark Modules to Uninstall
  13. You will need to mark the installed modules that you want to remove. To mark a module, simply enter it’s exact name as shown in the list.
  14. Once you have marked the module(s) that you want to uninstall, enter “q” to quit the shell.
    Enter 'q' to quite Magisk Manager for Recovery Mode
  15. Now go to ‘TWRP’ > ‘Reboot’ and tap ‘System’ to boot your phone.

Upon rebooting, the marked module(s) should be completely removed from the system and your phone should boot normally into the system (OS).

Method 2: Remove Magisk Modules Using ADB

This method utilizes an ADB command which was introduced in Magisk v19.4 and above. It is, in fact, the easiest way to quickly remove all the installed Magisk Modules and fix bootloop issues caused by them. The only requirement for this method is that you should have the Android SDK platform-tools (Specifically ‘ADB’) installed on your PC.

  1. First, power off your Android device completely.
  2. Then connect it to the PC via a USB cable.
  3. Next, open the folder on the PC where ADB is installed (e.g. C:\platform-tools).
  4. Hold the SHIFT key on the keyboard and right-click on any empty space inside the folder.
    Launch PowerShell in the Folder where ADB is installed
  5. Select ‘Open PowerShell window here’ from the menu that appears.
  6. If you’re using macOS/Linux, simply launch the Terminal and change its directory to the folder where ADB is installed using the ‘cd’ command. For example, if ADB is installed in /Documents/platform-tools, then the command should look like:
    cd Documents/platform-tools

    Change the Terminal's directory to the folder where ADB is installed

  7. This will launch the command-line in the same folder where ADB is installed.
  8. Now, enter the following command in the command-line window:
    adb wait-for-device shell magisk --remove-modules
  9. After entering, hold the power button of your device to boot it into the OS.

The said command basically waits for your device till it enters the boot screen, from which point ADB is functional. It will then remove all the installed Magisk Modules to fix the bootloop. With that done, your phone should successfully boot into the system (OS).

So, you have just learned how to fix bootloops caused by Magisk Modules, by removing the modules via TWRP or ADB. If you have any questions regarding the topic, please feel free to reach out to us via the comments.

Huge thanks to VR25 for the mod!

Comments

  1. I dont have twrp in my ONEPLUS 8 PRO , so tried the 2nd method using adb, bit I didn’t turn on USB Debugging in my phone, so “adb wait-for-device shell magisk –remove-modules” command is not working. what to do ?? any way using fastboot mode?? please

    1. Yugendhra, starting with Magisk v21, there’s a new feature in Magisk that will automatically disable all modules when the device is booted into Safe Mode. The primary aim of this feature is to help users deal with rogue modules and it’s certainly much more easier and convenient than the two methods shared above.

      You can check out this short and precise guide in Verizon’s knowledge-base to learn how to enter Safe Mode.

  2. For those who have TWRP, you can also:

    1) Boot into TWRP
    2) Click MOUNT / check SYSTEM / BACK
    3) Click ADVANCED / TERMINAL
    4) cd /data/adb/magisk
    5) ./magisk —daemon
    6) ./magisk —remove-modules

    Cheers.

    1. Thank you, Edgar, for providing yet another convenient way to deal with rogue modules.

      I will be updating this tutorial in a short while and will make sure to mention the method you shared as well.

    2. For me I just had to remove my last installed magisk module, which was causing the boot loop/stuck in boot loop.

      1) Boot into TWRP
      2) Click MOUNT / check SYSTEM / BACK
      3) Click ADVANCED / Filemanager
      4) Navigate to /data/adb/magisk/modules
      5) Delete the Magisk Module(s) folders which you want to remove.
      6) Reboot System

  3. hey can you help me out
    my mi a2lite is stuck in a bootloop and i cant seem to turn it off
    please help

    1. Hello, Nami. Do you have TWRP installed on your Mi A2 Lite or is it rooted with Magisk alone (without TWRP)?

    1. I am glad it was helpful, Nihal. Thank you for the kind words and a very happy new year.

  4. I have been trying many ways to resolve as to disable trhoguh “touch /data/data/de.robv.android.xposed.installer/conf/disabled” or by installing “Magisk Manager for Recovery Mode” but none of them help me.

    However this “Method 2: Remove Magisk Modules Using ADB” saved my phone of reinstall stock rom.

    Thanks!

    1. You’re welcome. Magisk v21.0 (and above) now supports Safe Mode Detection. Which means, there’s a third and probably a much easier way (compared to above two), wherein, you just boot the device into Safe Mode.

      Magisk will automatically detect Safe Mode and disable all the modules. I will be adding this method to this tutorial later this week.

  5. Hey, i have lenovo tab 3 7 essential. I am stuck in boot loop. I uninstalled the xposed magisk module, but still i am stuck in that freaking boot loop. I dont know what to do. Kindly help me as fast as possible.

    1. What version of Magisk did you have had installed on your Lenovo Tab3 7?

  6. hey there! i was trying to do an OTA update with my rooted android one moto x4, using the method you’d suggested (https://www.thecustomdroid.com/install-ota-update-rooted-android-device-guide/), and after uninstalling magisk to restore the stock image (seemed to go fine), i then tried to get the OTA update i was originally after.

    it didn’t work but that’s fine, i thought, so i then tried to just reinstall magisk, as per your instructions (‘install to inactive slot after OTA’)…i think that part is the one that screwed me up. my phone is now stuck in a boot loop. can access the boot recovery menu (vol down + power), but every option in there other than powering off just leads me to a boot loop. any suggestions on how to recover my system?

    1. jtr, if you are trying to return to stock, you can download the full image (or full ota update, NOT an incrimental update) and flash this to return your system to stock fully and boot the system. With the Pixel line of phones, the downloaded image contains a .bat file, i believe called flash-all.bat. if you edit this file with a text editor, there is a line that performs the adb update command. in that line is a “-w” command argument. if you remove the “-w” part of that line, save the file, and run the update batch file, this will reflash your system partition, boot partition, and recovery, without touching your data partition. all of your apps, data, system customizations, etc, will remain. I hope this helps.

      technotic

    2. Thank you so much for taking the time out to help others around here. Really appreciate it.

  7. i am in bootloop after installing a magisk module. I am in 11.0.11 build. I followed the guide but the bootloop continues. Any other solution?

    1. Hi Fanis. Please try to enable Magisk core only mode using Method 1. This should fix any issues if caused by a Magisk Module. If not, then there’s definitely some other underlying problem instead of the Magisk Module.

    2. Yes Dhananjay, at last I followed the first method but it was a little difficult because yesterday I couldn’t install the twrp.img trying to install twrp recovery. There’s a problem with this stock rom build, I think isn’t? At last I used the q- base patched twrp.img and I solved the problem, I installed the twrp recovery and following the first method I disabled the buggy magisk module (sony music!).I reboot normally and I am root again with the rest of modules working fine.
      Thanks for your answer!

    3. Hi again, Fanis. Yes, there could be. It’s the third time that Xiaomi has recalled the Android 10 update for the Mi A3 because of bugs.

      And I am glad you were able to fix the bootloop. You’re much welcome! And sorry if I am not able to respond to you on Facebook as I am not getting enough time.

Leave a Reply

Your email address will not be published. Required fields are marked *