After installing the official MIUI update or resetting, many Xiaomi users are faced with the loss of the custom TWRP Recovery. The system automatically replaces it with stock Mi-Recovery, blocking access to advanced functions: backups, root rights or custom firmware installation. You can restore TWRP, but the process requires accuracy - an error at any stage can lead to a "brick" of the device.
In this article, we will understand 3 working method of returning custom recavery: through Fastboot, using ADB And by patching the official firmware, we'll focus on the nuances of the bootloader and Qualcomm-based models. Snapdragon/Mediatek. You will also learn how to avoid loss. TWRP after future updates.
โ ๏ธ Critical warning: All manipulation of the recovery and bootloader will void the Xiaomi warranty.On models with a locked bootloader (e.g. Redmi Note 12 Pro)+ Xiaomi 13T) First, you need to officially unlock through the Mi Unlock Tool. TWRP impossible.
Why does TWRP disappear after MIUI update?
The reason lies in the protection mechanism of Xiaomi: stock firmware MIUI contains an anti-rollback script, which when you install an update via OTA or Mi Flash Tool automatically replaces custom recovery with the original.
- ๐ฑ Installed. TWRP via Fastboot previously;
- ๐ Updated through System Update in Settings;
- ๐ง Performed a reset (Wipe Data) through stock Recovery.
On some models (e.g. POCO F5 or Redmi K60), the script works even when manually firmware is running through TWRP, unless you disable the signature verification (dm-verity), the solution is to patch the firmware image before installation or use modified versions of the MIUI from the community (e.g. MIUI EU).
โ ๏ธ Note: On devices with Dynamic Partitions (all Android models) 10+) standard installation TWRP It's a special version of the Recaveri that's supported. super.img.
Preparation: What to do before TWRP recovery
Before starting the procedure, make sure that all the preconditions are met:
Unlock the bootloader via Mi Unlock Tool
Drivers installed ADB/Fastboot (team-tested `adb devices`)
Downloaded the current TWRP image for your model (from the site [twrp.me](https://twrp.me)
Backup of data (photos, contacts, messages)
Battery charge โฅ 50%
Mi Account and Factory Reset Protection (FRP)
-->
To check the status of the loader, perform at the terminal:
adb reboot bootloader
fastboot oem device-infoIf you see Device unlocked: true, you can continue. Otherwise, unlock the bootloader through the official Mi Unlock Tool application (requires a Mi Account binding and waiting 7-168 hours).
๐น Important for owners POCO/Redmi 2023โ2026 On new models (e.g., on new models, POCO X6 Pro or Redmi Note 13 Pro+) Xiaomi has tightened its protections:
- ๐ง Use OrangeFox Recovery instead of TWRP (Best Compatibility with Dynamic Partitions);
Redmi Note 10/11/12 series series
POCO F3/F4/F5
Xiaomi 11/12/13 series
Redmi K40/K50/K60
Another model-->
Method 1: Install TWRP via Fastboot (Universal Method)
This method is suitable for 90% Xiaomi devices with unlocked bootloader. You will need a PC with installed ADB/Fastboot downloadable TWRP.img.
Step-by-step:
- ๐น Just after the firmware, reboot to the TWRP, Not in the system: fastboot reboot recovery This will prevent the replacement of the Recovery with stock.
If the TWRP disappeared again after the reboot, it means that the firmware has activated anti-rollback. Solution: patch boot.img (see Method 3) or use MIUI EU without protection.
๐ก
On some models (e.g. Xiaomi) 12T) instead `fastboot flash recovery` We need to use the team. `fastboot flash recovery_ab twrp.img` because of the separate structure of the sections (A/B).
Method 2: Recovery of TWRP with ADB Sideload
If TWRP It is still partially working (for example, it is loaded, but does not install it). ZIP-files, you can restore them through ADB Sideload. This is a useful way to do this:
- ๐ The device is loaded into the recaveri, but can not flash the image;
- ๐ฆ We need to update the version. TWRP data-free;
- ๐ง No access to Fastboot (e.g. broken Volume Down button).
Instructions:
- Download the TWRP image in.img format and rename it twrp.zip (yes, the extension should be ZIP!).
- Load into the current recavator (even if it is broken) and select Advanced โ ADB Sideload.
- On PC, do: adb sideload twrp.zip
- Once complete, reboot to new Recovery: adb reboot recovery
โ ๏ธ Note: On devices with Dynamic Partitions (e.g. Redmi Note) 11 Pro+) This method may not work, so use OrangeFox Recovery or go through the file. TWRP via Fastboot with a preliminary patch super.img.
Method 3: Patching the Official Firmware to Save TWRP
If TWRP disappears after each MIUI update, the only reliable solution is to patch the official firmware before installing it, which disables the signature verification (dm-verity) and blocks the anti-rollback script.
Tools required:
- ๐ฅ Official firmware MIUI for your model (download from the [en.miui.com](https://en.miui.com/download.html));
- ๐ ๏ธ Magisk (for patching) boot.img);
- ๐ง MTK Bypass or Qualcomm Firehose (for devices on the device) Mediatek/Snapdragon).
Step-by-step process:
- Unpack the downloaded firmware (.tgz or.zip format) and find the boot.img file.
- Move it. boot.img On your smartphone and patch it with Magisk: Open Magisk โ Install โ Select and Patch a File; Select and Patch a File boot.img And wait for the file to be created. magisk_patched.img.
boot.img
Fastboot
fastboot flash boot magisk_patched.imgTWRP
๐น For devices with Dynamic Partitions (e.g. Xiaomi 13 or XP) POCO F5):
- Download MIUI EU or custom firmware with the anti-rollback disabled;
- Unpack payload.bin with Payload Dumper.
- Replace boot.img and recovery.img with patched versions.
- Collect the firmware back and run through Fastboot or TWRP.
Critical information: On HyperOS devices (e.g. Xiaomi) 14 or Redmi K70) standard-patch boot.img Magisk can lead to a looped bootloop. init_boot.img.
๐ก
Main conclusion of the section: The only reliable way to save TWRP โ drop out OTA-Updates and only modified updates ZIP-file-recovery.
Frequent mistakes and their solutions
When you restore TWRP, you often have a problem with the typical problems, and we'll look at the most common ones.
| Mistake. | Reason. | Decision |
|---|---|---|
| FAILED (remote: 'Flashing is not allowed in Lock State') | bootloader locked | Unlock the bootloader via the Mi Unlock Tool (requires a wait of 7-168 hours). |
| Invalid sparse file format at header | A damaged TWRP image or incompatible version | Download another image from twrp.me or check the checksum (SHA-256). |
| The device is loaded into Mi-Recovery instead of TWRP | Anti-rollback has been activated after the update | Fastboot TWRP and reboot it to Fastboot Reboot Recovery. |
| E: Unable to mount /data or E: Unknown command [log] | Problems with FBE partitioning or encryption | Scroll OrangeFox Recovery (best FBE support) or run Format Data in TWRP (data loss!). |
| The device does not turn on after firmware (brick) | Incompatible firmware or bug when patching boot.img | Restore your device via EDL Mode (requires an authorized Mi and Mi Flash Pro account). |
๐น Advice for owners POCO/Redmi 2023โ2026 If after installation: TWRP The device is loaded into the system, but the recaveri is replaced with a stock one - try it:
- Sweep TWRP slot-in (recovery_a and recovery_b):
- Turn off automatic updates via Fastboot: