Installation of TWRP Recovery on Xiaomi: a step-by-step guide

Modifying Android on Xiaomi devices opens up possibilities that are not available in stock firmware. Installing TWRP Recovery is the first and most important step towards root rights, custom firmware installation, or full system backup. Standard recovery mode is limited to resetting and flashing official methods, while Team Win Recovery Project gives full control of the file system.

The process of implementing an alternative bootloader requires careful and rigorous sequence of actions. Any error in the interaction stage with the Fastboot can lead to software failures. However, if you follow the proven algorithm, the risk of turning the device into a brick is minimized. In this guide, we will analyze all the nuances, from the preparation of tools to the final test of the menu health.

It is worth noting right away that the procedure requires an unlocked Bootloader.Without this precondition, you won’t be able to write a new recovery image to the phone partition.On some models with MediaTek processors or newer versions of HyperOS, the procedure may differ from the classic method via ADB. Make sure your device model is supported by the developer community before you start.

Preparation of equipment and software

Before you start any manipulation of system partitions, you need to assemble the right tools. You need a computer running Windows, Linux or macOS, which is working. USB-The quality of the cable plays a critical role: cheap wires often do not provide a stable connection for data transmission, limited only to charging.

You need to install ADB and Fastboot drivers on your computer, without which the system will not be able to recognize the phone in debugging or bootloader mode, and it is also recommended to download the SDK Platform Tools platform from the official Google website, since it contains current versions of executable files.

  • πŸ“± Smartphone with a battery charge of at least 60% to exclude sudden shutdown.
  • πŸ’» PC with installed drivers ADB/Fastboot and platform tools.
  • πŸ”Œ Original or quality certified USB-cable.
  • πŸ“‚ Image file TWRP (Img, downloaded specifically for your model.

It is important to download the recovery.img file that matches the code name of your device, and using an image from another model, even if they belong to the same series, can cause a touchscreen to fail or a complete system failure.

⚠️ Warning: Make sure to back up all important data before installation.The process of unlocking the bootloader (if not already done) completely clears the internal memory of the device.

Unlocking the Bootloader bootloader

Xiaomi has tight restrictions on software modifications, so installing TWRP is impossible without official unlocking, a procedure that takes 7 to 168 hours to wait after an account is linked, and ignoring this step will lead to an error when trying to write to the recovery section.

To start, activate the developer mode. Go to the settings, select About Phone, and quickly click on the MIUI or HyperOS build number seven times. After the notification appears, go to the advanced settings and turn on USB debugging.

πŸ“Š Have you ever encountered a locking of Xiaomi bootloader?
Yeah, waited 168 hours.
Yeah, but I unlocked it fast.
No, it's already unlocked.
I haven't tried it yet.

Then you have to link your Mi Account to the Mi Unlock settings menu, and then you have to wait until the server's timer expires, and then the Mi Unlock Tool will allow you to unlock, and it's in Fastboot mode, where the phone is translated by pressing the volume button when the screen is off.

πŸ’‘

Use it. SIM-card with mobile Internet (not Wi-Fi) when linking the account in the Mi Unlock Status menu, this reduces the likelihood of server errors.

Downloading the smartphone in Fastboot mode

Fastboot (or Bootloader Mode) is a low-level interface that allows you to write commands directly to the device’s memory. To enter this mode on a Xiaomi smartphone that is turned off, you need to press the volume button and connect the cable to your computer, and an image of a rabbit repairing an android or the words Fastboot will appear on the screen.

The computer must identify the device, and you can check this through Windows Device Manager or the fastboot device command in the terminal, and if the device is displayed with a yellow exclamation point, the drivers are installed incorrectly and need to be updated manually.

In this mode, commands are available to check the lock status. The command fastboot getvar unlocked must return the value of yes. If no returns, the installation of TWRP is impossible, and you need to go back to the previous stage.

β˜‘οΈ Pre-firmware check

Done: 0 / 4

The installation of the TWRP image

The process of writing the image itself takes a few seconds, but requires accuracy. Place the downloaded twrp.img file in the ADB tool folder. Open the command line in this directory. Make sure the phone is connected and in Fastboot mode.

The fastboot flash command is used to record the image, and the syntax requires the partition and path to the file.

fastboot flash recovery twrp.img

Once the command is successfully executed, the screen will show a message of success, but if you just reboot the phone with a standard command, stock Android can rewrite TWRP back to the original, so immediately after the firmware is installed, you must force the recovery mode.

There's a nuance to A/B partitions on modern devices, so if your device has this architecture, you need to stitch it into both slots or use a special setting. For most older models, one command is enough.

What to do if you write"FAILED remote
Partition does not exist?: This error means that your device does not have a separate recovery partition, as it uses the A/B structure. In this case, the TWRP is installed as a boot image or requires the use of a dedicated installer.zip version.

First Launch and Save Recovery

The most critical moment is the first input to the installed TWRP. Immediately after the flash command, you need to press the button combination (usually Volume Up + Power) and hold them until the Mi logo appears, then release Power, continuing to keep Volume, this will prevent the system from loading and trigger the recovery menu.

When you first start, TWRP will ask you to confirm permission to modify the system partition, swipe the Swipe to allow modifications slider, and if you don't, the next time you restart, the system will be replaced by the stock one again.

Once confirmed, you can move to install root rights through Magisk or custom firmware. TWRP allows you to make full backups (Nandroid), clean cache and format data sections.

πŸ’‘

If the phone boots to a regular system after installing TWRP, you have not confirmed the modifications in the TWRP menu or the stock system has automatically restored its recovery partition.

Solving Frequent Errors and Problems

In the process of modifying Xiaomi, users often face typical problems, one of which is a broken touchscreen in TWRP. This is due to the incompatibility of the screen drivers in the image of the recovery with the Android version.

Another common error is Error 7 when installing zip archives, which indicates that the TWRP version is incompatible with the Android version or a corrupted firmware file, and it may also appear black screen after installation, which requires a reset via Fastboot.

Logging can be used to diagnose problems. TWRP has the ability to save a log to the memory card to help you understand where the failure occurred, often by cleaning the Data and Cache partitions before installation.

Problem.Probable causeMethod of decision
Touchscreen's not working.Incompatible version of TWRPFind a TWRP build specifically for your version of Android
Bootloop (Reboot Cycle)Error in modifying the systemMake Wipe Data in TWRP or return the stock firmware
PC doesn't see the phoneThere are no drivers.Install Universal ADB Driver or Xiaomi Drivers
Error "Device is locked"bootloader lockedUnlocking with Mi Unlock Tool

Return to the drainage state

If experiments with custom software have led to unstable operation, you can always return the device to its original state.

A full reset via Wipe All Data in the Recovery stock menu can also help if the bootloader integrity has not been compromised.

Recovery of the (original) firmware guarantees a return of warranty if the physical appearance of the device has not been damaged. Software changes usually leave no trace after a complete flashing through Fastboot.

Is it safe to install TWRP on the new Xiaomi?
The procedure is safe when followed, but always carries a theoretical risk: new Anti-Rollback devices cannot roll back on older versions of Android, which can lead to a hard breech. Always check the security policy for a particular model.
Will the warranty fly off after installing TWRP?
Technically, unlocking the bootloader and installing third-party software will void the software warranty, but if you return the stock firmware and lock the bootloader back, the service center may not notice the interference unless there is physical damage.
Can I upgrade to OTA with TWRP installed?
Standard. OTA-installable TWRP Root rights usually don't come or install correctly, but you need to temporarily return the stock boot image or manually install updates through Recovery to update.
Do I need an unlocked bootloader for every TWRP?
Yes, you can't write to the recovery section without the signature rights that only the unlocked bootloader gives, and without that step, the fastboot team will give you an access error.