How to root Xiaomi Mi A2 and install TWRP recovery

Xiaomi Mi A2 root

Gaining the root access unlocks the door for some serious customization. You get to totally own the devices as you become the superuser of the system when you root the device, which is why many of us just have to root our Android device.

Some of the reasons behind rooting a device are to take proper with-data backups of apps and games which makes life easier when you switch ROMs, but there is much more to it than just data backups. You can even tweak the system settings to your benefit.

Xiaomi has released the MI A2 after the spectacular success of the Mi A1 from last year. Needless to say, those who prefer a simple and pure stock OS over the company’s MIUI OS are preferring the Mi A2 over other other Android devices from Xiaomi and other popular OEMs.

Related: Best Xiaomi phones [2018]

Anyway, we think whatever be the reason behind your decision to buy the Mi A2, you may want to root the device for a number of reasons. You will need to unlock the bootloader of your Mi A2 first for this, followed by installation of TWRP recovery, which facilitates installing root.

So, without further ado, here’s how you can root the Xiaomi Mi A2.


Do not try anything given on this page if you do not know completely what you are doing. In case any damage occurs, we won’t be held responsible.

Xiaomi Mi A2 TWRP Recovery

Download the TWRP recovery file for your variant of the Xiaomi Mi A2 from below.

This TWRP is the work of developer TingyiChen over at XDA, whom you shall thank for his work if it helps you.

Related articles:

Xiaomi Mi A2 and Mi A2 SE Root

Here’s an easy step-by-step guide to help you install TWRP recovery on your Xiaomi Mi A2. You can use the TWRP recovery to easily gain root access on the device.

Before you try the guide below, let us tell us what the guide does in short. You can follow the instruction set in the detailed guide below to do all of this.

  • First, we find the non-active partition and install TWRP in that partition.
  • Then we convert the non-active partition to active and reboot to recovery mode to access TWRP.
  • Next, we installed either of root or DM verity disabler file.
  • Now that our job with TWRP is done, we set the originally active partition back as active, and reboot to Android.

With the above in your knowledge, let’s see the detailed guide below to install TWRP and then root the Mi A2.

  1. Make sure that you’ve unlocked the bootloader for the Mi A2 before proceeding.
  2. Download the required files:
    1. TWRP file from above
    2. Root file (Magisk 16.7): Magisk
    3. DM verity disabler:
  3. Connect your Mi A2 to the PC using the USB cable it came with.
  4. Transfer all the downloaded file (TWRP, Magisk, and DM verity disabler) to your device. Do keep a copy of TWRP IMG file on your PC too. Keep the Mi A2 connected to PC.
  5. Make sure you have enabled USB Debugging on your Mi A2, as explained in the bootloader unlock post above (step 1). You may need to re-do it after unlocking the bootloader.
  6. Now open a command window inside the folder where you have the TWRP file from above. For this, go that folder, and then type cmd in the address bar of that folder’s window, and then hit the enter key. A command window will open up, and its location will be that folder.
  7. Boot your Mi A2 into bootloader/fastboot mode. For this run this command:
    adb reboot bootloader

    └ If you get a permission dialogue on your device to “Allow USB debugging”, tap OK.
    Xiaomi fastboot mode

  8. Find the active boot slot of your device (may differ per user). The Mi A2 uses A/B partitioning system, meaning either of A and B partition is active. You have to install the TWRP on the non-active partition, so here’s what to do. Run the command below to find active partition:
    fastboot getvar current-slot
  9. Not down the active partition. For the purpose of this guide, let’s assume it is A partition that is active. Which means B is the non-active partition, and we need to install TWRP on the B partition. (If the active partition on your device is B, then you need to install TWRP on A partition.)
  10. Install TWRP recovery on the B partition of your device by running the command below. To run a command, simply type this in the command window and then hit the enter key.
    fastboot flash boot_b <name of twrp file here>.img
    fastboot twrp flash
    Example command (change the filename as the need be)

    Tip: The command ends with the filename of the TWRP file, so change the filename in the command as required.

  11. Now set the non-active partition (B, in our case) as the active partition by running the command below. (If your active partition was B, then make A active partition now.)
    fastboot set_active b
  12. Careful! Hold the volume up button now, and while holding the Volume up button, run the command below to reboot into recovery mode to access TWRP first before starting to Android.
    fastboot reboot
  13. Enter the password or PIN you are using to let system decrypt in recovery mode and get to TWRP recovery. (It won’t ask if you are not using any PIN or password on the device.)
  14. You will see TWRP recovery now. When asked to ‘Keep System Read only?’, tap on the ‘Keep Read Only’ button to not allow for system modifications.
  15. Time to root the Mi A2! You have to install the root file (Magisk ZIP file) now. Go back to the home screen of TWRP and tap on Install, > then select the ZIP file,, and confirm on the next screen.
    • In case you don’t want to root the device, be sure to install the DM verity disabler file now (in place of Magisk file) to get the Mi A2 to boot normally (prevent from bootlooping).
  16. Activate the slot A back. Yes, with TWRP installed on B partition, it’s time to set the originally active partition, A in our case, active again.
    → For this, in TWRP, press the home button, and then Reboot > and activate slot A now.
  17. Reboot now and your Mi A2 will start to Android and will be rooted too. You can verify root access on your Mi A2 using a root checker app.

That’s all.

Do let us know if you need any help over the Mi A2 root matter.

Posted by
Kapil Malani

A die-hard Liverpool FC fan, Kapil is a big fan of Batman, Android and street Cricket. In that order, probably. Email:


  1. I don’t knwo why but your root dosen’t work..
    I succeded to boot on my system but no root. And i did exactly again your steps and now i’m blocked again.

  2. I followed all steps successfully but when i checked by root checker app, it showed me “no root access” after that when i tried to enter recovery mode holding volume up button while booting it showed “no command” then again i flashed with recovery image from above steps then i entered in recovery mode. I repeated two times but failed to root.

  3. writing ‘boot_a’…
    FAILED (remote: Flashing is not allowed in Lock State)
    what i do? cant do nothing cause of this
    remove my pin lock?

  4. At the magisk install step, I ran into a problem “unable to repack boot image.” It turns out you need to switch to the other slot first.

  5. Hello when I try to install root zip , it install without problem but when I open my phone and check the root status phone didn’t get the root ( I use magisk v18.1(18100).zip version )

    Please help me

Comments are closed.