Magisk

Installation

If you already have Magisk installed, it is strongly recommended to upgrade directly via Magisk Manager using the “Direct Install” method. The following tutorial is only for initial installation.

Getting Started

Before you start:


Download and install the latest Magisk Manager. 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, and unfortunately you would have to go through some hoops 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.

(P.S.1 If your device have boot ramdisk, you can also install with Custom Recovery)
(P.S.2 If you are interested in how Android boots and how it affects Magisk, check out this document)

Patching Images

If your device have boot ramdisk, you need a copy of the boot.img
If your device does NOT have boot ramdisk, you need a copy of the recovery.img

You should be able to extract either of them from official firmware packages, your custom ROM zip (if using one), or go to XDA-Developers and seek for resources, guides, discussions, or ask for help in your device’s forum.

Custom Recovery

In some custom recoveries of modern devices, the installer scripts either cannot properly detect the correct device info, or the recovery environment does not meet its expectation, causing the installation to fail (or looks like success but actually bootloops). If you face any issues, use the Patch Image method as it is guaranteed to work 100% of the time. Due to this reason, we no longer recommend installing Magisk through custom recoveries on modern devices. The custom recovery installation method exists mostly for legacy support.

Magisk in Recovery

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 Magisk Manager. The app 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 volume up.

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

Samsung (System-as-root)

If your device is NOT launched with Android 9.0 or higher, you are reading the wrong section.

Before Installing Magisk

Unlocking Bootloader

Unlocking BL on modern Samsung devices have some caveats, so I figure this would be helpful.

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.

Instructions

Additional Notes

Huawei

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 some general guidance for the few who managed to unlock their bootloader and really want to root it.

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: