Skip to content
dedsecproyt edited this page Dec 25, 2022 · 1 revision

This instruction is up-to-date with initrd-magisk v1.8+

Magisk will stat all partitions to get st_dev for setup mirror directory. There is a problem if your /data or /system is a bind mount from linux driver, Magisk will wrongly mount entire your driver disk.

Official Magisk will accidently handle this problem but this fix has not merged, you have to use Magisk Delta for now because Magisk Delta already has this fix.

Installation

  1. In Android-x86 directory, rename initrd.img to initrd_real.img and put initrd-magisk as initrd.img.

    Or put initrd-magisk.img into Android-x86 directory. Search for kernel cmdline initrd /$SOURCE_NAME/initrd.img in GRUB custom code and change it to initrd /$SOURCE_NAME/initrd-magisk.img

  2. Put boot-magisk.img into Android-x86 directory

  3. Boot into Android x86, install and open Magisk app. Enjoy ~~

  4. Follow this guide to remove built-in root

In Android x86 directory will be like this:

- ...
- boot-magisk.img ← Boot image will be loaded by initrd-magisk
- data.img or data folder ← userdata will be stored inside this
- findme
- initrd.img (initrd-magisk.img) ←initial ramdisk will be loaded by kernel
- initrd_real.img (initrd.img) ← Original initrd image will be loaded by initrd-magisk
- install.img
- kernel
- ramdisk.img ← exist if using rootfs method for Android root directory
- system.img ← Android system files are stored inside this image
- ...

Update Magisk

  • Update Magisk app and do Direct Install.

Uninstall

There way to remove Magisk from system:

  • From Magisk app: Open Magisk app and do Uninstall MagiskComplete uninstall (remove all magisk and its modules) or Restore boot image (remove magisk only).

  • Reset boot image: Remove boot-magisk.img, the next boot initrd-magisk will create new boot image.

  • Remove initrd-magisk

Important

  • If you have rusty-magisk installed, initrd-magisk will try to invalidate it. It's RECOMMENDED to remove it and do not use it.
  • If you update Android-x86 OTA, it might wipe out initrd.img so you might need to do again.

Remove built-in SU

  • Method 1
  1. Boot Android-x86 project with initrd-magisk and DEBUG=1 flag. If you have GearLock, you can boot into Recovery Mode and open Virtual Terminal Command.
  2. When root shell is showed up, type unsu command and press Enter to remove root.
  3. Type freboot to restart the system.
  • Method 2

Run these command in root shell (live Android system):

mount -o rw,remount $(magisk --path)/.magisk/mirror/system

mount -o rw,remount $(magisk --path)/.magisk/mirror/system_root

rm -rf $(magisk --path)/.magisk/mirror/system_root/system/*bin/su $(magisk --path)/.magisk/mirror/system/*bin/su
  • KernelSU

Although KernelSU doesn't conflict with Magisk, it will execute real SU if it exists in PATH, you can get RIP of KernelSU by using another kernel.

Clone this wiki locally