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).

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.

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. 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

Comment Policy: We welcome relevant and respectable comments. Only input your real first name and valid email address if you want your comment to appear. Read our comment policy fully before posting a comment.