Installation - Magisk
Installation - Magisk
Installation
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.
Getting Started
This tutorial assumes you understand how to use adb and fastboot
Download and install the latest Magisk app. In the home screen, you should see:
The result of Ramdisk determines whether your device has ramdisk in the boot partition. If your
device does not have boot ramdisk, read the Magisk in Recovery section before continuing.
(Unfortunately, there are exceptions as some devices’ bootloader accepts ramdisk even if it
shouldn’t. In this case, you will have to follow the instructions as if your device’s boot partition
does include ramdisk. There is no way to detect this, so the only way to know for sure is to
actually try. Fortunately, as far as we know, only some Xiaomi devices are known to have this
property, so most people can simply ignore this piece of information.)
If you are using a Samsung device that is launched with Android 9.0 or higher, you can now jump
to its own section.
If your device has boot ramdisk, get a copy of the boot.img (or init_boot.img if exists).
If your device does NOT have boot ramdisk, get a copy of the recovery.img .
You should be able to extract the file you need from official firmware packages or your custom
ROM zip.
Next, we need to know whether your device has a separate vbmeta partition.
If your official firmware package contains vbmeta.img , then yes, your device has a separate
vbmeta partition
You can also check by connecting your device to a PC and run the command:
adb shell ls -l /dev/block/by-name
If you find vbmeta , vbmeta_a , or vbmeta_b , then yes, your device has a separate vbmeta
partition
Otherwise, your device does not have a separate vbmeta partition.
Quick recap, at this point, you should have known and prepared:
Patching Images
(Optional) If your device has a separate vbmeta partition, you can patch the vbmeta
partition with command:
fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img
Uninstallation
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.
Magisk in Recovery
In the case when your device does not have ramdisk in boot images, Magisk has no choice but to
hijack the recovery partition. For these devices, you will have to reboot to recovery every time
you want Magisk enabled.
When Magisk hijacks the recovery, there is a special mechanism to allow you to actually boot
into recovery mode. Each device model has its own key combo to boot into recovery, as an
example for Galaxy S10 it is (Power + Bixby + Volume Up). A quick search online should easily
get you this info. As soon as you press the key combo and the device vibrates with a splash
screen, release all buttons to boot into Magisk. If you decide to boot into the actual recovery
mode, long press volume up until you see the recovery screen.
(Note: You CANNOT use custom recoveries to install or upgrade Magisk in this case!!)
Samsung (System-as-root)
If your Samsung device is NOT launched with Android 9.0 or higher, you are reading the
wrong section.
Before Installing Magisk
Unlocking Bootloader
Unlocking the bootloader on modern Samsung devices have some caveats. The newly
introduced VaultKeeper service will make the bootloader reject any unofficial partitions in
some circumstances.
Instructions
Use either samfirm.js, Frija, or Samloader to download the latest firmware zip of your device
directly from Samsung servers.
Unzip the firmware and copy the AP tar file to your device. It is normally named as
AP_[device_model_sw_ver].tar.md5
Upgrading the OS
Once you have rooted your Samsung device, you can no longer upgrade your Android OS through
OTA. To upgrade your device’s OS, you have to manually download the new firmware zip file and
go through the same AP patching process written in the previous section. The only difference
here is in the Odin flashing step: do NOT use the CSC tar, but instead use the HOME_CSC tar as
we are performing an upgrade, not the initial install.
Important Notes
Never, ever try to restore either boot , recovery , or vbmeta partitions back to stock! You
can brick your device by doing so, and the only way to recover from this is to do a full Odin
restore with data wipe.
To upgrade your device with a new firmware, NEVER directly use the stock AP tar file with
reasons mentioned above. Always patch AP in the Magisk app and use that instead.
Never just flash only AP , or else Odin may shrink your /data filesystem size. Flash AP +
BL + CP + HOME_CSC when upgrading.
Custom Recovery
This installation method is deprecated and is maintained with minimum effort. YOU HAVE
BEEN WARNED!
Installing using custom recoveries is only possible if your device has boot ramdisk. Installing
Magisk through custom recoveries on modern devices is no longer recommended. If you face
any issues, please use the proper Patch Image method.
Warning: the sepolicy.rule file of modules may be stored in the cache partition. DO
NOT WIPE THE CACHE PARTITION.