How to fix a Magisk bootloop
A bootloop after rooting is almost always recoverable, usually without losing data. The fix depends on when it started: after a module, right after flashing the patched image, or after a system update. Find your situation below, then follow the matching section.
Last updated 9 sourcesHow we check pages
Start here: which fix do you need?
Answer two questions to find the right fix. Each answer links to the steps below. If you only remember one thing: when a module is to blame, let the phone try to boot a few times before you flash anything, because Magisk can recover by itself.
Which fix do you need?
- After a moduleDoes
adb deviceslist the phone asdevice?- Yes
- NoLet it fail twice for automatic Safe Mode, or use the Volume Down timing
- Right after flashingIs it a Samsung phone?
- NoFlash the stock image back with fastboot
- YesFlash the complete stock firmware (wipes data)
- No
- After a system updateWait for A/B fallback, then remove modules or flash the new build's stock image
- After turning on ZygiskLet it reboot: Magisk rolls Zygisk back after repeated zygote crashes
Bootloop after a module: let Magisk recover by itself
Magisk counts boots that never finish. Each boot adds one to a counter early in startup (Magisk's post-fs-data stage), and a boot that reaches boot_completed resets it to zero. When the counter shows two unfinished boots in a row, the next boot runs in Magisk Safe Mode: Magisk creates an empty disable file in every module folder and switches the Zygisk setting off, so the phone can start. This logic is in Magisk's source in v30.7 as well as the current v31.1, and Magisk's FAQ documents it from v31.1.
- What to do: let the phone loop. Give it at least three boot attempts before you try anything else.
- After it boots: modules stay disabled and Zygisk stays off until you change them. Remove or update the module you installed last, then re-enable the others one at a time and turn Zygisk back on in settings.
- When it can't help: the counter only runs once Magisk itself starts. If the phone restarts before that (a wrong or broken patched image, for example), the counter never moves. See bootloop after flashing.
The same Safe Mode is triggered by Android's own Safe Mode flags (persist.sys.safemode or ro.sys.safemode set to 1), by the Volume Down key check below, and, when the phone still boots, by the Safe mode entry in the Magisk app's reboot menu (the power icon on the Home screen). Magisk added Safe Mode detection in v21.0.
Remove all modules over ADB
If USB debugging was on before the problem and the computer was already approved, this is the fastest fix. Connect the phone while it loops and check that adb devices lists it as device (not unauthorized). Then run:
What the command does, from Magisk's source:
- It runs each module's
uninstall.sh(if it has one), deletes the whole/data/adb/modulesfolder, and reboots. Add-n(magisk --remove-modules -n) to remove them without rebooting. - It works from a plain
adb shellwithout root: Magisk's daemon accepts this request only from root or from the ADB shell user. - It needs Magisk's daemon to be running, which means the boot has to get at least as far as Magisk's startup.
wait-for-devicemakes adb wait until the phone appears.
The modules are gone, not disabled. Reinstall the ones you need one at a time to find the one that caused the loop. The module catalog lists which popular modules are still maintained.
Safe Mode with the Volume Down key
Without USB debugging, use the key combination. Magisk looks for a Volume Down press earlier than Android does, and its code requires the key to be held for more than three seconds while it checks. Many online Safe Mode instructions press too late for Magisk. Magisk's FAQ describes three outcomes:
- Press Volume Down a few seconds before the boot animation and release it as soon as the animation appears. Magisk's Safe Mode should activate without Android's, and the phone boots normally with modules disabled. This is the one you want.
- Press early and hold until the system boots: both Safe Modes activate. After you reboot back to normal, modules stay disabled.
- Press only once the animation is showing: Android's Safe Mode can activate without Magisk's, and the modules still run.
Then open the Magisk app, remove or update the bad module, re-enable the others, and turn Zygisk back on.
Bootloop right after flashing the patched image
Here the problem is the image, not a module, so Safe Mode and --remove-modules can't help. The usual causes:
- The image came from a different build or region than the one installed.
- The image was patched on another phone. Magisk's install guide says to always patch on the same device you install on.
- It went to the wrong partition, for example
bootwhen the phone needsinit_boot(most phones that launched with Android 13 or later). See patching the right image.
To recover on any phone except Samsung:
- Boot into the bootloader (fastboot mode). On most phones, hold Power and Volume Down from power off, or run
adb reboot bootloaderif the phone still responds to adb. - Flash the unmodified image from the same firmware back to the partition you flashed, then reboot:
- Once the phone boots, get the firmware for the exact build shown in Settings → About phone, patch the correct image on this phone, and try again. The install guide walks through each step.
Samsung phones
Magisk's installation guide says never to restore only the boot, init_boot, recovery or vbmeta partition to stock on Samsung phones: it can brick the device, and the only way back is a full firmware restore with a data wipe. Recover by flashing the complete stock firmware for your model. See the Samsung recovery steps.
A module bootloop on Samsung is different: automatic Safe Mode and magisk --remove-modules work the same way as on other phones, so try those first.
Bootloop after a system update
On phones with A/B partitions, Android's update design protects you: if the updated slot fails to boot, the bootloader marks it unbootable and falls back to the previous slot, which keeps working (Android Open Source Project documentation). So first, let the phone try a few times.
- The new build boots but loops later in startup: a module may not support the new Android version. Use automatic Safe Mode or remove modules over ADB.
- The new build won't start at all: flash the stock
init_bootorbootimage of the new build with fastboot, as in the section above. Then re-root by patching that same image.
To keep root through future updates without a bootloop, follow the update guide (on A/B phones: restore images, install the update, then Install to Inactive Slot (After OTA)).
Bootloop after turning on Zygisk
Zygisk runs inside zygote, the process that starts every app, so a broken Zygisk module can crash zygote and leave the phone stuck on the boot animation. Magisk has two safety nets: if zygote crashes more than three times, Magisk rolls back its Zygisk loader for the rest of that boot, and automatic Safe Mode switches the Zygisk setting off. If you also run a standalone Zygisk (Zygisk Next, ReZygisk or NeoZygisk), make sure Magisk's built-in Zygisk is off, because they conflict. More in what Zygisk is.
Questions people ask
Will these fixes delete my photos and apps?
No, except the last resorts. Removing modules, Safe Mode and flashing a single stock boot or init_boot image leave user data alone. Flashing complete stock firmware usually wipes the phone, and on Samsung the documented recovery from a bad partition restore is a full firmware flash with a data wipe.
Can I fix a Magisk bootloop without a computer?
Often, yes. Magisk's automatic Safe Mode needs no computer: if the phone fails to finish booting twice in a row, the next boot disables all modules and Zygisk. The Volume Down key timing also works without a computer. You need a computer only for adb or fastboot, which is what a bad patched image requires.
My phone booted, but every module is disabled and Zygisk is off. Why?
That is Magisk's Safe Mode doing its job. It created a disable file in every module folder and turned the Zygisk setting off, and both stay that way until you change them. Remove or update the module that caused the loop (usually the last one you installed or updated), re-enable the others one by one, and turn Zygisk back on in the Magisk app's settings.
The phone booted into Android's Safe Mode, but the modules still ran. What happened?
You pressed Volume Down too late. Magisk checks the key earlier than Android does, so a press that starts during the boot animation can trigger Android's Safe Mode only. Reboot and press Volume Down a few seconds before the boot animation appears instead. See the key timing.
Can I disable just one module instead of removing all of them?
Yes, if you can reach a root shell. A module is skipped at boot when its folder contains a file named disable, so su -c touch /data/adb/modules/MODULE_ID/disable turns off one module. From adb shell that needs the Shell to have root access; since v31.1 you have to grant it ahead of time in the Superuser tab, because there are no root prompts. Without root, magisk --remove-modules is the only option and it removes every module.
Still stuck?
- Flashing the complete stock firmware for your model, with your manufacturer's tool, returns the phone to stock. It usually wipes data. Your brand's page has the details: device guides.
- To remove Magisk completely once the phone boots, see how to uninstall Magisk.
- Prevention for next time: keep USB debugging on with the computer approved, and keep the stock image for the build you are running.
Sources
This page is written from the sources below. If anything here disagrees with them, the upstream source is correct.
- Magisk FAQ: module bootloops and Safe Mode (topjohnwu, v31.1)
- Magisk source: boot counter and Safe Mode trigger, bootstages.rs (topjohnwu)
- Magisk source: Volume Down key check, utils.cpp (topjohnwu)
- Magisk source: --remove-modules allowed for root and ADB shell, daemon.rs (topjohnwu)
- Magisk source: magisk command usage, magisk.rs (topjohnwu)
- Magisk source: Zygisk rollback after repeated zygote crashes, zygisk/daemon.rs (topjohnwu)
- Magisk installation guide: Samsung important notes (topjohnwu)
- Magisk changelog: Safe Mode detection (v21.0) (topjohnwu)
- A/B system updates: failure to boot (Android Open Source Project)
Found a mistake or something out of date? Tell us and we will check it against the source and fix the page. Confirmed corrections are listed in the corrections log.
Report a problem with this page