How to install TWRP Recoveries on Xiaomi via a computer

Modifying the Android operating system on Xiaomi smartphones often starts with replacing the standard recovery mode with a customized counterpart, such as TWRP (Team Win Recovery Project), which opens the user to advanced file system management functions, allows you to create full partition backups and install third-party firmware. Without this tool, deep customization of the device is almost impossible, since the factory menu Recovery has extremely limited functionality.

The installation process requires connecting your smartphone to your personal computer and using specialized command line utilities. It is important to understand that interfering with system partitions always carries certain risks, so all actions must be performed consciously and strictly following the algorithm. Before starting work, make sure that the device battery is charged at least 60%, and all important data is copied to an external medium or to the cloud storage.

In this article, we will discuss in detail the procedure for unlocking the bootloader, installing the necessary drivers and direct firmware of the image of the Recovery through Fastboot mode. We will look at the nuances of working with different models of Redmi and POCO, and also discuss how to preserve the rights of the superuser after the first boot of the system.

Preparation of tools and drivers for work

The first and fundamental step is to prepare the workplace and the software. USB-cable, preferably an original or high-quality analogue, supporting data transfer, and not only charging. The computer must be running the Windows operating system, as drivers for Fastboot mode are most often supplied for this platform, although options are possible for Linux.

A critical component is the ADB and Fastboot package, which is a toolkit from Google that allows your computer to communicate with your Android device at a low level. Without these tools, you can't send commands to your phone. You also need to make sure that your computer has universal ADB drivers or specific Qualcomm/S MediaTek drivers, depending on your smartphone's processor.

β˜‘οΈ Firmware readiness check

Done: 0 / 5

Tools should be downloaded exclusively from official sources, such as the Android Developers site or verified repositories on GitHub. Using dubious builds from unknown authors can lead to malware installation or incorrect tool performance, which is critical when working with system partitions. Once the archive is downloaded, it must be unpacked into the root of the C disk or any other short-cut folder to avoid errors when entering commands.

⚠️ Note: Using drivers from unverified sources can lead to hardware conflict and the inability to identify the device in Task Manager. Always check the digital signatures of drivers before installing them.

Unlock Bootloader bootloader on Xiaomi

Before attempting to write a TWRP image to a device memory, you must unlock the bootloader. Xiaomi defaults to block this function for security reasons, preventing unauthorized modification of system files. The unlock procedure is mandatory and without it, installing a custom recovery is impossible, since Fastboot mode will reject write commands to the recovery partition.

First, you need to link your Mi Account to your device. Go to your phone settings, select About Phone, and click on the MIUI version several times to activate the developer menu. Then, in the advanced settings, find the Developer section and activate the Mi Unlock status. This is where the device is linked to the account.

  • πŸ”‘ Turn on the Internet on your smartphone and make sure that the device is installed SIM-map.
  • πŸ“± In the menu "For developers" click "Add account and device" to link.
  • ⏳ After successful binding, you will have to wait 7 to 168 hours, depending on the security policy.
  • πŸ’» Download the official Mi Unlock Tool utility to your computer and log in to the same account.

Once the waiting time has expired, you can start unlocking the device itself. Upload the phone to Fastboot mode by pressing the volume button when the device is switched off to the PC. Launch the Mi Unlock Tool, press the Unlock button and confirm the action. The process will erase all data on the device, so a pre-backup is mandatory.

What to do if the timer is reset?
If you reset your phone settings or log out of your Mi Account during the waiting period, the bootloader unlock timer may reset and the wait will have to start over.

Search and download compatible TWRP image

The key to success is choosing the right version of the recovery. For each Xiaomi, Redmi and POCO device, there is a unique code (codename), for example, guacamole or vayu. Using an image designed for another model is likely to lead to the "bricking" of the device or the inoperability of the touch screen in the recovery menu.

The official TWRP website lists supported devices, but new Xiaomi models often have to go to the 4PDA or XDA Developers forums, where enthusiasts post informal but stable builds, and you need to look for a file with the.img extension, not.zip, because it requires a disk image to install through a computer.

If the build came out a year ago and your phone received an Android update recently, there may be problems with the compatibility of encryption sections, in such cases, it is better to look for more recent ports or builds from well-known developers specializing in your device.

ParameterDescriptionImportance
Code nameUnique Model Identifier (codename)Critically.
Android versionCompliance with OS and Recovery VersionTall.
Type of loaderSupport for A/B partition or legacyMedium
SourceOfficial website or verified forumTall.
πŸ“Š Where do you usually look for firmware and images?
TWRP: 4PDA Forum: XDA Developers: Telegram Developer Channels

Switching to Fastboot mode and checking communication

After all the files are ready, you need to transfer the smartphone to a special diagnostic and firmware mode - Fastboot. On Xiaomi devices, this is done by turning off the device and then pressing the volume button when you connect the USB cable to the computer. The screen should appear a characteristic logo with a hare repairing an android, or the inscription "FASTBOOT" in orange or blue.

Now you need to open the command line on your computer. Go to the folder with the unpacked ADB tools, press Shift and right-click on the empty space, selecting "Open PowerShell window here" or "Open terminal." Enter the command fastboot devices. If the drivers are installed correctly, you will see the serial number of your device.

fastboot devices


0123456789ABCDEF	fastboot

If an empty line or error message appears instead of a device number, check the cable. USB It's possible that the system didn't recognize the device, and you'd need to install the drivers from the folder. android_winusb.inf. Without the successful execution of the command fastboot devices, further action is impossible.

⚠️ Warning: If the command line defines the device as "waiting for device," don't turn off the cable. USB-port on another, preferably located directly on the motherboard, and not through USB-hub.

The process of installing TWRP through the command line

The moment of the firmware is the culmination of the instruction: Make sure the image file is renamed twrp.img and is in the same folder where you run commands, or specify the full path to the file. The command to write the image to the recovery section looks standard for all Android devices.

Enter the following command to the terminal:

fastboot flash recovery twrp.img

Once you press Enter, the recording process will begin, the progress bar and the status of the operation will appear in the terminal window, the successful completion will be marked with the word "finished" and the total run time, and it is important not to interrupt this process and not to turn off the cable until the operation is completed completely.

πŸ’‘

The flash command records the image directly to the recovery section, replacing the factory menu, and then the phone is ready to load into TWRP.

There is a nuance for devices with A/B partition (without a separate recovery section). On such smartphones, the command may differ or require firmware in both slots (A and B). However, for most classic Xiaomi models with Snapdragon processors, the standard command fastboot flash recovery is correct.

First start and save modifications

Many users make the mistake of simply restarting the phone after they have firmware. The standard Android booting procedure (fastboot reboot) can cause the original system, when it detects a modified recovery partition, to overwrite the TWRP back to the factory menu, and to avoid this, you need to immediately get to the installed backup after the firmware.

Use a button combination to enter Recovery mode. On most Xiaomi devices, this is pressing the volume button when the power is connected. Once the screen goes down, release the volume button and immediately start pressing the on button quickly until the TWRP logo appears. If you saw the menu with the buttons "Install", "Wipe", "Backup" - congratulations, the installation was successful.

  • πŸ”„ Right after the entrance to TWRP Press the "Cancel" button if you want to install Root (unless you need to).
  • πŸ”’ Go to the Wipe menu and select "Format Data" by entering "yes" to unencrypt.
  • πŸ“‚ Reboot to the system (Reboot -> System) only after formatting.

If the system boots normally, then the compatibility is complete. In the future, you will need to use the standard reboot menu in your phone or a combination of buttons when the device is turned off to return to TWRP. Now your smartphone has advanced functionality for installing modified firmware such as Pixel Experience or LineageOS.

πŸ’‘

If after booting the system TWRP disappeared, try immediately after the flash command to execute the command fastboot boot twrp.img, and already in TWRP mode, flash the ZIP-archile with a sleep installation.

What if a red screen says β€œOrange State”?
This is the normal reaction of an unlocked bootloader to change system partitions, a message that warns that the integrity of the software is violated, it does not affect the operation of the phone, but it appears every time you boot, you can remove the inscription only by re-locking the bootloader (which will remove TWRP) or installing patches that mask the status of the bootloader.
Can I update my MIUI after I install TWRP?
Official Air Updates (OTAs) may not be installed or removed by TWRP when installed. It is recommended to disable automatic updates in the MIUI settings. If you need an update, download the full firmware package and install it manually through the Select File menu in the update app itself, selecting the full version zip archive.
How do you get it back if something goes wrong?
To get back to factory, you just need to run the Mi Unlock Tool on your computer again, and it has a "Clean up" option on its menu that completely reflashes the phone with the original stable version of MIUI and locks the bootloader back, which guarantees that the device is restored to "out of the box."