Installing TWRP on Xiaomi with a locked bootloader: the full guide 2026

Installing a custom TWRP recavator on Xiaomi smartphones with a locked bootloader is a task that requires not only technical knowledge, but also an understanding of the specifics of the bootloader of this brand. Unlike devices with an unlocked bootloader, where the process takes 10-15 minutes, here you will have to go through the official unlock procedure, prepare special tools and take into account the nuances of a particular model – be it Redmi Note 12 Pro+, POCO F5 or Xiaomi 13T.

The main problem is that Xiaomi actively blocks unauthorized system changes through Anti-Rollback Protection (ARB) and firmware signature verification, which means that even after unlocking the bootloader, you may encounter errors like Invalid image format or Device is locked. In this article, we will discuss the legal way to circumvent restrictions, current tools (including Mi Unlock Tool and Fastboot Enhanced), as well as alternative methods for models with outdated versions of MIUI, where standard methods do not work.

Why Xiaomi is blocking the bootloader and what it means for the user

A blocked bootloader is a security mechanism that Xiaomi has implemented to prevent unauthorized access to system partitions, on the one hand, it increases the security of the device from malware and data theft, on the other hand, it makes life difficult for enthusiasts who want to install TWRP, get root rights or flash custom firmware.

What happens when you try to install TWRP on a locked bootloader:

  • πŸ”’ Denial of download: The device will simply ignore the command fastboot flash recovery and return to the standard recaveri.
  • ⚠️ Signature error: Modern Xiaomi models check digital signature of image TWRP. Without unlocking the bootloader, the system will refuse to install it.
  • πŸ“΅ Brick of the device: On some models (for example, Redmi) K50 Gaming) incorrect firmware recovery can lead to a "soft brik" - the device will only boot in fastboot.

It is important to understand that unlocking the bootloader through the official Mi Unlock Tool resets all data on the device. This is due to Xiaomi's security policy, which requires cleaning the /data partition when you change the status of the bootloader. Also note that some models (for example, Xiaomi 12S Ultra) have an additional protection - Anti-Rollback 4, which can block the device when you try to roll back to the old version of MIUI after unlocking.

πŸ“Š What Xiaomi model are you trying to unlock?
Redmi Note 10/11/12
POCO F3/F4/F5
Xiaomi 12/13/14
Another model

Device Preparation: From Installing Debugging to Backup

Before you start unlocking, you need to follow a number of mandatory steps, and skipping any of them can lead to the inability to complete the process or even loss of data.

List of mandatory actions:

  • πŸ“± Enable Developer Mode: Go to Settings β†’ The phone. β†’ Version. MIUI and tap the assembly number 7 times.
  • πŸ”§ Activate debugging on USB: In the developer menu (Settings) β†’ Additionally. β†’ For developers, turn on the debugging by USB and Unlock. OEM.
  • πŸ”„ Link your Mi Account: In Settings β†’ Xiaomi account β†’ Mi Cloud make sure the device is linked to the account. Without this, the Mi Unlock Tool won't work.
  • πŸ’Ύ Create a backup: Use the Mi PC suite ADB backup, as after unlocking all data will be erased.

Beginning with MIUI 12, Xiaomi has tightened the requirements: now the account must be registered at least 7 days ago, and the device must have an active Internet connection during unlocking. If you are trying to unlock the POCO M4 Pro or Redmi Note 11 Pro+, note that these models may require additional confirmation via SMS.

Developer mode is on

USB debugging and OEM unlocking activated

Device linked to Mi Account older than 7 days

Data backup created

Drivers installed ADB/Fastboot PC-only-->

⚠️ Note: On models with Qualcomm Snapdragon processor 8 Gen 1/2 (for example, Xiaomi 12 pro POCO F4 GT) Once the bootloader is unlocked, modem and vendor partitions may need to be flashed again, without which the mobile network and Wi-Fi may not work smoothly.

Unlock the bootloader through the Mi Unlock Tool

The only legal way to unlock a bootloader on Xiaomi is to use the Mi Unlock Tool utility. However, even here there are pitfalls: the program can refuse to unlock the device if:

  • πŸ•’ Mi Account Under 7 Days.
  • πŸ“΅ The device is not connected to the Internet via a mobile network (Wi-Fi may not work).
  • πŸ”„ There is an unofficial firmware installed on the device.
  • πŸ“± The model is blacklisted (for example, some versions of Redmi). K40 for the Chinese market).

Step-by-step:

  1. Download Mi Unlock Tool from the official website.
  2. Launch the utility on behalf of the administrator and log in under the same Mi Account as on your phone.
  3. Turn the device into fastboot mode: turn it off, then press Power + Volume Down.
  4. Connect your phone to your PC and wait until the program detects it.
  5. Press Unlock and confirm the action. It takes 5-10 minutes.

If the Mi Unlock Tool gives you a β€œCouldn’t unlock” error with the code 86006 or 86012, it means that you are trying to unlock the device too often. Xiaomi introduces a temporary lock (from 72 hours to 30 days) after several unsuccessful attempts, in which case you only have to wait or try to unlock from another account (but this violates Xiaomi’s rules and can lead to a device ban).

Error codeReason.Decision
86006Too frequent attempts to unlockWait 72-720 hours (depending on the number of attempts)
86012Mi Account is not tied to the deviceReconnect your account and wait 7 days
86001The Incorrect Version of MIUISweep the latest stable firmware through the Mi Flash Tool
86008The device does not support unlockingCheck the model on the official website

πŸ’‘

If the Mi Unlock Tool doesn’t see the device, try using the original one. USB-Xiaomi cable and port USB 2.0 on PC. Also check if Qualcomm drivers are installed HS-USB QDLoader 9008 (for Snapdragon devices) or MediaTek Preloader (for Dimensity devices).

Install TWRP after unlocking the bootloader

After successful unlocking, you can proceed to install TWRP. Here it is important to choose the correct version of the recovery for your model, as an incompatible image can lead to a breech or a broken touchscreen in the Recovery.

Instructions:

  1. Download the current version TWRP for your model from an official website or trusted source (for example, XDA For the Redmi Note 12 Pro+ fit twrp-3.7.0_12-vayu.img, for POCO F5 β€” twrp-3.7.0_11-mondrian.img.
  2. Rename the file to recovery.img and place it in the folder with fastboot.
  3. Open the command line in this folder and execute: fastboot flash recovery.img fastboot boot recovery.img
  4. After loading into TWRP Do not restart the device immediately – first slick Disable_Dm-Verity_ForceEncrypt.zip (If you plan to use root, otherwise the system may get stuck on the logo MI.

On some models (such as the Xiaomi 11T Pro), the standard fastboot flash recovery does not work due to AVB 2.0 protection.

fastboot flash recovery_a recovery.img


fastboot flash recovery_b recovery.img

⚠️ Attention: If after installation TWRP The device is not loaded into the system, but returned to the recaveri, which means that the integrity of the boot partition is violated. boot.img from the stock firmware through fastboot flash boot boot.img.

What if TWRP doesn’t see internal memory?
If, after loading into TWRP section /data It is not mountable, it is related to encryption. FBE (File-Based Encryption: 1. V TWRP Go to Wipe. β†’ Format Data (this will delete all data!). 2. Reboot to the Recovery and check if access to memory has appeared. 3. If not, please. Disable_Dm-Verity_ForceEncrypt.zip (download XDA).

Alternative methods for models with unlocking problems

Not all Xiaomi devices can be unlocked through the Mi Unlock Tool. For example, some models for the Chinese market (China ROM) or devices with MediaTek Dimensity processors (for example, Redmi Note 11 Pro+ 5G) may require workarounds.

Method 1: Using Fastboot Enhanced (for Snapdragon devices)

Fastboot Enhanced is a modified version of fastboot that allows you to bypass some of Xiaomi’s limitations, and it can flash TWRP even on partially locked devices.

  • πŸ“₯ Download Fastboot Enhanced with XDA Developers.
  • πŸ”§ Connect the device in fastboot mode and execute: fastboot_enhanced flash recovery recovery.img fastboot_enhanced reboot recovery
  • βš™οΈ If you have a "Signature verification failed" error, use the command: fastboot_enhanced --disable-verity --disable-verification flash recovery recovery.img

Method 2: DirtyCOW exploit (for older models on MIUI 10-12)

For MIUI 10-12-based devices (such as the Redmi Note 8 Pro or POCO X3 NFC), you can exploit the DirtyCOW vulnerability, which allows you to temporarily root and flash TWRP without unlocking the bootloader.

  1. Installations APK-exploit (e.g. DirtyCOW) TWRP Installer).
  2. Activate ADB mode and execute commands: adb push recovery.img /sdcard/ adb shell su dd if=/sdcard/recovery.img of=/dev/block/bootdevice/by-name/recovery
  3. Reboots to Recovery via Adb Reboot Recovery.

⚠️ Note: Using exploits can lead to a constant blink if you interrupt the process or use an incompatible version. TWRP. This method is not recommended for beginners.

Solving Common Errors When Installing TWRP

Even after successfully unlocking the bootloader, users often encounter errors, and consider the most common ones and how to fix them:

Mistake.Reason.Decision
FAILED (remote: 'Flashing is not allowed in Lock State')The bootloader is not fully unlockedRe-unlock using the Mi Unlock Tool or use Fastboot Enhanced
Invalid sparse file format at header magicThe damaged file recovery.imgDownload the image again, check the MD5 checksum
The device is loaded into a stock RecoveryStock firmware re-writes TWRPAfter installation TWRP go straight through Disable_Dm-Verity.zip
E: Unable to mount /dataFBE encryption is enabledRun Format Data in TWRP (all data will be deleted!)

If the device is stuck on the MI logo after installing the TWRP, it means that the integrity of the boot partition is violated.

  1. Reboot to fastboot (Power + Volume Down)
  2. Sweep through the original boot.img from stock firmware: fastboot flash boot.img
  3. If that doesn’t work, run a full flash flash through the Mi Flash Tool with the clean all option.

πŸ’‘

If TWRP Not installed by any of the methods, check if your model is in the list of devices with hardware lock (for example, Xiaomi Mi). A3 Android One or Black Shark 5 may require a special patch or rollback to an older version. MIUI.

Security and Risks: What to Know Before Unlocking

Unlocking the bootloader and installing TWRP is not only freedom of customization, but also potential risks.

  • πŸ”“ Loss of warranty: Xiaomi officially states that unlocking the bootloader will void the warranty.However, in some countries (e.g. the EU) this provision can be challenged through the right to repair law.
  • πŸ›‘οΈ Security vulnerability: Without bootloader protection, the device becomes more vulnerable to attacks via fastboot or ADB.
  • πŸ“΅ Problems with OTA-Updates: After installation TWRP stock-up MIUI They may not be installed. You'll have to hand-stitch them through the TWRP or fastboot.
  • πŸ”‹ Widevine's problems L1: In some models (for example, POCO F3) After unlocking, Widevine support is lost. L1, What reduces the quality of streaming on Netflix or Disney+ before 480p.

To minimize the risks, follow these guidelines:

  • πŸ”„ Regularly create backup copies of the section EFS (contain IMEI and modem data).
  • πŸ”’ Do not install unofficial firmware from unknown sources – this can lead to hard-brick (irreparable damage).
  • πŸ“± Before selling the device, return the stock recap and lock the bootloader back (via fastboot oem lock).

If you unlock the bootloader, but then change your mind, you can block it back. However, keep in mind that this will erase all data again, and on some models (for example, Xiaomi 13 Pro), re-locking can cause problems with the system. DRM-keys that are responsible for the quality of the camera and sound.

FAQ: Answers to Frequent Questions

Can I install TWRP without unlocking the bootloader?
Most modern Xiaomi devices (2020 and later) don’t. However, older models (like the Redmi Note 7 or POCO F1) have exploits like DirtyCOW that circumvent lockouts, but they only work on specific versions of MIUI and require technical skills.
Why does Mi Unlock Tool write "Wait 168 hours"?
This is the standard lock Xiaomi after several failed attempts to unlock. the wait depends on the number of attempts: 1-3 attempts: 72 hours, 4-6 attempts: 168 hours (7 days), 7+ attempts: 360-720 hours (up to 30 days).
How to return stock recap after TWRP?
To return the original recovery: Download the stock firmware for your model with Xiaomi Firmware Updater. Remove the recovery.img file from the archive. Sweat it through fastboot: fastboot flash recovery recovery.img If the device does not boot after that, swipe the full stock firmware through Mi Flash Tool with the clean all option.
Can I get root without TWRP?
Yes, with Magisk in patch boot mode: Download the latest version of Magisk (GitHub). boot.img From stock firmware. In Magisk, select Install. β†’ Select and Patch a File and specify boot.img. Sweep the patchy boot.img Fastboot: Fastboot Flash boot magisk_patched.img This method does not require TWRP, But the unlocked boot loader is still necessary.
What if the device does not turn on after installing TWRP?
This is a sign of a soft breeze. Try the following steps: Boot into fastboot (Power). + Volume Down. Sweat down the stock Recovery and boot.img: fastboot flash recovery recovery.img fastboot flash boot boot.img If that doesn’t work, run the full firmware through the Mi Flash Tool with the clean all option. for devices with Dynamic Partition (e.g. Xiaomi) 12) You may need to manually restore the partition table via fastboot enhance, and if the device doesn't respond at all (black screen, no button response), it's hard-brick. EDL-Mode (requires an authorized Xiaomi account or boxing).