Home / Guide / Recovery

Fixing a Magisk Bootloop: Safe Mode, ADB and Stock Image Restore

A phone stuck on the boot logo after a Magisk change is almost always recoverable. Work through these methods in order, from gentlest to most thorough.

Phone in safe mode with Magisk modules disabled and a recovery command

Don’t panic: most bootloops are recoverable

Few things are as unsettling as a phone that restarts endlessly or sits on the manufacturer logo after you installed something. The good news is that Magisk was designed with recovery in mind. Because it never modifies your system partitions, the original Android installation is still intact underneath. Getting back to a working phone is usually a matter of switching off whatever Magisk loaded on top.

This guide works through the recovery options in order, starting with the least invasive. In the large majority of cases the first or second method is enough, and you keep both your data and your root.

First, identify what changed

Bootloops rarely happen at random. Think back to the last thing you did before the restart.

  • Installed or updated a module. By far the most common cause.
  • Enabled Zygisk with a module that then loaded into a critical process.
  • Flashed a newly patched image from a different firmware build.
  • Installed a system update while rooted without following the restore steps.
  • Changed a system property with a resetprop script or module.

Knowing the trigger tells you which method to start with. If a module caused the problem, the module-focused methods below will fix it. If the boot image itself is wrong, skip ahead to restoring the stock image.

Method 1: Android Safe Mode

Magisk watches for Android’s built-in Safe Mode. When the phone boots into Safe Mode, Magisk disables every module. The modules stay installed, but they are marked as disabled, so the next normal boot starts without them.

The way to enter Safe Mode varies by manufacturer, but on many phones it works like this:

  1. Power the phone off completely. If it is looping, hold the power button (sometimes with volume down) until it shuts down.
  2. Power it on.
  3. When the manufacturer logo or boot animation appears, press and hold the volume down button.
  4. Keep holding until the lock screen appears. A small “Safe mode” label in the corner confirms it worked.

Once in Safe Mode, simply restart. The phone should boot normally with all modules disabled. Open the Magisk app, go to Modules, remove the module you suspect, and re-enable the others one by one, rebooting between each, to confirm which was responsible.

Safe Mode works best when the phone gets far enough into boot for Android to read the key press. If your device loops very early, try Method 2.

Method 2: Remove modules over ADB

Magisk includes a command that removes all modules during boot. It requires USB debugging to have been enabled before the problem started, and your computer to have been authorised for ADB on that phone.

adb wait-for-device shell magisk --remove-modules

Run the command with the phone connected, then let the phone attempt to boot. ADB waits until the device becomes available during boot, runs the command, and Magisk removes every module and reboots. This removes modules permanently rather than disabling them, so note which ones you had installed.

If ADB never sees the device, the loop may be happening before the ADB daemon starts. In that case, move on to restoring the stock image.

Method 3: Flash the stock boot or init_boot image

This method removes Magisk entirely from the boot process. Because modules depend on Magisk to load, they stop loading too. Your data remains intact.

  1. Boot into the bootloader. On most phones, power off and then hold power plus volume down.
  2. Connect to your computer and confirm fastboot devices lists the phone.
  3. Flash the stock image for your exact firmware build to the right partition.
fastboot flash init_boot init_boot.img   # devices that use init_boot
fastboot flash boot boot.img             # devices that use boot
fastboot reboot

The phone now boots as an unrooted device. Your Magisk modules are still on the data partition, but inactive. To root again, patch a fresh copy of the stock image, flash it, and use Method 1 or Method 2 straight away to clear the problem module before it loads.

Samsung users use Odin to flash the stock AP file instead. Be careful to choose the HOME_CSC file rather than CSC if you want to keep data, and read your model’s notes first.

Method 4: Recovery-based removal

On older devices with a custom recovery such as TWRP, you have two additional tools.

  • Delete the module folder. Use the recovery’s file manager to remove the problem module’s folder from /data/adb/modules/. If recovery can decrypt your data, this is a precise fix.
  • Flash the uninstaller. Rename the Magisk APK to uninstall.zip and flash it to remove Magisk completely and restore the stock boot image.

Method 5: The last resort

If none of the above works, the problem is probably not Magisk. A mismatched firmware flash, a corrupted partition or a failed system update can all cause boot failures. Flashing the complete factory firmware for your device, using the manufacturer’s instructions, returns every partition to a known state. Depending on the tool and options used, this may erase data, which is why the backup advice at the start of every rooting guide matters so much.

Preventing the next bootloop

Once your phone is working again, a few habits make a repeat far less likely.

  • Enable USB debugging and authorise your computer now. It costs nothing and makes Method 2 available in an emergency.
  • Keep your stock image somewhere safe. Store the boot or init_boot image for your current build on your computer, labelled with the build number.
  • Install one module at a time. Reboot and use the phone for a while before adding the next. If something breaks, you know the cause.
  • Read the module description. Many modules list supported Android versions and devices. Installing a module designed for another brand is a frequent cause of loops.
  • Prefer modules from active authors. A module last updated years ago may not understand current Android.
  • Follow the OTA procedure. Restore images before updating and use the inactive slot option on A/B devices.

Reading logs after recovery

After you are back in Android, spend a minute on diagnosis. The Magisk app’s Log section can save a full log file, and many modules write their own logs to /data/adb/ or their module folder. If you want to report a problem to a module author, include the log, your device model, Android version, Magisk version and the steps that triggered the loop. Authors can fix problems much faster with that information.

A note on hardware key combinations

Every brand uses slightly different button combinations for Safe Mode, the bootloader and recovery, and some change between models. Before you ever need them, look up the correct combinations for your exact phone and write them down. Trying random combinations on a looping phone wastes time and can occasionally trigger a factory reset menu, where a careless tap erases data. Knowing the right keys in advance turns a stressful situation into a routine one.

It also helps to know how to force a power-off. On most current phones, holding power and volume down for around ten to fifteen seconds forces a restart even when the screen is unresponsive. From there you can catch the boot sequence at the right moment for Safe Mode or the bootloader.

When the bootloop follows a Zygisk change

Zygisk modules load into the process that starts every app, including system interface components. A faulty one can crash the launcher or System UI repeatedly, which looks like a bootloop even though the core system has started. In that case, ADB is often already available, so magisk --remove-modules works quickly. Alternatively, Safe Mode disables the module along with all others. After recovering, re-enable modules without the suspect one and check whether its author has released a fix for your Android version.

Quick decision guide

SymptomStart with
Loop began after installing a moduleSafe Mode, then ADB removal
Phone shows boot animation for a long time then restartsSafe Mode
Phone restarts before the boot animation appearsADB removal, then stock image
Loop began right after flashing a patched imageFlash stock image, re-check firmware build
Loop began after a system updateFlash stock image from the new build

Summary

A Magisk bootloop is unpleasant but rarely serious. Safe Mode disables modules with nothing more than a button press. The ADB command removes them when Safe Mode is out of reach. Flashing the stock boot or init_boot image removes Magisk from the boot chain entirely while preserving your data. With USB debugging enabled and your stock image saved in advance, you can recover from almost any Magisk-related failure in a few minutes.