In this guide, we will show you the steps to root your Xiaomi device running MIUI 13 based on Android 12 via Magisk. The latest iteration of MIUI has bought in quite a few new and noteworthy features to the fore. The redesigned user interface, coherent widgets, enhanced privacy, Liquid Storage, and a new sidebar are just some of the eye-catchy functionalities.
While these are no doubt quite appreciatable, but for the tech enthusiasts, it might still not be enough to checkmark all the prerequisites. And we can’t blame them either! Once you unlock the device’s bootloader and step into custom development, there is literally a plentitude of tweaks to try out. From flashing custom ROMs to installing a custom recovery, the possibilities stand endless.
Likewise, you could also gain administrative privileges by rooting your device. This will then allow you to flash a truckload of tweaks and mods and even custom kernels. Owing to all these benefits, it’s no hidden secret why users are looking to root their Xiaomi device running MIUI 13 based Android 12 via Magisk. if you are also on the same page, then this tutorial shall help you out. Follow along.
Table of Contents
Benefits and Risks of Rooting
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 likes. However, this is just one side of the story.
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], which might cause issues with banking apps [FIXED]. So if all that’s well and good, then let’s get started with the steps to root your Xiaomi device running MIUI 13 based on Android 12 via Magisk.
How to Root Xiaomi MIUI 13 based on Android 12 via Magisk
The below instructions are listed under separate sections for ease of understanding. Make sure to follow in the exact 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
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 to root your Xiaomi device running MIUI 13 based on Android 12 via Magisk.
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.
So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging and OEM Unlocking.
STEP 3: Unlock Xiaomi Device Bootloader
Since this is an unofficial ROM (a custom ROM to be precise), 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 Xiaomi device running MIUI 13 based on Android 12 via Magisk.
STEP 4: Download Xiaomi MIUI 13 (Android 12) Fastboot ROM
Next up, you will have to download the Fastboot ROM for your Xiaomi 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 XiamiFirmwareUpdate (if the official website is blocked in your region).
STEP 5: Get Xiaomi MIUI 13 Android 12 Stock Boot.img
- Once you have downloaded the firmware, extract it to any convenient location on your PC.
- Then go to the Images folder and copy the boot.img file from there.
- Now transfer this boot.img file to your device.
STEP 6: Patch Xiaomi MIUI 13 (Android 12) Boot.img via Magisk
- First off, install the Magisk App [version24+ is recommended] on your device.
- Then launch it and tap on the Install button situated next to Magisk.
- From the Method section, choose Select and Patch a file.
- Browse to the extracted boot.img file and select it.
- Then tap on the Let’s Go option situated at the top right.
- Magisk will now load the boot.img file and will patch it accordingly.
- Once that is done, you would get the Download Complete message.
- The patched boot image file will be saved in Internal Storage > Downloads. Transfer this file to the platform-tools folder on your PC and rename it to magisk_boot.img.
STEP 7: Boot Xiaomi Device to Fastboot Mode
- Connect your device to the PC via USB cable. Make sure USB Debugging is enabled.
- Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
- Type in the following command in the CMD window to boot your device to Fastboot Mode
adb reboot bootloader
- Now type in the below command to verify the Fastboot Connection
fastboot devices
- If you get a device ID followed by the fastboot keyword, then the connection stands successful. You may now proceed to the next step to root your Xiaomi device running MIUI 13 based on Android 12 via Magisk.
STEP 8: Flash Magisk Patched Boot | Root Xiaomi MIUI 13 Android 12
- To begin with, make sure that the patched boot (magisk_boot.img) is present inside the platform-tools folder.
- Then open the CMD window inside this platform-tools folder.
- Now type in the below command to flash the patched boot.img file and permanently root your device (if you want a temporary root, then please check FAQ 1):
fastboot flash boot magisk_boot.img
- Once that is done, you may now reboot your device to the OS via the below command (Stuck in Bootloop? See FAQ 2):
fastboot reboot
That’s it. These were the steps to root your Xiaomi device running MIUI 13 based on Android 12 via Magisk. If you have any queries concerning the aforementioned steps, do let us know in the comments section. We will get back to you with a solution at the earliest.
FAQ 1: How to Temporary Root my Xiaomi device running MIUI 13 Android 12
Many users first prefer to have a temporary root, check if everything is working well and good, and then proceed to permanently root their device. For example, if you wish to verify if the patched boot.img will work correctly or not, then you may opt for this method. Apart from that, some users just wish to test a particular mod for a short time, and for them, the temporary root is more than enough. If you are also on the same page and wish to temporary root your Xiaomi device running MIUI 13 Android 12 via Magisk, then refer to the below steps:
- To begin with, carry out everything that has been listed till STEP 7 above.
- Then, transfer the magisk_boot.img to the platform-tools folder.
- After that, open CMD inside this folder and type in the below command to temporary boot your device via Magisk patched file:
fastboot boot magisk_boot.img
- Your device will be booted to the rooted OS. Now if you wish to unroot it, then just reboot your device, the root will be removed.
- On the other hand, if you want to make this root permanent, then launch Magisk and tap on Install.
- After that, select Direct Install (Recommended) and wait for the process to finish.
- Once done, hit the Reboot button situated at the bottom right. That’s it.
- Your Xiaomi device running MIUI 13 Android 12 is now permanently rooted via Magisk
FAQ 2: Fix Xiaomi Stuck in Bootloop after Flashing Magisk Patched Boot.img
If your device is stuck in bootloop, then you might have to disable the verity checks by flashing the vbmeta file. Here’s how it could be done:
- First off, extract the vbmeta.img file from the Fastboot ROM that you had downloaded.
- Then transfer this vbmeta file to the platform-tools folder and launch the CMD window inside this folder:
- After that, connect your device to the PC and boot it to Fastboot Mode.
- Now execute the below command to flash vbmeta and disable the verification:
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
- Once that is done, you may proceed with the rest of the rooting steps (see STEP 8).
If you are still unable to fix the bootloop issue, then flash the stock boot.img file from the Fastboot ROM to permanently remove the root [use the below command for that]. After that, you should opt for the method to root your device via the TWRP Recovery.
fastboot flash boot boot.img
So with this, we conclude this section. If you have any queries regarding how to root your Xiaomi device running MIUI 13 based on Android 12 via Magisk, then do let us know in the comments section below.