How to Update Xiaomi Smartphone with TWRP: A Complete Guide with Nuances

Update firmware on Xiaomi smartphones through custom recavery TWRP β€” It's a process that allows you to access the advanced capabilities of the device, but requires you to be careful and understand each step. OTA-Update, this method allows you to install unofficial assemblies, modified cores or go back to previous versions MIUI. However, improper actions can lead to a device blink (complete inoperability), so it is important to follow the verified instructions.

In this article, we will analyze the entire process from preparation to final setting, take into account the features of different models. Xiaomi/Redmi/POCO, And we'll warn you against common mistakes, and you'll learn how to choose the right firmware, avoid data loss, and what to do if something goes wrong. TWRP (version 3.6.0 newer).

1. Preparation of the smartphone: what to do before the firmware

Before you start upgrading via TWRP, make sure your device is ready for the procedure. The first and most important thing is an unlocked bootloader. Without this, customized backup and firmware installation is impossible. On Xiaomi devices, unlocking is done through the official Mi Unlock Tool, but requires a Mi Account and wait (usually 7-15 days).

The second is to check your smartphone model, and the firmware is strictly codenamed to the device (e.g., Redmi Note 10 Pro is codenamed sweet), and you can find it through the Device Info app or the ADB team:

adb shell getprop ro.product.device

Also prepare:

  • πŸ”‹ Battery charge of at least 60% (better 80-100%). interruption of the process due to discharge can make the phone inoperable.
  • πŸ“± Backup of the data, firmware through TWRP Often requires formatting of the section /data, This leads to loss of photos, contacts and apps.
  • πŸ”— Cable USB Type-C (or Micro-USB for older models) and a computer.
  • πŸ“‚ Folder with firmware and additional files (for example, Magisk for root rights) on internal memory or SD-map.

⚠️ Note: If you are upgrading from Android 10 Android 12+, It may be necessary to format the section. /data filesystem F2FS. This erases all data without any recovery capability!

πŸ“Š What type of firmware do you plan to install?
Official MIUI (Stable)
Official MIUI (Developers)
LineageOS (Pixel Experience)
other

2. firmware selection: official MIUI vs custom builds

Not only does the firmware type determine the functionality, but also the stability of the device, and Xiaomi offers two types of official firmware:

  • πŸ“¦ Stable version MIUI β€” Proven build with minimal bugs, but no last features.
  • πŸ› οΈ Webly – Updated weekly, contains new features, but may be less stable.

Custom firmware (e.g. LineageOS, Pixel Experience, Havoc-OS) gives you more freedom: pure Android without Xiaomi bells and whistles, regular security updates and additional settings. However, they can deprive you of some features (e.g., they can deprive you of some features (e.g., Xiaomi, IR-blaster MIUI).

Where to download:

Type of firmwareSourceRecommendations
Official MIUI (Stable/Developers)Official Xiaomi websiteChoose the version for your region (Global/EU/China). For TWRP, download the file with the.zip extension (not.tgz!).
Castom firmware (AOSP)XDA Developers, Telegram channelsCheck user reviews and compatibility with your model. Avoid "unofficial" builds without developer support.
Modified cores (e.g., Perseus)GitHubPower users only: An incompatible core can cause overheating or accidental reboots.

Check before downloading MD5-hash of the firmware file (for example, through the HashMyFiles utility) This will prevent downloading corrupt or fake files.

πŸ’‘

If you are upgrading from Android 11 to Android 12+, download the firmware package for your model separately. It must be flashed before the main firmware, otherwise errors with the camera modules or sensors may occur.

3. Install firmware via TWRP: step-by-step instruction

Once all the files are ready, we move to the most important step, and it is important that the process may differ depending on the type of firmware (official / castom) and the version of TWRP.

Steps for the official MIUI:

Reboot to TWRP (Put Power + Volume Up)|

Backup the current firmware (Backup β†’ Select partitions)|

Click Wipe β†’ Advanced Wipe and tick Dalvik, Cache, Data|

Install the firmware (Install) β†’ Choose. ZIP-file)|

Reboot (Reboot β†’ System)

-->

For custom firmware (for example, LineageOS), the order is different:

  1. In TWRP, run Wipe β†’ Format Data (this will remove everything from internal memory!).
  2. Install firmware, then GApps (if you need Google services).
  3. Make sure you have a Magisk (if you need a rut) or disable_forceencrypt (de-encrypt).
  4. Reboot. The first launch can take 10 to 15 minutes.

If after the reboot, the device is stuck on the MI logo or loaded into TWRP, then the firmware is not suitable or the formatting step is missed.

⚠️ Warning: Don't try to flash the same version over the non-functioning system! TWRP, Format all partitions (Format Data), then re-install with another firmware.

What if TWRP doesn’t see internal memory?
If after formatting Data partition is not mounted, connect the smartphone to the PC and transfer the firmware files through MTP (into TWRP: Mount β†’ Enable MTP). If it doesn’t help, use it. SD-map OTG-flash-drive.

4. Typical errors and their solutions

Even with the correct following of the instructions, errors can occur, and let's consider the most common and ways to correct them:

Mistake.Reason.Decision
Error 7 when installedThe firmware is not designed for your model or Android version.Check the device's codename and download the correct version. To bypass the error, you can edit the updater-script file in the ZIP-archive.
The device is loaded into FastbootThe boot boot boot boot.img file is damaged or missing.Sweep boot.img from the firmware via fastboot flash boot.img.
Permanent rebuttals after installationIncompatibility of a kernel or modules (e.g., a vendor)Slice vendor.img and dtbo.img from stock firmware.
TWRP asks for password after formattingEncryption is FBE (File-Based Encryption) enabled.Use it. disable_forceencrypt Or run the firmware without encryption.

If Wi-Fi/Bluetooth stopped working after firmware or the camera, the firmware and vendor versions are likely not the same.

  1. Download the full firmware package for your model (for example, with Xiaomi Firmware Updater).
  2. Unpack. ZIP-archive and file firmware-update and vendor through TWRP.
  3. Reset the device.

πŸ’‘

If the smartphone doesn't turn on after firmware, don't panic! In 90% of cases, it can be restored via Fastboot or re-routing in TWRP. The main thing is not to try to flash random files and format partitions without a backup.

5. Set up the system after the update

Once the firmware is successful, the device requires initial setup, and if you have an official MIUI, the process is not much different from factory reset: select a language, connect to Wi-Fi, and log in to your Mi Account (if required).

What needs to be done:

  • πŸ”§ Set up Root access (if you have been flashing Magisk): Open the Magisk app and perform an additional installation.
  • πŸ”„ Update Google Play Services and Apps through Play Market.
  • πŸ“‘ Check the sensors (gyroscope, compass) with the Sensor Test app. If something doesn't work, run through the missing modules.
  • πŸ”‹ Calibrate the battery: discharge the device to 0%, then charge to 100% without interruptions.

For official MIUI after firmware may require:

  • πŸ“± Activate OEM Unlock in the developer settings (if you plan to further manipulate).
  • πŸ”’ Reset network settings if mobile internet is not working (Settings) β†’ SIM-maps and mobile networks β†’ Resetting settings).
  • 🎯 Set up gestures and theme for yourself (in) MIUI This is done through themes and additional settings).

If after the update the device began to warm or discharge quickly, check:

  • πŸ” Background activity of applications (Settings) β†’ Battery β†’ Battery utilization).
  • πŸ“‰ Kernel version (Settings) β†’ The phone. β†’ The kernel version. Unofficial kernels may conflict with firmware.
  • πŸ”„ Availability of updates for firmware (especially relevant for custom assemblies).

6. How to roll back to the previous firmware version

If the new firmware is unstable or you don't like the changes, you can go back to the previous version.

Steps of rollback:

  1. Download the archive with the desired version of MIUI (required for your model!).
  2. Reboot to TWRP.
  3. Make a backup of the current system (Backup).
  4. Run Wipe β†’ Advanced Wipe and mark System, Data, Cache, Dalvik.
  5. Install the old firmware through Install.
  6. If required, run vendor and firmware from the older version.
  7. Reset the device.

Important: When rolling back from Android 12 to Android 11 (and below), you may need to:

  • πŸ”„ Formatting the Data section in ext4 (if previously F2FS).
  • πŸ“± Delete your Mi Account through TWRP (If the device asks for an old password).
  • πŸ”§ Shutdown AVB 2.0 (Android Verified Boot with the command: fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img

⚠️ Note: A rollback to an older version of Android may result in the loss of functionality of some applications (such as banking) as they require up-to-date versions. API. SafetyNet may also be in trouble.

7. Security and optimization tips

Firmware via TWRP is not only an update, but also a risk of disrupting the security of the device.

Safety:

  • πŸ” Don't install firmware from unverified sources. Attackers can embed backdoors or miners.
  • πŸ“± Before firmware, disable the Mi Account in the settings (Accounts) β†’ Mi Account. β†’ Delete your account.This will prevent blocking after resetting.
  • πŸ›‘οΈ After installing custom firmware, check SafetyNet status through the SafetyNet Test app. If it doesn't pass, use MagiskHide or the Universal SafetyNet Fix module.

Optimization:

  • ⚑ To speed up work, turn off animation in the developer settings (Windows animation) = 0.5x).
  • πŸ—‘οΈ Clean the cache regularly through TWRP (Wipe β†’ Cache/Dalvik).
  • πŸ”‹ If the battery is fast-setting, check apps for background activity with BetterBatteryStats.

For experienced users:

  • πŸ”§ Use it. EX Kernel Manager for fine-tuning the kernel (frequency) CPU, governor, etc.).
  • πŸ“‘ Optimize your network with Network Signal Guru (allows you to manually select frequencies) 4G/5G).
  • 🎯 Install. ViPER4Android To improve the sound (requires Magisk).

Remember, custom firmware and modifications can take your warranty out of the way. If the device is warranty, weigh the pros and cons before the firmware.

FAQ: Frequent questions about updating with TWRP

❓ Can I use Xiaomi to help you? TWRP loader-free?
No. TWRP is only installed on the unlocked bootloader, and without that, any attempt to flash custom recovers or firmware will result in an Anti-Rollback or Fastboot error.
❓ Why does not touchscreen work after firmware?
This is a typical problem with vendor and firmware incompatibility. Solution: Scroll vendor.img from stock firmware for your model. If it doesn't work, try a different firmware version (e.g. EU instead of Global).
❓ How to update TWRP last-minute?
Download the current.img TWRP file for your model from the official website. Then: Reboot to Fastboot (Foot + Volume Down).Scroll down the recavers with the command: fastboot flash recovery twrp-3.7.0-0-sweet.img Reboot to TWRP (fastboot boot twrp-3.7.0-0-sweet.img). Do not use fastboot on some Xiaomi models - this can lead to replacing TWRP with stock recavers instead of the first boot boot and use fastboot recovery.
❓ What is Anti-Rollback and How to Get Around It?
Anti-Rollback (or ARB) β€” This is Xiaomi's protection, which blocks rollbacks on older versions of the firmware. ARB, The device is locked (hard brick). ARB may TWRP file-wise /proc/anti_rollback or in the settings (about the phone) β†’ Version. MIUI β€” last digit in the assembly number. ARB You can only firmware a version with an equal or higher number. If you've already hit hard brick, you'll need to. EDL-Xiaomi Authorized Account for Firmware via Mi Flash Tool.
❓ How to return stock recaps after TWRP?
Download the official firmware for your model in.tgz format and retrieve the recovery.img file from it. Then: Reboot to Fastboot. Sweat stock receptacles: fastboot flash recovery recovery.img Reboot the device. TWRP will be replaced with the standard Xiaomi reclaimer. If you want to install TWRP again, repeat the process of unlocking the bootloader.