[Xiaomi Mi 9 Guides, News, & Discussion] fanfan7110:
This simple and effective procedure was first proposed by "Serbinhio" in beta version. I am only improving it slightly and adding my own additional procedure for updating a previously rooted system. I allow myself to redo a new post because the original one was not complete and there are no more answers to our requests.

I remind that this way makes it possible to change nothing to the recovery and thus to keep the original encrypted DATA partition. This brings a cleaner ROM than flashing TWRP but also easier and faster.

Note : As usual, you are solely responsible for attempting to root your smartphone. I am in no way responsible for a possible brick of your MI9.

Note : This tutorial is for Global version, i don't know if it work in Chinese version with same result.

Note : For a successful flashing, read the whole procedure before starting.

Note : A solution has been found for Chinese versions. See at the end of this post

Let's go there

The files to download:

Magisk manager: Link Here

Depending of you actual system :

- Full ROM 10.2.17 Link Here

- original Boot.img from 10.2.17 : Link 10.2.17.0

- Full ROM 10.2.22 Link Here

- You can use the download folder with all boot rom (actually up to 10.2.28) by Tramix32 : Link here

- Full ROM 10.2.30 Link Here

The procedure :

Install ADB into the PC (Search into xda how to do that)

Pass the MI 9 in developer mode

Enable USB Debugging

(Of course the MI9 must have the bootloader unlocked)

Download the current ROM of your MI9 (10.2.17 to 10.2.28)

Create a folder on the PC and unzip the rom in it

Connect the MI9 to the PC with the USB cable

In the folder where you put the ROM, copy the file named BOOT.IMG and transfer it to the root of the MI9

Install Magisk Manager in the MI9

Into Magisk manager, go to setting and choose the channel « Beta »

Into Magisk manager, go to « Install magisk » and choose « patch boot image »

In the next window Go to the root of the MI9 and point to boot.img. Validate.

In The PC, navigate to the MI9 in the folder « Download » and Copy the file « magisk_patched.img » into the folder « ADB » of the PC.

Delete the file into the MI9, we do not need it anymore

On the pc, open a CMD window. With command line, go to the adb folder (ex: cd /adb)

Type « Adb devices »

You must have in response the ID of the mi9 that appears. If this is not the case, validate the debugging mode on your MI9 screen by ticking the box "Always allow for this device"

Type « adb reboot bootloader »

(Mi9 restart in fastboot mode)

Type « fastboot flash boot magisk_patched.img »

After the flash, type « fastboot reboot » or press the on / off button for several seconds to restart

Wait the Mi9 to reboot and .. rooted !

Now Here is the tutorial to update an MI9 rooted by this method :

First, download the full ROM of the update concerned. For exemple, the 10.2.22 ROM is here or download the new boot.img of the new version of rom in the tramix32 directory.

Inthe MI9, Launch the update program and validate. The Mi9 reboot and an error is displayed announcing that the update has failed. The Mi9 reboot.

Restart the update utility. This time, utility launches a full update that will be done normally and without error.

Once the update is complete, go to the PC. In the folder where you put the ROM, copy the file named BOOT.IMG and transfer it to the root of the MI9

Into Magisk manager, go to setting and choose the channel « Beta »

Into Magisk manager, go to « Install magisk » and choose « patch boot image »

In the next window Go to the root of the MI9 and point to boot.img. Validate.

In The PC, navigate to the MI9 in the folder « Download » and Copy the file « magisk_patched.img » into the folder « ADB » of the PC.

On the pc, open a CMD window. With command line, go to the adb folder (ex: cd /adb)

Type « Adb devices »

Type « adb reboot bootloader »

(Mi9 restart in fastboot mode)

Type « fastboot flash boot magisk_patched.img »

After the flash, type « fastboot reboot » or press the on / off button for several seconds to restart

Wait the Mi9 to reboot and .. Update is rooted !

Enjoy !

--------------------------------

FOR CHINESES VERSIONS (edited the 2019-05-30)

--------------------------------

To avoid having a message request to install a Zip after installing Magisk, cutesniper22 found this solution:

1. install clean global rom as normal,

2. flash magisk boot img as previously mentioned on this post

3. U will be asked for click on "requires additional setup". Please ignore the pop-up & close magisk manager.

4. Install a root browser with root access. Look this file and edit it : /system/vendor/etc/fstab.qcom

5. look this string "fileencryption=ice" and remove & save it.

6. Reboot. (U will stuck again into recovery once u reboot, dont worry...)

7. Perform full wipe at mi recovery.

8. Reboot & Done. Start your setup & app installation as usual. Your phone & magisk is ready.

(a click on the thanks button is always a pleasure, so do not hesitate!)