magisk


title: magiskdate: 2019-12-15 11:10:15

tags: android

magisk

Magisk manager is a magic mask to alter system systemless-ly.

Installing Magisk will give you ROOT, a super powerful Systemless Interface,

Magisk Modules support, and hide from tons of integrity tests like SafetyNet!

What is Magisk?

Magisk is a great open-source root solution for Android devices which is developed by topjohnwu[https://forum.xda-developers.com/member.php?u=4470081], offering a “Systemless Interface”, allowing easy modification of your favourite device with peace of mind. Magisk is a module based application, so its configuration can be as individual as the member applying them. Many modules exist for Magisk, providing all sorts of modifications, such as cloaking your device from SafetyNet.

Highlights

Open Source:

100% open source and easy to build on all Google supported platforms.

Magic Mount:

Modify system (vendor) without tampering the partitions.

MagiskSU:

Unleash your device’s root access.

MagiskHide:

Hide Magisk from detections: Google SafetyNet, enterprise / bank system integrity checks, game tamper checks.

Resetprop:

Modify or delete any system properties, including read-only props.

Magisk Modules:

Install Magisk Modules from the community driven Magisk Module Repo.Many custom modules for Magisk,like Fonts,Audio Mod,DNS.

What is Magisk Manager?

Magisk Manager is the application same as SuperSU which is pre-installed on your device after you have rooted your Android device. If you want to use the magisk manager you can unroot your device and then root it with the help flashing Magisk-v20.zip or else you can install the magisk manager application and do the system less rooting on your device.

There are many questions raised, and people has a query that is How to root with magisk? The rooting procedure is simple, and you need a custom recovery installed on your device. If you have the custom recovery, then you can root your Android device by flashing the Magisk-v20.zip file.

Magisk and superSu

If you root your device with the help of magisk, then the magisk won’t do any changes in your system files. Magisk will modify the boot.img to magisk.img. Magisk won’t add any files in your system files.

When SuperSU roots your device, it will do the changes in the System files and also adds some files in the system partition. If you install SuperSU, you won’t be getting any OTA updates or any financial application won’t work on your device.

guide

Before Installing Magisk,you must Unlocking Bootloader.

Download Magisk Zip and Magisk Manager APK

You can usually download Magisk from the original development thread at XDA. But it only provides Magisk download link for the latest version. However, sometimes, the latest version isn’t the best version for you. For instance, a newer version of Magisk may not be able to hide from an app like Google Pay which is actually known to run into problems despite using MagiskHide.

Using an older version of Magisk that you know works for you might be a temporary solution until it’s fixed. In that case, though, you’re out of luck. But not anymore. You can download all Magisk versions from below. The list below is comprehensive and contains all Magisk versions since it was released publicly.

Below, you will find oldest to the latest version of Magisk zip for Android Nougat, Oreo, and Pie and download them directly from the Magisk Github repository. Just click the direct Magisk download links below. Moreover, we’ve also listed the compatible version of Magisk Manager and Magisk Uninstaller for each Magisk release. You can use Magisk Uninstaller zip file to remove Magisk from your Android device.

How to install Magisk?

If you don’t have a Android device with a TWRP recovery,you can refer to Plan A.But I suggest you install it,it’s very userful.

If you have a Android device with a TWRP recovery,you can refer to Plan B.

If you are using a Huawei device running EMUI 8 and higher, please check its section.

If you are using a Samsung device that is launched with Android 9.0 (new devices in 2019), please check its section.

Plan A

  1. Download Magisk Manager on your Android device.
  2. Install the application, and you might get an unknown source warning. You need to turn on Unknown Sources to turn it on, click on “Settings”.
  3. Now, try to repeat the installation process again. Try installing the application and open it.
  4. If you have already installed the Chainfire SuperSU on your device, then you need to grant the root permission.
  5. Now, click on the Install button to install the magisk on your device.
  6. If you will click on Install button you will see that it will ask you to select method.
  7. Just click on Direct Install if you want to directly install the file on your phone without using custom recovery on your phone, or you can click on Download Zip File Only.
  8. Now, if the download is the done. Magisk Manager will automatically install the file on your phone.

Plan B

  1. Download the Magisk zip file.
  2. Place the zip file in your internal storage. Make sure that you remember the proper location of the zip file.
  3. Reboot your phone into recovery ensure that you have a custom recovery such as TWRP is installed on your phone.
  4. Now, click on the Install button in the TWRP recovery.
  5. Navigate the Magisk-v20.zip on your internal storage or SD card.
  6. Now, install the zip file on your device and wait till it is getting installed on your device.
  7. You have successfully flashed the Magisk-v20.zip on your device.
  8. Reboot your phone and see if it works on your device.
  9. Download the magisk manager application from the link given above.
  10. Install the application by following the above procedure.
  11. Open it and then you will see magisk is installed on your Android device.

How to use Magisk Hide?

Magisk Hide is the feature which is available in the Magisk Manager application and if you want to hide the root permission for the particular banking application.

You can turn the Magisk hide option from the settings of the magisk application then you can easily enjoy your favorite app without any issues.

If you want to activate the Magisk Hide option, then you can follow the below tutorial, and you can hide the root permission on your device.

  1. First, check the application which is not working on your rooted Android device.
  2. Open Magisk on your device and click on the Menu button.
  3. Now, Click on the Settings to turn on the magisk hide option.
  4. Now, scroll down and enable the Magisk Hide option.
  5. Press the Menu key again and click on the “Magisk Hide” option.
  6. Now, you need to select the application from which you need to hide the root.
  7. Open your banking application and then that’s it. You can run the banking application on your device now.

Huawei

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. Depending on what EMUI version your device is running, the instructions will be slightly different.

Obtain Stock Images

Huawei does not release official factory images, however most firmware zips can be downloaded from the Huawei Firmware Database. To extract images from UPDATE.APP in the zip, you have to use Huawei Update Extractor (Windows only!)

EMUI 8

For EMUI 8 devices, your device has a partition named ramdisk, which is where Magisk is going to be installed.

If you plan to use custom recoveries, simply follow the instructions for custom recovery and you’re all set.

If you plan not to use custom recoveries, you will have to extract RAMDISK.img from your firmware. Follow the instructions for boot image patching above, but use the RAMDISK.img file instead of a boot image.

To flash the patched image to your device, here is the fastboot command:

fastboot flash ramdisk /path/to/magisk_patched.img

Be aware you are flashing to ramdisk, not boot!

EMUI 9 or Higher

For EMUI 9+ devices, the ramdisk partition no longer exists. As a workaround, Magisk will be installed to the recovery_ramdisk partition. Please read the Magisk in Recovery section before following the instructions below!

Note: As I tested on my Honor View 10, Huawei’s kernel does not seem to be able to capture key button press events in early boot, so long pressing Volume Up does NOT boot to recovery on my device. Your experience may vary.

If you plan to use custom recoveries, simply follow the instructions for custom recovery and you’re all set.

Warning: Magisk will overwrite the custom recovery.

If you plan not to use custom recoveries, you will have to extract RECOVERY_RAMDIS.img from your firmware. Follow the instructions for boot image patching above, but use the RECOVERY_RAMDIS.img file instead of a boot image.

To flash the patched image to your device, here is the fastboot command:

fastboot flash recovery_ramdisk /path/to/magisk_patched.img

Be aware you are flashing to recovery_ramdisk, not boot!

Samsung (System-as-root)

If your device is NOT launched with Android 9.0 or higher (released after 2019), you are reading the wrong section.

Before Installing Magisk

Your device is non-A/B and uses system-as-root, so Magisk will be installed to the recovery partition of your device. Please read the Magisk in Recovery section!

Installing Magisk WILL trip KNOX

Installing Magisk for the first time REQUIRES a full data wipe, backup before continue

You have to have your bootloader unlocked before following the instructions

Unlocking Bootloader

Normally I wouldn’t provide instructions for this, but since things had changed drastically from previous Samsung devices, and there are some caveats, I figure this would be helpful.

Allow bootloader unlocking in Developer options → OEM unlocking

Reboot your device to download mode. Either use adb reboot download, or use the key combo for your device.

Long press volume up to unlock the bootloader. This will wipe your data and automatically reboot.

Just when you think the bootloader is unlocked, it is actually not! Samsung introduced VaultKeeper, meaning the bootloader will reject any unofficial partitions before VaultKeeper explicitly allows it.

Go through the initial setup. Skip through all the steps since data will be wiped again later when we are installing Magisk. Connect the device to internet in the setup!

Enable developer options, and confirm that the OEM unlocking option exists and grayed out! The VaultKeeper service will unleash the bootloader after it confirms that the user has the OEM unlocking option enabled.

Your bootloader now accepts unofficial images in download mode.

Instructions

Download the firmware for your device.

Unzip the firmware and copy the AP tar file to your device. It is normally named as AP_[device_model_sw_ver].tar.md5

Install the latest Magisk Manager

In Magisk Manager: Install → Install → Select and Patch a File and select the AP tar file.

Magisk Manager will patch the whole firmware file and store the output to [Internal Storage]/Download/magisk_patched.tar

Copy the patched file to your PC with adb pull /sdcard/Download/magisk_patched.tar. Do not use MTP as it is reported to corrupt files.

Reboot to download mode, and flash magisk_patched.tar as AP in Odin, together with the BL, CP and HOME_CSC files. Never flash only an AP file, as Odin can shrink your /data file-system if you do.

Important: Uncheck “Auto Reboot” in Options!

Magisk is now successfully flashed to your device! But there are still several steps before you can properly use the device.

We now want to boot into the stock recovery to factory reset our device.

Full data wipe is mandatory! Do not skip this step.

Press Power + Volume Down to exit download mode. As soon as the screen turns off, immediately press the combo key to boot to recovery (e.g. on the S10 it is Power + Bixby + Volume Up). Since we want to boot into stock recovery, continue pressing the volume up button until you see the stock recovery screen.

Use volume buttons to navigate through the stock recovery menu, and the power button to select an option. Choose Wipe data/factory reset to wipe the data of the device.

This time, we can finally boot to the system with Magisk. Select Reboot system now, and immediately press the combo key to recovery. After seeing the bootloader warning screen, release all buttons so it can boot to the system.

The device will automatically reboot for the first time it boots. This is completely normal and done by design.

After the device is booted up, do the usual initial setup. The following steps will need an internet connection.

You shall see Magisk Manager in your app drawer; if not, manually install the APK you downloaded in step 3 and continue to the next step. The app would be a stub and it shall automatically upgrade to the full Magisk Manager when you open it.

Magisk Manager will ask to do additional setups. Let it do its job and the app will automatically reboot your device.

Voila! Enjoy Magisk :)

Additional Info

Magisk actually patches 3 partitions on your device:

vbmeta: replace with empty vbmeta image to disable partition verification

boot: remove the signature of the image to prevent soft bricks

recovery: this is where Magisk is actually installed

Never, ever try to restore either of the 3 images mentioned back to stock! You can easily brick your device by doing so, and the only way out is to do full Odin restore following with factory reset. Just don’t do it.

If you want to upgrade your device, never flash the stock AP tar file with the reasons mentioned above. Always pre-patch the firmware before flashing in Odin.

If you don’t need to patch the full firmware, you can manually create a tar file with at least vbmeta.img, boot.img, and recovery.img to let Magisk Manager patch your images in the proper way.

Magisk Modules