Xiaomi’s “Flashing is not allowed in lock state” error: 5 reasons and ways to solve it

Have you tried flashing a Xiaomi smartphone through fastboot or EDL, but you got a “flashing is not allowed in lock state” error? This means that the device bootloader is locked and the system does not allow you to change the firmware. This protection is a standard security measure from Xiaomi, designed to prevent unauthorized interference with the software. However, for users who want to install custom firmware, obtain root rights or even just restore the “brick” after a failed update, this error becomes a serious obstacle.

In this article, we will look at all possible causes of blocking, from Xiaomi’s official policy to hardware failures, and offer 5 proven ways to avoid the error, from legal unlocking through the Mi Unlock Tool to emergency methods for devices with a damaged bootloader. We will pay special attention to the risks of turning a smartphone into a “brick” and how to avoid them. If you are not sure about your actions, you better contact the service center, but for experienced users, our instructions will be a complete guide.

Why is it that “flashing is not allowed in lock state” is wrong?

The error occurs when you are trying to perform one of the following operations on a locked bootloader:

  • 📱 Install custom firmware (LineageOS, Pixel Experience, etc.) via fastboot flash.
  • 🔧 Switching to a modified recovery (TWRP, OrangeFox).
  • 🔄 Restore the device via MiFlash with unofficial ROM.
  • 🛠️ Try to get root rights (Magisk) without unlocking.

The main reasons for blocking:

  1. Xiaomi’s factory policy is that all MIUI devices have a locked bootloader by default, even with Redmi and POCO.
  2. Firmware Update: After updating via OTA, the bootloader can automatically lock again.
  3. Hardware Reset: If you have made a hard reset through recovery, the bootloader will remain locked.
  4. Partition damage: if the firmware is interrupted incorrectly (for example, disabling USB), the bootloader can go into an “emergency” locked mode.

It is important to understand that Xiaomi divides devices into two categories according to the level of protection:

Type of deviceLevel of protectionPossibility to unlock
Smartphones for the Global Market (Global ROM)Medium.Unlocking with Mi Unlock Tool (requires a wait of 7-30 days)
Smartphones for China (China ROM)High-pitchedUnblocking is possible, but requires a link to a Chinese Mi Account.
Anti-Rollback devices (e.g. Redmi Note 8 Pro)Very tall.Unlocking is possible, but the firmware of older versions of MIUI is blocked forever
Devices with damaged loadercriticalRecovery through EDL (Brick Risk) is required

⚠️ Note: If your device is in a series POCO F or Xiaomi 12/13, It can activate the Anti-Rollback function, which means that once unlocked, you will not be able to return to the old version. MIUI — Check the list of supported devices on the official Xiaomi website.

Method 1: Officially unlock through Mi Unlock Tool

This is the only legal and secure method of unlocking the bootloader recommended by Xiaomi itself, and is suitable for most devices, except those that are blacklisted (for example, with unpaid credit or stolen).

Requirements:

  • 📱 Xiaomi smartphone with version MIUI Update to 2 years old (older versions may require an update).
  • 🔑 Mi Account linked to the device (mandatory confirmation by email and phone!).
  • 💻 Windows computer (7/10/11) and the original cable USB.
  • 🔌 Mi Cloud Find Device (in security settings).

Step-by-step:

  1. Download Mi Unlock Tool from the official website and install it on PC.
  2. On your smartphone, go to Settings → About Phone → MIUI version and tap 7 times to activate Developer Mode.
  3. Back to Settings → Additionally. → For developers and include: 🔓 OEM Unlocking (unlocking) OEM). 🔌 Debugging by USB.

Mi Unlock Tool

Mi

Unlock

7 to 30 days

Download the latest version of the Mi Unlock Tool|Activate the Developer Mode|Turn on OEM Unlocking and debugging USB|Disable Mi Cloud Find Device|Connect the original USB-cable

-->

After waiting, repeat the procedure, the bootloader will be unlocked, now you can sew custom firmware and recovery.

⚠️ Note: If the Mi Unlock Tool gives an error "Couldn't unlock" or "Device not supported", this may mean: The device is tied to another Mi Account (for example, after buying a used one). USB-In such cases, try changing your account or contact Xiaomi Service Center.

Method 2: Unlocking with EDL (Emergency Download Mode)

If the Mi Unlock Tool doesn’t work (for example, due to a damaged bootloader or an error “flashing is not allowed” even after the official unlock), you can try EDL mode. This is an emergency firmware mode that bypasses standard bootloader checks. However, it requires special equipment (Qualcomm HS-USB QDLoader 9008) and knowledge.

WARNING: Using EDL without Xiaomi’s official permission may result in:

  • 🚨 Block IMEI (device).
  • 🧱 Permanent brick (if you sew incompatible firmware).
  • 🔒 Mi Account block (if the device is linked to another owner).

Instructions for experienced users:

  1. Download the firmware for your model in.mbn or.elf format (for example, with Xiaomi Firmware Updater).
  2. Install Qualcomm drivers (can be accessed via QFil).
  3. Put the device in EDL mode: Turn off the smartphone. Press Volume up + Volume down and connect to the PC. Qualcomm HS-USB QDLoader 9008 should appear in Device Manager.

MiFlash

QFil

clean all

What if the device is not defined in the EDL?
If the smartphone is not recognized as Qualcomm HS-USB QDLoader 9008, try: 1. Use another USB-port (preferably) USB 2.0 on the back of your PC. 2. Disable driver signatures in Windows (via gpedit.msc. 3. Try another cable (preferably the original one from Xiaomi). 4. If the device was in water or fell, damage is possible. USB-port - repairs are required.

After successful firmware through EDL, the bootloader will remain unlocked, but the warranty will be voided.This method is recommended only in extreme cases when other methods do not work.

Method 3: Bypassing the error through temporary checkout (for advanced)

If you get the error “flashing is not allowed in lock state” even after the official unlock, the problem may be in the time block that Xiaomi imposes on some devices, in which case you can try to bypass the check through modified fastboot commands.

Attention! This method doesn't work on all devices and can cause a failure. Use it at your own risk.

Instructions:

  1. Download Android Platform Tools and unpack it into a folder on your PC.
  2. Connect your smartphone in fastboot mode (clip Volume down + Power when the phone is off).
  3. Open the command line in the folder with fastboot and execute: fastboot oem unlock-go If the command doesn’t work, try: fastboot flashing unlock
  4. If you have a FAILED error (remote: 'Command not allowed'), try the combination: fastboot oem unlock 123456 (where 123456 is any six-digit code).

If none of the commands worked, then your device has a hardware lock, and unlocking is possible only through the Mi Unlock Tool or EDL.

Official Mi Unlock Tool|EDL (emergency mode)|Fastboot Commands|Another way |I haven't tried-->

Method 4: Test Point Recovery (for devices with a damaged boot loader)

If your Xiaomi doesn't turn on, isn't detected in fastboot, and gives an error "flashing is not allowed" even in EDL, the bootloader partition may be damaged, in which case Test Point, a hardware method of forcing the device to go to firmware mode, will help.

Warning: This method requires disassembling the device and working with a soldering iron or tweezers. Wrong actions can lead to irreversible damage to the board.

Step-by-step:

  1. Find a Test Point schema for your model (e.g., XDA Developers or 4PDA) and these are usually two pins on the motherboard that need to be closed.
  2. Turn off the device and disassemble it (unplug the battery!).
  3. Close the contacts of Test Point with tweezers or wire.
  4. Connect. USB-cable to PC – the device must be defined as Qualcomm HS-USB QDLoader 9008.
  5. Flush the stock firmware through MiFlash with the clean all and lock option (this will return the bootloader to its original state).

After successful firmware, assemble the device and try unlocking the bootloader through the Mi Unlock Tool.

⚠️ Note: On some models (Redmi Note 9 Pro, POCO X3 Test Point may not work because of the hardware protection, in which case the only way out is to contact the service center to request to flash the device through autorized EDL account (official Xiaomi account for firmware).

Method 5: Alternative methods for anti-Rollback devices

If your device supports Anti-Rollback (check the list here), you will not be able to return to the old version of MIUI once you unlock the bootloader.

  • 🔙 Firmware of the old version MIUI locked up forever.
  • 🛑 Trying to bypass Anti-Rollback will lead to a brick.
  • ⚠️ The only way out is to sew only new versions or custom firmware (for example, LineageOS).

How to check for Anti-Rollback:

  1. Go to fastboot (click Volume Down + Power).
  2. Connect the device to the PC and execute the command: fastboot getvar anti
  3. If the answer is anti: yes, then the answer is anti-Rollback.

If Anti-Rollback is present but you want to flash custom firmware, follow these steps:

  1. Unlock the bootloader through the Mi Unlock Tool.
  2. Download custom firmware compatible with your model and MIUI version (check on the developer forum).
  3. Install TWRP for your device (instructions are available on the official website).
  4. Sweep through the TWRP, but don’t try to roll back to the old version.

💡

Before firmware custom firmware always make a backup partition persist in TWRP. This will help restore the IMEI and camera modules if they stop working after firmware.

What do you do if nothing helps?

If all of these methods fail, your device may:

  • 🔒 It is blacklisted by Xiaomi (stolen, unpaid, blocked by the operator).
  • 🛠️ Has hardware damage to the bootloader (for example, after a failed firmware).
  • 📵 Linked to Chinese Mi Account without possibility of change of owner.

In such cases, there are three options:

  1. Contact Xiaomi Service Center: If you provide a check, you can try a formal recovery, but it can cost up to 50% of the price of the device.
  2. Sell the device for spare parts: if the smartphone is not turned on and sewn, you can get money for the display, battery or camera.

Before you hand over the device for repair, check it on the site Xiaomi IMEI Check – it may be listed as stolen, and unlocking is impossible.

💡

If your device was purchased by hand, always check it through fastboot oem device-info. If the answer is Device unlocked: false, then the bootloader is locked and it needs to be unlocked officially.

FAQ: Frequently Asked Error Questions: "Flashing is not allowed in lock state"

Can I unlock the bootloader without waiting 7-30 days?
No, Xiaomi has introduced a mandatory wait for theft protection. However, on some older models (for example, Redmi 4X, Redmi Note 5) you can bypass the wait via fastboot oem unlock-go, but this does not always work. On new devices (2020 and later), you can not get around the wait.
What happens if you flash custom firmware on a locked bootloader?
The device will not be sewn up – you will get a flashing is not allowed or remote error: ‘Flashing is not allowed in Lock State’. In the worst case, the smartphone will stop turning on (brick), and it will have to be restored via EDL.
How do I know if my Xiaomi bootloader is unlocked?
Go to fastboot (click Volume Down + Power When Phone is Shut Off) and connect to your PC. Run the command: fastboot oem device-info If the answer has a line Device unlocked: true, the bootloader is unlocked. If false, locked.
Can I unlock a bootloader on Xiaomi without a computer?
No, you need a PC with Mi Unlock Tool to unlock it, but some custom firmware (e.g. Xiaomi.eu) can be installed via TWRP if the bootloader is already unlocked.
What to do if after unlocking the bootloader the smartphone does not turn on?
There's probably a firmware error. Try: Swipe stock firmware through MiFlash in clean all mode. If the device is not identified, try EDL or Test Point. If nothing works, contact the service center.