How to reflash Xiaomi Mi9 through a computer: official and custom methods

Why do you need to re-flash Xiaomi Mi9 and what are the risks?

Flashing the Xiaomi Mi9 through a computer is a process that can solve many problems, from slow work to no updates. However, it is not just an update via OTA. The firmware from the PC gives access to custom builds (for example, LineageOS or Pixel Experience), allows you to bring the device back to life after a brick or remove unnecessary software from the manufacturer.

On the other hand, incorrect actions lead to loss of warranty, locking of the device or even physical damage to the board. For example, installing firmware from the Mi9 SE on a standard Mi9 (cepheus model) will lead to a broken camera module or sensors. So before you start, check the exact model in the settings (Settings β†’ Phone β†’ Model).

In this article, we will discuss both versions of the firmware: official (via Mi Flash Tool) and custom (via TWRP).

Preparation for firmware: what to do before the start

Before you connect the Xiaomi Mi9 to your PC, follow a few critical steps, and ignoring them can lead to data loss or a β€œbrick.”

  • πŸ“± Save all the data: firmware erases internal memory. Use Mi Mover, Google Drive, or physical copying on your PC. It's especially important to save folders. DCIM (Photos), Downloads and WhatsApp/Databases (If you need to restore chats).
  • πŸ”‹ Charge your phone at least to the minimum. 60%: interruption of the process due to battery discharge can damage system partitions β€” 80-100%.
  • πŸ–₯️ Install drivers: without them, the PC will not recognize the device in Fastboot mode. USB Driver or use a universal driver ADB Driver Installer.
  • πŸ”— Prepare the cable: use the original USB-C Xiaomi cable. Cheap analogues may not transmit data in Fastboot mode.

Also check the MIUI version in the settings. If it is older than MIUI 12, you may need to pre-update through OTA to avoid errors when unlocking the bootloader.

Make a backup on a PC or cloud|Charge the phone to 80%+|Install Xiaomi drivers|Download the firmware for your model (cepheus)|Prepare original USB-cable-->

Unlocking the bootloader: a mandatory step for any firmware

Xiaomi blocks the bootloader on all devices, including the Mi9. Without it unlocking, it is impossible to install custom software or even official firmware via Fastboot.The process takes up to 72 hours due to Xiaomi's security policy.

To unlock, you will need:

  • πŸ“± Phone with a linked Mi Account (mandatory confirmed by the SMS/email).
  • πŸ–₯️ Windows PC and Mi Unlock Tool installed.
  • πŸ”‘ Developer mode enabled and permitted debugging USB (Settings β†’ The phone. β†’ Version. MIUI (7 times press) β†’ Additionally. β†’ For developers β†’ Debugging by USB).

Instructions:

  1. Link your Mi Account to your phone in Settings β†’ Xiaomi Account.
  2. Enable OEM Unlock in the developer settings.
  3. Connect your phone to your PC in Fastboot mode (turn off the device, then press Power + Volume Down).
  4. Run the Mi Unlock Tool, log in and follow the instructions. The first attempt to unlock can end in error, which is normal. Repeat the process in 24-72 hours.
What if the Mi Unlock Tool can’t see the device?
Make sure the phone is in Fastboot mode. Check the driver installation via Windows Device Manager (should show "Android Bootloader Interface"). If the problem persists, try another one. USB-port (preferably 2.0) or disable driver signatures in Windows.

⚠️ Note: Once the bootloader is unlocked, all data, including files on internal memory, will be deleted from the phone, and some features (such as Find Device or Mi Pay) may stop working.

Installation of official firmware through Mi Flash Tool

The official firmware is suitable if you need to return the phone to a factory state or fix errors after a failed update. Mi9 (cepheus model: use only tagged files cepheus_global or cepheus_eea (European version).

Step-by-step:

  1. Download the latest stable version MIUI for Mi9 Choose a file with the.tgz extension (for example, cepheus_global_images_V12.5.1.0.RFAMIXM_20210310.0000.00_10.0_global_1234567890.tgz).
  2. Unblock the file to a folder without Cyrillic characters (for example, C:\Mi9_Firmware).
  3. Install the Mi Flash Tool and run on behalf of the administrator.
  4. Connect your phone in Fastboot mode (as described above).
  5. In the Mi Flash Tool, click Select, specify the folder with the unarched firmware, then Refresh - the device must be determined.
  6. Select firmware mode: Clean all - complete cleaning (recommended when changing the region or after custom firmware); Clean all and lock - cleaning + lock the bootloader (use if you want to return the warranty); Save user data - data storage (does not always work correctly).

Flash

Firmware modeAre the data stored?Is the loader locked?When to use
Clean all❌ No.❌ No.Change of region, correction of errors
Clean all and lock❌ No.βœ… Yes.Return of warranty, sale of phone
Save user dataβœ… Partially.❌ No.Update without data loss (risky)

⚠️ Note: If after firmware the phone is stuck on the logo MI For more than 15 minutes, don't panic. Try to go to Recovery. + Turn up the volume and make Wipe Data. If that doesn't work, repeat the firmware with Clean all.

Official. MIUI (stable)|Official. MIUI (designer)|LineageOS (Pixel Experience)|Another.-->

Installation of custom firmware through TWRP

Custom firmware like LineageOS or Pixel Experience gives you more freedom: pure Android without ads, regular security updates and additional features. However, installing them requires an unlocked bootloader and a TWRP installed.

Download it first.

  • πŸ“± TWRP for Mi9 (The version should support your region).
  • πŸ“± The firmware itself (e.g. LineageOS or Pixel Experience).
  • πŸ”‘ Open GApps (if firmware is not Google-services; choose the option) arm64 β†’ 10.0 β†’ pico).

Instructions:

  1. Install. TWRP Fastboot: Fastboot Flash Recovery twrp-3.6.2_10-0-cepheus.img fastboot boot twrp-3.6.2_10-0-cepheus.img The phone will reboot to TWRP.
  2. In TWRP, backup your current firmware (Backup β†’ Select all partitions β†’ Swipe for confirmation). Save the backup to your PC.
  3. Sweep through custom firmware: Press Wipe β†’ Advanced Wipe, tick Dalvik, Cache, System, Data. Go back to the main menu, select Install, specify the firmware file (for example, lineage-20.0-20230601-nightly-cepheus-signed.zip). After installing the firmware, immediately swipe Open GApps (if necessary).

Reboot β†’ System

πŸ’‘

If your mobile network is not working after installing custom firmware, check your APN settings in Settings β†’ SIM cards and mobile networks β†’ Access Points (APN). Often, factory resets or manual operator settings help.

Solving common errors in firmware

Even with the correct instructions, errors can occur, and here are the most common ways to correct them:

Mistake.Reason.Decision
This device isn’t connected (Mi Flash Tool)Drivers not installed or cable is faultyReinstall the drivers, try another one. USB-port (preferably 2.0)
Anti-rollback checkTrying to install an older version of MIUIUse firmware no older than the current one or reset the anti-rollback via Fastboot (risky!)
The phone does not turn on after the firmwareIncompatible firmware or interrupted processRepeat the firmware with Clean All or restore the backup via TWRP
E: Unknown command [log] (TWRP)A damaged firmware fileDownload the firmware, check the checksum (MD5)

Critical information: If the phone is no longer detected by the PC in Fastboot mode after firmware, this may indicate damage to the EDL partition. In this case, specialized hardware (for example, Qualcomm HS-USB QDLoader 9008) and firmware through Mi Flash Pro in EDL mode will be required.

⚠️ Note: If you see a Critical partition flashing error is not allowed in the Mi Flash Tool, it means that your Mi Account does not have the right to the firmware of this model. Solution: log in to the Mi Flash Tool under the same account as your phone, or use another PC.

How to return the warranty after firmware

If you have been flashing your phone for experiments, but now want to return it to the factory state for warranty repair, follow the following steps:

  1. Install the official firmware through the Mi Flash Tool in Clean All and Lock mode.
  2. After firmware, turn on your phone and perform a full reset in the settings (Settings β†’ Additional β†’ Reset and Reset β†’ Reset settings).
  3. Make sure the bootloader is locked: turn off the phone, press Power + Volume Down. If the screen shows Phone Locked, the bootloader is locked.
  4. Disable your Mi Account in the settings and delete all personal data.

However, keep in mind that some Xiaomi service centers may detect signs of unlocking the bootloader even after blocking, in which case the warranty is canceled. To check the "purity" of the device, use the command in ADB:

adb shell getprop ro.boot.verifiedbootstate

If the answer is orange, the bootloader was once unlocked. The answer is green means the device is in factory condition.

FAQ: Answers to Frequent Questions

Can I flash Xiaomi Mi9 without unlocking the bootloader?
No. Any firmware on Fastboot or Recovery requires an unlocked bootloader, except for the OTA update, but it doesn't give you access to custom firmware.
Which firmware is better to choose: official or custom?
The official MIUI is more stable and optimized for hardware, but contains advertising and restrictions. Custom firmware (like LineageOS) offers pure Android, but can have bugs with a camera or wireless modules. For everyday use, we recommend the official MIUI Global Stable.
What if the touchscreen doesn’t work after the firmware?
This is a typical problem when installing firmware from another model (e.g. Mi9 SE instead of Mi9). Solution: run the correct version for cepheus in Clean all mode. If the sensor doesn't work even in TWRP, you'll need firmware through EDL.
Can I roll back the MIUI version to an older version?
Technically, yes, but Xiaomi uses an Anti-Rollback mechanism that blocks rollbacks on versions older than a certain date. Trying to circumvent this restriction can lead to a "brick." Check the current version of Anti-Rollback in the settings (Settings β†’ About Phone β†’ All Specifications β†’ Anti-Rollback version).
How to check which firmware is installed on the Mi9?
Go to Settings. β†’ The phone. β†’ Version. MIUI. It'll say something like MIUI Global 12.5.1 Stable. Full build information can be found in Settings β†’ The phone. β†’ All specifications β†’ The kernel version (e.g, 4.14.159-perf-gf56f3a5d6d6d).

πŸ’‘

Always check firmware compatibility with the phone model (cepheus for Mi9). Installing an inappropriate version can damage the camera modules, sensors or mobile network.