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!