Installing a custom TWRP recavator on Xiaomi smartphones is a key step for those who want to gain full control of the device, which allows you to sew informal firmware, back up the system, remove embedded applications and even restore bricks after unsuccessful experiments.
In this guide, weβll take you all the way from unlocking the bootloader to final installing the TWRP, taking into account the features of the latest MIUI and anti-rollbacks. The instructions are relevant for most Xiaomi, Redmi and POCO models released after 2018, but taking into account the nuances of specific lines. If youβre a beginner, we recommend reading each section carefully β skipping even small parts can cost hours to recover.
1. Device Preparation: What to Do Before Unlocking
Before you start unlocking the bootloader and installing TWRP, you need to perform a number of preparatory steps, and ignoring them can lead to blocking the Mi Account account or the soft brick of the device.
First, check your smartphoneβs model and code name (like raphael for the Redmi K20 Pro or suryah for the POCO X3 Pro). This is critical, because TWRP firmware is selected by code, not by commercial name.
- π In Settings β About Phone β MIUI Version (several taps on the "kernel version" line)
- π± Through the appendix CPU-Z (section "Device")
- π On the Xiaomi Device website at IMEI
Second, make sure that the device is not tied to a Google account (FRP). Once the bootloader is unlocked, the smartphone will require you to enter the data of the last synchronized account. If you forget the password, reset it in advance through Google Account Recovery.
β οΈ Warning: On models with a MediaTek chip (e.g., Redmi Note 11 or POCO M4 Pro), unlocking the bootloader may result in SLA hardware lock (Secure Lock Area), in which case the device can only be restored through an authorized Xiaomi service center.
Also prepare:
- π Cable USB Type-C (Original or Certified) β Cheap cables can cause data transmission errors
- π» Computer running Windows 10/11 or Linux (more drivers will be required for MacOS)
- π Backup of important data β unlocking the bootloader will reset the device to factory settings
- π Battery charge of at least 60% β interruption of the process due to discharge can make the phone inoperable
2 Unlock the bootloader: the official way through Mi Unlock
Xiaomi is blocking the bootloader on all its devices, so the first step is to unlock it through the official Mi Unlock Tool.The process can take anywhere from a few hours to 7 days due to checks by Xiaomi.
Download the latest version of the Mi Unlock Tool from the official website (avoid third-party sources - they may contain malware). Install the program on your computer and follow the following steps:
- Connect your smartphone to your PC in Fastboot mode (turn off the device, then press Volume Down + Power before the Fastboot logo appears).
- Launch the Mi Unlock Tool on behalf of the administrator and log in to the same Mi Account as you do on your phone.
- The program will automatically detect the device. Press Unlock and follow the instructions.
On new devices (released after 2021), Xiaomi has introduced an additional protection β an account-to-device binding for 7 days, which means that after the first attempt to unlock, you will have to wait a week, periodically confirming your intentions in the Mi Unlock app on your phone.
β οΈ Warning: If you see an error when unlocking "Couldn't unlock" or "Current account is different from the account info on the device", check: Does the Mi Account match with the Mi Unlock Tool? Is the phone connected to the Internet via mobile data (Wi-Fi may not work in Fastboot mode) Is you using VPN or a proxy - they block access to Xiaomi servers?
Download Mi Unlock Tool from the official website|Sign in to Mi Account on phone and PC|Connect your phone to Fastboot mode|Shut down. VPN/proxy|Charge your phone at least to 60%-->
3. Installation of ADB and Fastboot drivers
To work with Xiaomi through the computer, you need ADB (Android Debug Bridge) and Fastboot drivers. Without them, the PC will not be able to recognize the device in the desired modes.
The best way to install Minimal ADB and Fastboot is to:
- Download the tool with XDA Developers.
- Set it at the root of the C:\ disk (e.g., C:\adb\), avoiding Cyrillic paths.
- Connect your phone in Fastboot mode and check for recognition by command: fastboot devices If the device is displayed (for example, 1234abcd fastboot) β the drivers are installed correctly.
Windows may require manual driver installation:
- π₯οΈ Open Device Manager β find the Android Bootloader Interface or the device with the exclamation point.
- π₯ Right-click β Update the driver β Search on this computer.
- π Specify the path to the folder with ADB (e.g. C:\adb\) and confirm the installation.
On Linux and MacOS, drivers are usually installed automatically through package managers:
# For Ubuntu/Debian
sudo apt install adb fastboot
For MacOS (via Homebrew)
brew install android-platform-toolsπ‘
If the fastboot device command doesnβt show the device, try another USB-port (preferably USB 2.0 β they are more stable with Fastboot) or disable the antivirus, which can block access.
4. Download the correct version of TWRP
The error in choosing a version of TWRP is one of the main reasons for the "bricks": the firmware must match the code name of your device and the version of MIUI (Android 11/12/13).
You only need to download TWRP from trusted sources:
- π Official website TWRP (see Devices section for your model)
- π₯ XDA Developers (check the author's reputation)
- π Developer Telegram channels (e.g., @twrp_ru for Russian-language firmware)
A TWRP file usually has a.img extension (e.g., twrp-3.7.0_12-0-raphael.img).
- π Date of last update (older versions may not support newer MIUI)
- π Compatible with your version of Android (indicated in the description)
- π‘οΈ Reviews of other users (especially encryption bugs /data)
| Xiaomi model | Code name | Supported version of TWRP | Features |
|---|---|---|---|
| Redmi Note 10 Pro | sweet | 3.7.0_12-0 | Requires to disable dm-verity after firmware |
| POCO F3 | alioth | 3.6.2_11-0 | Problems with encryption on Android 13 |
| Xiaomi 12 | cupid | 3.7.0_12-1 | Support for section A/B |
| Redmi K40 | alioth | 3.6.2_11-0 | Same as POCO F3. |
After downloading, rename the file to twrp.img and place it in a folder with ADB (e.g., C:\adb\) to make it easier to enter commands in the next step.
What if there is no TWRP for your model?
5. TWRP firmware via Fastboot
Now, the most important step is to get TWRP firmware through Fastboot mode, and it's critical to keep track of the sequence of commands and the absence of errors.
Connect your phone to your computer in Fastboot mode (as described earlier) and execute the following commands in the terminal (CMD for Windows or Terminal for Linux/MacOS):
- Check the connection of the device: fastboot devices should display the serial number of the phone.
- TWRP Recovery: Fastboot Flash Recovery twrp.img
- For devices with a recovery_ramdisk partition (e.g., Xiaomi 12), add the command: fastboot flash recovery_ramdisk twrp.img
- Reboot to TWRP without rebooting to the system: fastboot boot twrp.img This will temporarily boot TWRP without writing to memory.
If it goes well, you'll see the TeamWin logo and the main recapture menu, and at this point, don't reboot to the system, you'll need to do additional things first, otherwise MIUI can rewrite TWRP with standard recapverie.
β οΈ Warning: Some models (e.g. Redmi Note 11 with MediaTek) may have an error called "Invalid partition" after the firmware TWRP. This requires a patch for vbmeta: fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img File vbmeta.img can be extracted from the official firmware via MIUI bootloader.
π‘
After first downloading to TWRP, make sure to back up the persist partition (in the Backup menu).This section contains data about IMEI and communication modules, and its damage can deprive you of the network.
6 Post Installation: How to Save TWRP After Rebooting
The main problem when installing TWRP on Xiaomi is the automatic recovery of the standard recavator after rebooting.
- In TWRP, go to Mount and make sure System and Vendor are marked.
- Download a zip file with forced encryption disabled (if your device encrypts /data).
- Sweat it through Install in TWRP.
- Install Magisk (for root rights and TWRP protection from overwriting).
For devices with dynamic partitions (Android 10+), you will additionally need:
- π§ Edit the /system/etc/recovery.fstab file (delete the lines from slotselect)
- π¦ Switch patch disable_dm-verity_forceencrypt.zip
- π Reboot to TWRP and check the safety of the changes
After this, TWRP will remain on the device even after the reboot, but remember that each MIUI update over the OTA can overwrite the Recovery.
- Download the full firmware zip file with Xiaomi Firmware Updater.
- Switch it through TWRP by disabling signature verification (Settings β Zip signature verification β Disable).
7. Common mistakes and their solutions
Even with the correct following of the instructions, errors can occur, and here are the most common ones and ways to fix them:
| Mistake. | Reason. | Decision |
|---|---|---|
| Fastboot: unknown command | An outdated version of Fastboot or drivers | Update Minimal ADB or install Googleβs Platform Tools |
| Failed to boot into recovery | Incompatible version of TWRP or blocked vbmeta | Sweep through the correct version of TWRP and disable verity (see Section 5) |
| Sensor doesn't work in TWRP | The TWRP build error for your model | Try another version or use the OTG-. |
| Invalid sparse file format at header | The damaged twrp.img file | Download the file again and check the MD5 checksum |
| Hanging on the Mi logo after firmware | The boot or dtbo section is damaged | Sweep the original boot.img through fastboot flash boot.img |
If the device does not boot into the system after installing TWRP, try:
- π Reflash boot.img from official firmware.
- π Restore a persist backup (if you have done it before).
- π§ Perform a reset via Format Data in TWRP (deletes all data!).
For anti-rollback devices (e.g., Xiaomi) 11T redmi K50) Attempting to downgrade can lead to a hard brick. Always check the anti-rollback version in the file before firmware. vendor/build.prop (parameter ro.vendor.build.security_patch).
8 Additional features after installation of TWRP
Successful TWRP installation provides access to a variety of features that are not available in standard MIUI firmware:
- π Nandroid Backup: Full system backup, including applications, data and settings, recommended before any experiment.
- π§Ή Bloatware Removal: You can safely remove embedded Xiaomi applications (e.g. Mi Browser, Mi Music) that cannot be uninstalled by standard means.
- π± Custom firmware ROM: for example, LineageOS, Pixel Experience or ArrowOS. Be sure to check compatibility with your model before you run the firmware.
- π Root rights via Magisk: allow you to deeply configure the system, but prevent you from using banking applications (solved using MagiskHide).
- π§ Change partition markup: for example, extend /system to /vendor (requires caution!).
One of the most useful features is the ADB Sideload mode in TWRP, which allows you to flash zip files directly from your computer, which is convenient if your internal memory is damaged, and you can use it to:
- In TWRP, select Advanced β ADB Sideload.
- On the computer, execute the command: adb sideload name file.zip
- Wait for the firmware to be completed (don't turn off the USB- cable!).
For experienced users, TWRP also supports:
- π Double boot (dualboot) of several ROM on a single device.
- π‘ Change the firmware region (e.g., from Global to China for additional features).
- π οΈ Recovery IMEI after failed firmware (requires a persist backup).
π‘
Always check for Google Apps before you run your custom ROM firmware. Some builds come without them, and you'll have to install them separately through Open GApps or NikGApps.