If you already have Magisk installed, it is strongly recommended to upgrade directly via the Magisk app using its “Direct Install” method. The following tutorial is only for the initial installation.
Before you start:
Download and install the latest Magisk app. We use the app to gather some information about your device. In the home screen, you should see this:
Pay special attention to the Ramdisk info. If the result is Yes, congratulations, your device is perfect for installing Magisk! However, if the result is No this means your device’s boot partition does NOT include ramdisk. This means you will have to go through some extra steps to make Magisk work properly.
If your device does not have boot ramdisk, read the Magisk in Recovery section after installing. The information in that section is VERY important!
If you are using a Samsung device and the SAR result is Yes, please check its own section.
If you are using a Huawei device and the SAR result is Yes, please check its own section.
Otherwise, continue to Patching Images.
If your device has boot ramdisk, you need a copy of the
If your device does NOT have boot ramdisk, you need a copy of the
You should be able to extract the file you need from official firmware packages or your custom ROM zip (if using one). If you are still having trouble, go to XDA-Developers and look for resources, guides, discussions, or ask for help in your device’s forum.
adb pull /sdcard/Download/magisk_patched_[random_strings].img
fastboot flash boot /path/to/magisk_patched.imgor
fastboot flash recovery /path/to/magisk_patched.imgif flashing a recovery image
In some custom recoveries, the installation may fail silently (it might look like success but in reality it bootloops). This is because the installer scripts cannot properly detect the correct device info or the recovery environment does not meet its expectation. If you face any issues, use the Patch Image method as it is guaranteed to work 100% of the time. Due to this reason, installing Magisk through custom recoveries on modern devices is no longer recommended. The custom recovery installation method exists purely for legacy support.
.apkfile extension to
.zip, for example:
Magisk-v22.0.zip. If you have trouble renaming the file extension (like on Windows), use a file manager on Android or the one included in TWRP to rename the file.
sepolicy.rulefile of modules may be stored in
cachepartition, do not clear it.
The easiest way to uninstall Magisk is directly through the Magisk app.
If you insist on using custom recoveries, rename the Magisk APK to
uninstall.zip and flash it like any other ordinary flashable zip.
If your device does not have ramdisk in boot images, Magisk has no choice but to be installed in the recovery partition. For these devices, you will have to reboot to recovery every time you want Magisk.
When Magisk is installed in your recovery, you CANNOT use custom recoveries to install/upgrade Magisk! The only way to install/upgrade Magisk is through the Magisk app. It will be aware of your device state and install to the correct partition and reboot into the correct mode.
Since Magisk now hijacks the recovery of the device, there is a mechanism to let you actually boot into recovery mode when needed: it is determined by how long you press the recovery key combo.
Each device has its own key combo to boot into recovery, as an example for Galaxy S10 it is (Power + Bixby + Volume Up). A quick Google search should easily get you this info of your device. As soon as you press the combo and the device vibrates with a splash screen, release all buttons to boot into Magisk. If you decide to boot into actual recovery mode, continue to press volume up until you see the recovery screen.
After installing Magisk in recovery (starting from power off):
If your device is NOT launched with Android 9.0 or higher, you are reading the wrong section.
Unlocking bootloader on modern Samsung devices have some caveats:
If you think the bootloader is fully unlocked, it is actually not! Samsung introduced
VaultKeeper, meaning the bootloader will still reject any unofficial partitions before
VaultKeeper explicitly allows it.
VaultKeeperservice has unleashed the bootloader.
APtar file to your device. It is normally named as
adb pull /sdcard/Download/magisk_patched_[random_strings].tar
AP, together with
HOME_CSCbecause we want to wipe data) from the original firmware. This could take a while (>10 mins).
recoverypartitions back to stock! You can easily brick your device by doing so, and the only way out is to do a full Odin restore with data wipe.
APtar file with reasons mentioned above. Always pre-patch
APin the Magisk app before flashing in Odin.
HOME_CSCto preserve your data when doing a firmware upgrade in the future. Using
CSCis only necessary for the initial Magisk installation.
AP, or else Odin can shrink your
/datafilesystem. Flash full
Magisk no longer officially support modern Huawei devices as the bootloader on their devices are not unlockable, and more importantly they do not follow standard Android partitioning schemes. The following are just some general guidance.
Huawei devices using Kirin processors have a different partitioning method from most common devices. Magisk is usually installed to the
boot partition of the device, however Huawei devices do not have this partition.
Generally, follow Patching Images with some differences from the original instructions:
UPDATE.APPin the zip with Huawei Update Extractor (Windows only!)
RECOVERY_RAMDIS.img(this is not a typo) instead of
RAMDISK.img, flash with command
fastboot flash ramdisk magisk_patched.img
RECOVERY_RAMDIS.img, flash with command
fastboot flash recovery_ramdisk magisk_patched.img