Home > Root

How to Root HyperOS via Magisk [Video]

In this guide, we will show you the steps to root your Xiaomi device running the HyperOS via Magisk. The Chinese OEM recently left everyone stumped by ditching its in-house OS MIUI in favor of a new revamped HyperOS. Offering a new revamped UI/UX and tons of under-the-hood improvements, it beholds a plethora of tweaks under its arsenal.

If we talk about the tech enthusiasts, then gaining administrative privileges by rooting their device via Magisk has always been at the top of the priority queue for them. This in turn will allow you to welcome abode a slew of modules and custom binaries onto their device. So without further ado, let’s make you aware of the steps to root your device running HyperOS via Magisk.

Benefits and Risks of Rooting HyperOS

root xiaomi hyperos magisk

Once you root your device by flashing the Magisk patched boot.img via Fastboot Commands, you will be in a position to try out a plethora of customizations on your device. These include the likes of flashing custom ROMs, installing a custom recovery like TWRP, or flashing a custom kernel. Along the same lines, you could also flash Magisk Modules, Xposed Framework, Substratum Themes, Viper4Android, and the like. However, this is just one side of the story.

benefits and risks of rooting

Carrying out this process also has its downsides. First off, the process requires an unlocked bootloader. Doing so will wipe off all the data and could nullify the device’s warranty as well. Likewise, WideVine L1 will be degraded to L3, resulting in the inability to stream Netflix in HD [FIXED]. Then the SafetyNet will be triggered [FIXED] and Play Integrity will fail [FIXED] which might cause issues with banking apps [FIXED]. If that’s well and good, then let’s get started with the steps to root HyperOS via Magisk.

How to Root HyperOS via Magisk Patched Boot

The below instructions are listed under separate sections for ease of understanding. Make sure to follow the same sequence as mentioned. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.

STEP 1: Install Android SDK

install adb platform tools windows

First and foremost, you will have to install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform-tools folder, which will be used throughout this guide.

STEP 2: Enable USB Debugging and OEM Unlocking

Next up, you will also have to enable USB Debugging and OEM Unlocking on your device. The former will make your device recognizable by the PC in ADB mode. This will then allow you to boot your device to Fastboot Mode. On the other hand, OEM Unlocking is required to carry out the bootloader unlocking process.

Root HyperOS via Magisk

So head over to Settings > About Phone > Tap on MIUI Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging and OEM Unlocking.

STEP 3: Unlock Bootloader

Next up, you will need to unlock the device’s bootloader. However, doing so will wipe off all the data and could nullify the device’s warranty as well. So if that’s all well and good, then please refer to our guide on How to Unlock the Bootloader on any Xiaomi Device. Once that is done, you may move over to the next step to root your device running HyperOS via Magisk.

Root HyperOS via Magisk

STEP 4: Download HyperOS Fastboot ROM

Next up, you will have to download the Fastboot ROM variant of the HyperOS ROM for your device. Make sure to download the same version that is currently installed on your device (you could verify the same from your device’s Build Number). As far as the downloading source is concerned, you could get it from the official MIUI site or a third-party site like Xiaomi Firmware Updater.

STEP 5: Get HyperOS Stock Boot.img/Init Boot.img

The generic rule states that if a device is launched with Android 12 or older version, then you’ll have to use boot.img for rooting. On the other hand, if it is launched with Android 13 or higher version, then use the init_boot.img file. However, there are a few exceptions to this rule, such as with Poco F5, which even though was launched with Android 13, still uses the boot.img file. In such cases, those devices wouldn’t even have an init_boot.img file in their Fastboot ROM, so the element of confusion shouldn’t arise.

  1. First off, right-click on the Fastboot ROM TGZ file and select Extract All.Root HyperOS via Magisk
  2. You will now get all the extracted firmware files, with the partition files present in the Images folder.
    Root HyperOS via Magisk
  3. Now go to the Images folder, copy the boot.img/init_boot.img from there, and transfer it to your device.
    Root HyperOS via Magisk

STEP 6: Patch Boot.img/Init_Boot.img via Magisk

  1. Download and install the latest version of the Magisk App.
  2. Then launch it and tap on the Install button next to Magisk.
  3. After that, choose ‘Select and Patch a File’, navigate to the stock boot.img file, and select it.
    patch boot magisk
  4. Then tap on the Let’s Go button situated at the top right.
    magisk patch boot
  5. The boot.img/init_boot.img file will now be patched and placed under the Downloads folder on your device.
  6. You should transfer this file to the platform-tools folder on your PC.

STEP 7: Boot Device to Fastboot Mode

  1. Connect your device to the PC via USB cable. Make sure USB Debugging is enabled.
  2. Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
    command-prompt-inside-adb
  3. Type in the following command in the CMD window to boot your device to Fastboot Mode
    adb reboot bootloader

    root hyperos magisk

  4. Now type in the below command to verify the Fastboot Connection
    fastboot devices

    root xiaomi magisk

  5. If you are not getting any Serial ID, then please install the Fastboot Drivers on your PC.

STEP 8A: Root HyperOS via Magisk Patched Boot

  1. To begin with, make sure that the patched boot.img is present inside the platform-tools folder.root hyperos magisk
  2. Then open the CMD window inside this platform-tools folder.
  3. Now type in the below command to boot your device to the temporary rooted OS.
    fastboot boot magisk_patched_boot.img
  4. Now launch the Magisk app and tap on Install.
  5. Then select Direct Install and tap Let’s Go situated at the top-right.
    root hyperos magisk
  6. Once done, hit the Reboot button situated at the bottom right.
  7. That’s it, your device will now boot to the permanently rooted OS.

NOTE: There also exists a method to root your Xiaomi device by directly flashing the Magisk patched boot file. However, that is usually a risky approach and should be avoided. The above approach of first booting the patched file and then permanently flashing it via Direct Install of Magisk is the fail-safe method that you should opt for.

flash boot magisk

That’s it. These were the steps to root your HyperOS via Magisk patched boot.img. Let’s show you how that could be done via patched init_boot.

STEP 8B: Root HyperOS via Magisk Patched Init_Boot

  1. To begin with, make sure that the patched init_boot.img is present inside the platform-tools folder.magisk init patched
  2. Then open the CMD window inside this platform-tools folder.
  3. Now type in the below command to boot your device to the temporary rooted OS.
    fastboot flash init_boot patched_init_boot.img
  4. Finally, execute the below command to boot your device to the rooted OS:
    fastboot reboot

That’s it. These were the steps to root your HyperOS via Magisk patched init_boot.img. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.

FAQ 1: Fix HyperOS Stuck in Bootloop while rooting

  1. Go to the extracted Fastboot ROM, copy the boot.img/init_boot, and transfer it to the platform-tools folder.
  2. Then connect your device to the PC via a USB cable and boot it to Fastboot Mode.
  3. Now launch the CMD window inside the platform-tools folder
  4. Then execute the below command to flash the stock boot or init_boot file [depending on the file that you have used for rooting].
    fastboot flash boot boot.img
    fastboot flash init_boot init_boot.img
  5. Finally, type in the below command to boot your device to the OS.
    fastboot reboot

FAQ 2: Disabling DM Verity

If the aforementioned method didn’t spell out success, then you’ll have to disable the verity checks by flashing the vbmeta file which, in turn, should fix the bootloop issue. Here’s how it could be done:

    1. First off, extract the vbmeta.img file from the Fastboot ROM that you have downloaded.
      magisk init patched root
    2. Then transfer this vbmeta file to the platform-tools folder and launch the CMD window inside this folder:
    3. After that, connect your device to the PC and force-boot it to Fastboot Mode.
    4. Now execute the below command to flash vbmeta and disable the verification:
      fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
    5. Once that is done, you may proceed with the rest of the rooting steps.

Share:
  • Anonynmous

    I’ve followed the tutorial. I have to use Step 8B due to having a newer phone, but I got the following error in CMD:

    C:\Users\USER\Downloads\platform-tools_r35.0.0-windows\platform-tools>fastboot flash init_boot patched_init_boot.img
    Warning: skip copying init_boot image avb footer (init_boot partition size: 0, init_boot image size: 8388608).
    Sending ‘init_boot’ (8192 KB) OKAY [ 0.202s]
    Writing ‘init_boot’ FAILED (remote: ‘partition does not exist’)
    fastboot: error: Command failed

    C:\Users\USER\Downloads\platform-tools_r35.0.0-windows\platform-tools>fastboot reboot
    Rebooting OKAY [ 0.014s]
    Finished. Total time: 0.015s

    My Xiaomi 13T Pro has its bootloader unlocked, has the custom xiaomi.eu ROM installed, however runs a mediatek chip, and the rom functions as a fastboot version. The patched init_boot file has been tried multiple times renamed differently incase I just misspelt it, but the same error always comes up.

    • Sadique Hassan

      Could you patch the boot.img file via Magisk > rename it to patched_boot.img > place it inside the platform tools folder > then temporary boot to it via the below command > and let me the results:
      fastboot boot patched_boot.img

      If it works out, then launch the Magisk app and Direct Install to obtain permanent root, as explained in 8A. However, if you get stuck, then just do a normal restart once again [long press Power key for 10-15 seconds]. The patched boot will be repalced with the stock one and your device will boot to the OS.

      Let me know the result so that we may decide the next course of action. If the patched boot works ouyt, then your device falls in the rare device list [similar to Poco F5] which is still using the older boot instead of init_boot even though it came with Android 13 out of the box.