How to bring TWRP back to Xiaomi: A complete recovery guide

Owners of Xiaomi, Redmi and Poco smartphones often face a situation where, after a regular system update or accidental reboot, the custom recovery disappears, giving way to the standard MI Recovery menu. This is due to a system protection mechanism that checks the integrity of the boot partition at each start. If the signature is different from the factory one, the system automatically restores the original image, erasing all traces of the modifications.

TWRP (Team Win Recovery Project) recovery requires not just re-installation, but also understanding why it happened. In most cases, the problem lies in the wrong course of action when updating the firmware or not having a system change blocker, you will need to re-open the bootloader if it was reset, or use special firmware techniques that bypass integrity checks.

This guide describes the current methods of returning recoveries to devices with Snapdragon and MediaTek processors. We will consider working with Fastboot, using ADB and the specific nuances for new versions of Android. It is important to understand that all actions you make at your own risk, as interference with system partitions always carries potential risks.

Why TWRP Flies After Update or Reboot

The main reason for the disappearance of the custom recavator is the verification mechanism of the AVB bootloader (Android Verified Boot). When you install an OTA update or reflash the device through Mi Flash in clean mode, the system updates the boot and recovery section. Since the TWRP does not have a digital manufacturer signature, the security algorithm marks it as damaged or changed.

The next time you bootload, the bootloader detects a hash mismatch and forcibly replaces the modified image in the factory. This is standard behavior for modern versions of MIUI and HyperOS. Even if you just rebooted to Recovery mode to obtain root rights, the system could have time to check and roll back the changes.

⚠️ Warning: Constant overwriting of the recovery can lead to a cyclic reboot (bootloop) if the system files have been changed by the Magisk patch and the recoveries are returned to the stock state.

It is also worth considering that on devices with dynamic partition scheme (A/B partition scheme), the situation is complicated. the update can affect only one slot, while the second will remain with the old version of TWRP. When switching the active slot, you can see the presence, then the absence of a custom menu.

πŸ“Š Have you experienced automatic removal? TWRP?
Yes, after the OTA update.
Yeah, after the runoff was flashed.
I only use it on older devices.
I don't know, I always have

Preparation of tools and drivers for firmware

Before you start to restore, you need to make sure that you have the latest tools. You need a package Platform Tools containing utilities adb and fastboot. Without them, interaction with the bootloader of the device is impossible, you can download them from the official Android developer site or through specialized repositories.

The critical step is to install the right drivers. Xiaomi devices need specific Qualcomm or MediaTek drivers, as well as the ADB Interface driver. The device manager when connecting a smartphone in Fastboot mode must display Android Bootloader Interface without exclamation points.

  • πŸ“± Download the current image TWRP specifically for your device model (file with.img extension).
  • πŸ’» Install the drivers. ADB and Fastboot on a computer with Windows operating system.
  • πŸ”“ Make sure the bootloader is unlocked (Unlocked status in Fastboot).
  • πŸ”‹ Charge your smartphone to at least 60% to avoid power outages at a critical time.

Don't forget to turn on the debugging. USB If access to the system is limited, the transition to Fastboot mode is carried out by a combination of buttons Volume down. + Power when the device is off. Connect the phone with original or quality cable directly to the PC motherboard port, avoiding USB-hub.

β˜‘οΈ Testing of recovery preparedness

Done: 0 / 4

The process of installing TWRP via Fastboot

The most reliable and common method of retrieve is using Fastboot mode, which allows you to directly write images to memory sections, bypassing the operating system. Put your smartphone into this mode and connect to your computer. In the command line, enter fastboot devices to check the connection.

If the device is determined, you can go to the recording of the image. The command fastboot flash recovery twrp.img will write the file to the appropriate partition. However, on modern devices with A/B partitions, a simple recording may not be enough, since the system can overwrite the partition again on the first boot.

fastboot flash recovery_ab twrp.img


fastboot set_active a

After completing the commands, it is extremely important to prevent normal booting in Android. Immediately use the button combination to log in to Recovery. + If you get on the menu TWRP, So, the first step is a success, and now you need to fix the result so that the system doesn't roll back the change.

⚠️ Attention: On devices with data encryption (FBE) post-installation TWRP You may not be able to access the internal memory. That's fine, you'll need to format the data.

In some cases, especially the new Poco and Redmi models, it is required to additionally stitch the patched boot image or use scripts to disable verification.

TWRP fixing and circumventing integrity check

To prevent TWRP from crashing after the first reboot, you need to disable the self-repair mechanism, often requiring a patch that modifies the bootloader or signature-checking system files, and without this step, all previous actions may be in vain.

There are several ways to anchor, and the first is to use backbone scripts, such as: Disable_Dm-Verity_ForceEncrypt. The second is the installation of the Magisk root rights manager, which, when installed correctly, can also modify the boot image, making it different from the stock image, which is in conjunction with the installation of the root rights manager. TWRP gives the right effect.

  • πŸ›‘οΈ Download the zip archive patch for your version of Android.
  • πŸ“² Load into the set. TWRP.
  • πŸ“‚ Through the Install menu, select the downloaded archive and flash it.
  • πŸ”„ Restart the system using the Reboot System button.

Another effective method is to rename the stock image of recovery in the system so that it cannot find it for recovery, but this method requires superuser rights and can be dangerous for beginners. A safer way is to use specialized modules for Magisk that block the use of the OTA-Replacement of Recavers.

What is dm-verity?
dm-verity is a file system integrity check feature that ensures that the system partition has not been changed. TWRP violates this integrity, so dm-verity must be turned off, otherwise the phone will endlessly reboot or reset TWRP.

Specificity of devices with partitions A/B and encryption

Modern Xiaomi smartphones use an A/B partition scheme that allows you to update in the background. This means that you have two sets of partitions: active and inactive. When installing TWRP, it is important to understand which slot you are writing an image into. If you write only to slot A and the system switches to B, the Recovery will become stock again.

Data Encryption is a particularly acute problem, because stock Android encrypts a data partition, and TWRP cannot read it without a special patch or password, and you will see an empty list of files or a message that the partition is encrypted.

ParameterStock RecoveryTWRP (without patch)TWRP (with patch)
Access to DataFull (after password)Missing (Read-only)Full (Read/Write)
ZIP installationJust the official firmware.Possible.Possible.
Verification of signatureOn.Disconnected.Disconnected.
Risk of dischargeLow.High-pitchedMedium.

To solve the encryption problem, you often need to format the Data partition (Format Data command and enter the word yes).This action will completely delete all user data, photos and contacts, so be sure to make a backup before you start manipulating.

πŸ’‘

Before formatting Data, copy important photos and documents to your computer or the cloud, as it will be impossible to restore them after formatting.

Solving problems and errors in recovery

When returning TWRP, users often encounter errors, and one of the most common is FAILED (remote: device is locked), which means that the bootloader is locked, in which case custom recavator installation is impossible without official unlocking through the Mi Unlock service.

Another common problem is that the device is "bricking" when trying to flash an image from another model. Never use TWRP images intended for other devices, even if the processor names are the same. This can damage the persist or modem partitions, making communication and sensors impossible.

⚠️ Attention: If after installation TWRP phone stopped responding to buttons, try to pinch the combination Volume up + Loudness down + Meals for food 15-20 second-on-seconds.

If TWRP is installed but the touch screen is not working, it means that the recover version is incompatible with the drivers of your Android version, in which case you need to look for a specific TWRP build or an OrangeFox analog adapted specifically for your version of MIUI firmware.

πŸ’‘

The main reason for failure is the use of incompatible images and ignoring the A/B partition scheme. Always check compatibility before firmware.

Is it safe to return TWRP on a guaranteed device?
Unlocking the bootloader and installing TWRP officially void the software warranty. Although the device is not physically affected, the service center may refuse free repairs if it finds traces of software modification. Before contacting the service, it is recommended to return the stock recoveries and block the bootloader if possible.
Can I get it? OTA-installable TWRP?
You can get updates, but you can't install them in the standard way, because the modified recovery partition blocks the installation, so you'll have to manually download the full firmware image and install it through TWRP, or use special modules to automate the process.
What if Fastboot can’t see the phone?
Check the USB cable, try another port (preferably USB 2.0 on the back of the system unit). Reinstall the ADB/Fastboot drivers. Make sure there are no unknown devices in the Device Manager. Sometimes it helps to run the command line on behalf of the administrator.
Will TWRP fly when you reset your settings?
A normal Wipe Data/Factory Reset reset does not affect the recovery section, so TWRP must remain. However, a reset via the stock Recovery menu or the fastboot erase userdata command from some stock images may initiate verification and restoration of the original recovery.