[RECOVERY][3.5.2_9-2][Mi A2 Lite] Unofficial TWRP recovery for Xiaomi Mi A2 Lite

Search This thread

LinkBoi

Senior Member
Sep 13, 2018
63
61
Sony Xperia E1
Xiaomi Redmi 6A
Bugs in official:
- Update_engine_sideload (Flashing Custom ROMs in TWRP is broken)
- Mtp
- Compatibility with 4.9 kernels
- SD card being broken (someone reported)
- Decryption
- Changing slots while vendor is mounted reboots the device
- fix recovery bootloop from the advanced menu is broken
For anyone wondering, these are the bugs in the OFFICIAL version of TWRP that can be found in twrp.me. This unofficial TWRP is fully working
 

haxzion

Member
Jul 11, 2015
18
5
I should have posted here instead of making a new post about it,GREAT job btw recovery works perfect.
I don't know which partitions to select in order to make a full rom backup.I can see too many partitions, i thought i should only select boot/system/data but i am not sure....Also can i backup stock rom the same way??
 

linuxpauling

Member
Mar 10, 2021
30
3
Thank you Linkboi for this great information. I so much appreciate it. I am new to this so before I start (degoogling my phone with LineageOS ver 18.1) I wanted to ask a few questions (I'm sure I will have more once I get into it).

I have the Xiaomi Mi A2 Lite (the build # indicates V11.0.18.0.QDLMIXM). Again, I have never done this before but with the great instructions I have found here I plan to give it a go. Anyways my questions at this point are:

  1. Do I need to go through the "Install Rom as base" procedure? It may be that given my current version/build perhaps I don't need to do this? Also, as a newbie I do not understand the purpose of this part - is it in case things go sideways?
  2. TWRP files - I have managed to download (to my PC) the img and zip files numbered 3.5.0_0-1-daisy. Are these the best ones to use? Also, I assume I start with them on my PC as opposed to downloading them directly to my phone (I did originally download to phone)?
  3. Can one just download the TWRP and Rom files directly to phone as opposed to placing them on an SD card and then inserting to phone? Is there a particular reason?
  4. Force Encryption Disabler - do I require this for my particular phone/situation?
I think that is it for now. Thank you in advance for any advice/suggestions you can provide regarding the above.
 

LinkBoi

Senior Member
Sep 13, 2018
63
61
Sony Xperia E1
Xiaomi Redmi 6A
Thank you Linkboi for this great information. I so much appreciate it. I am new to this so before I start (degoogling my phone with LineageOS ver 18.1) I wanted to ask a few questions (I'm sure I will have more once I get into it).

I have the Xiaomi Mi A2 Lite (the build # indicates V11.0.18.0.QDLMIXM). Again, I have never done this before but with the great instructions I have found here I plan to give it a go. Anyways my questions at this point are:

  1. Do I need to go through the "Install Rom as base" procedure? It may be that given my current version/build perhaps I don't need to do this? Also, as a newbie I do not understand the purpose of this part - is it in case things go sideways?
  2. TWRP files - I have managed to download (to my PC) the img and zip files numbered 3.5.0_0-1-daisy. Are these the best ones to use? Also, I assume I start with them on my PC as opposed to downloading them directly to my phone (I did originally download to phone)?
  3. Can one just download the TWRP and Rom files directly to phone as opposed to placing them on an SD card and then inserting to phone? Is there a particular reason?
  4. Force Encryption Disabler - do I require this for my particular phone/situation?
I think that is it for now. Thank you in advance for any advice/suggestions you can provide regarding the above.
I think you are referring to the rom installation guide. That's outdated and probably won't be maintained since each maintainer has its own guide now.

1) You already are in Android Pie 10.0.18.0, so no you won't have to reinstall that as a base
2) Well the latest TWRP is 3.5.0_9-1, and I assume it is the best one to use (I mean it doesn't have any bugs I know of so yeah)
3) You can, but you must not format data till you get everything flashed:
- Flash ROM
- Flash TWRP
- Format data
- Reboot to system

(So instead of formatting data before flashing a ROM and TWRP, do it afterwards since you don't wanna loose the zips you have in your internal storage)

4) You don't need the forced encryption disabler
- Lineage 18.1 by @ reujea0 uses File Based Encryption, and the ZIP doesn't work on that anyways
- TWRP supports decryption so I don't see the reason to disable encryption provided that the ROM supports it (Lineage does)
 

LinkBoi

Senior Member
Sep 13, 2018
63
61
Sony Xperia E1
Xiaomi Redmi 6A
I should have posted here instead of making a new post about it,GREAT job btw recovery works perfect.
I don't know which partitions to select in order to make a full rom backup.I can see too many partitions, i thought i should only select boot/system/data but i am not sure....Also can i backup stock rom the same way??
Select boot, system and vendor. You could select data as well if you want them preserved. I assume you can backup stock the same way, but why would you use stock in the first place, it's pretty bad.
 

linuxpauling

Member
Mar 10, 2021
30
3
I think you are referring to the rom installation guide. That's outdated and probably won't be maintained since each maintainer has its own guide now.

1) You already are in Android Pie 10.0.18.0, so no you won't have to reinstall that as a base
2) Well the latest TWRP is 3.5.0_9-1, and I assume it is the best one to use (I mean it doesn't have any bugs I know of so yeah)
3) You can, but you must not format data till you get everything flashed:
- Flash ROM
- Flash TWRP
- Format data
- Reboot to system

(So instead of formatting data before flashing a ROM and TWRP, do it afterwards since you don't wanna loose the zips you have in your internal storage)

4) You don't need the forced encryption disabler
- Lineage 18.1 by @ reujea0 uses File Based Encryption, and the ZIP doesn't work on that anyways
- TWRP supports decryption so I don't see the reason to disable encryption provided that the ROM supports it (Lineage does)
Thank you so much for the prompt and complete reply - very much appreciated. When you note that the rom installation guide is outdated are your referring only to the "Install Rom as Base Section? So am I correct to understand that following the "Install custom Rom" section at the top of this thread is the appropriate steps for me to take?
 

LinkBoi

Senior Member
Sep 13, 2018
63
61
Sony Xperia E1
Xiaomi Redmi 6A
Thank you so much for the prompt and complete reply - very much appreciated. When you note that the rom installation guide is outdated are your referring only to the "Install Rom as Base Section? So am I correct to understand that following the "Install custom Rom" section at the top of this thread is the appropriate steps for me to take?
Nope, I was referring to the guide as a whole although the install stock as base still stands. The custom rims installation steps are our of date, follow what your maintainer says in the respective thread
 

linuxpauling

Member
Mar 10, 2021
30
3
Actually, having a small challenge here...

I have:
  • copied lineage 18.1 zip file to sd card (I assume I copy rather than extract?)
  • copied twrp img file to the project-tools directory on my pc
  • copied twrp zip file to sd card (I assume I copy rather than extract?)
  • opened powershell window
  • confirmed a connection from pc to phone (entered "./adb devices" which indicated a connection)
  • issued the "./adb reboot bootloader" command (which brings up the fastboot screen on phone)
However:
  • when I then try to issue the "./fastboot boot twrp-3.5.0...img" command it says "waiting for any device" and after a short time my phone seems to reboot/shut down (leaving the fastboot screen)
Am I doing this correctly. I know the instructions say to hold power/vol down button to go into fastboot screen (but it said to do so even before copying all the files to the sd card). And when I did it that way early on it still did not stay in the fastboot screen for very long at all.

Any suggestions much appreciated. Thanks you.
 

haxzion

Member
Jul 11, 2015
18
5
Select boot, system and vendor. You could select data as well if you want them preserved. I assume you can backup stock the same way, but why would you use stock in the first place, it's pretty bad.
So vendor partition gets deleted if i wipe internal storage?
 

LinkBoi

Senior Member
Sep 13, 2018
63
61
Sony Xperia E1
Xiaomi Redmi 6A
R
Actually, having a small challenge here...

I have:
  • copied lineage 18.1 zip file to sd card (I assume I copy rather than extract?)
  • copied twrp img file to the project-tools directory on my pc
  • copied twrp zip file to sd card (I assume I copy rather than extract?)
  • opened powershell window
  • confirmed a connection from pc to phone (entered "./adb devices" which indicated a connection)
  • issued the "./adb reboot bootloader" command (which brings up the fastboot screen on phone)
However:
  • when I then try to issue the "./fastboot boot twrp-3.5.0...img" command it says "waiting for any device" and after a short time my phone seems to reboot/shut down (leaving the fastboot screen)
Am I doing this correctly. I know the instructions say to hold power/vol down button to go into fastboot screen (but it said to do so even before copying all the files to the sd card). And when I did it that way early on it still did not stay in the fastboot screen for very long at all.

Any suggestions much appreciated. Thanks you.
You probably dont have the fastboot drivers installed
 

jkrhu

Member
Apr 11, 2016
26
11
Xiaomi Mi A2 Lite
Actually, having a small challenge here...

I have:
  • copied lineage 18.1 zip file to sd card (I assume I copy rather than extract?)
  • copied twrp img file to the project-tools directory on my pc
  • copied twrp zip file to sd card (I assume I copy rather than extract?)
  • opened powershell window
  • confirmed a connection from pc to phone (entered "./adb devices" which indicated a connection)
  • issued the "./adb reboot bootloader" command (which brings up the fastboot screen on phone)
However:
  • when I then try to issue the "./fastboot boot twrp-3.5.0...img" command it says "waiting for any device" and after a short time my phone seems to reboot/shut down (leaving the fastboot screen)
Am I doing this correctly. I know the instructions say to hold power/vol down button to go into fastboot screen (but it said to do so even before copying all the files to the sd card). And when I did it that way early on it still did not stay in the fastboot screen for very long at all.

Any suggestions much appreciated. Thanks you.
You need to download MiFlash to install necessary drivers.

After unlocking bootloader, when flashing recovery, use these commands -
fastboot flash boot_a filename.img
fastboot flash boot_b filename.img

You will flash TWRP on both slots this way. I don't know if you'll need to reflash TWRP after formating partitions and installing custom rom, but do so, just in case. Also I'd rename the TWRP file to just TWRP.img for ease of use.

You can actually mount your data partition in TWRP after formating them, to send files you want to flash to internal memory, so you don't need an SD card. You do your installs, reboot into the other slot and that's it.
 

LinkBoi

Senior Member
Sep 13, 2018
63
61
Sony Xperia E1
Xiaomi Redmi 6A
Status update:

For anyone wondering, TWRP 3.5.2 is coming soon. Highlights of said update include:
- a text editor (nano to be precise)
- Digest verification fixes
- Terminal and File Browser improvements
- Lang / Translation updates
and more.

Having said that, a TWRP addon.d setup is being worked on, that will remove the need to reflash TWRP after flashing ROM or an OTA through a ROM updater. Last but not least, the EDL reboot button may be added back, assuming it works without any issues.
 

loserion

Member
  • Dec 11, 2020
    21
    6
    Bangladesh
    itsuday.home.blog
    Status update:

    For anyone wondering, TWRP 3.5.2 is coming soon. Highlights of said update include:
    - a text editor (nano to be precise)
    - Digest verification fixes
    - Terminal and File Browser improvements
    - Lang / Translation updates
    and more.

    Having said that, a TWRP addon.d setup is being worked on, that will remove the need to reflash TWRP after flashing ROM or an OTA through a ROM updater. Last but not least, the EDL reboot button may be added back, assuming it works without any issues.
    You peru!!!
     
    • Like
    Reactions: LinkBoi

    Top Liked Posts

    • There are no posts matching your filters.
    • 5
      Status update:

      For anyone wondering, TWRP 3.5.2 is coming soon. Highlights of said update include:
      - a text editor (nano to be precise)
      - Digest verification fixes
      - Terminal and File Browser improvements
      - Lang / Translation updates
      and more.

      Having said that, a TWRP addon.d setup is being worked on, that will remove the need to reflash TWRP after flashing ROM or an OTA through a ROM updater. Last but not least, the EDL reboot button may be added back, assuming it works without any issues.
      3
      Team Win Recovery Project 3.5.2_9-2 Update

      Download:

      TWRP image: https://drive.google.com/file/d/19ysSbW31NG4QF5OClbox-mArIb17KbpT/view?usp=sharing
      TWRP Installer: https://drive.google.com/file/d/1-wk_0kOe_e-2XDDiv08BxJhn1ixWXjUw/view?usp=sharing

      Changelog (from 3.5.0-1):
      - Synced with all TWRP 3.5.2_9 source changes (https://twrp.me/site/update/2021/04/07/twrp-3.5.2-released.html)
      - Added addon.d script to make TWRP persist through OTA updates and dirty flashes of the same ROM
      - Removed the ability to flash TWRP through the Magisk app (Magisk Manager), as it was causing issues
      - Bump device version to 2
      - Set ro.treble.enabled to true since daisy supports treble
      - fstab: Add removable flag to vendor
      - General system stability improvements to enhance the user experience
      1
      Status update:

      For anyone wondering, TWRP 3.5.2 is coming soon. Highlights of said update include:
      - a text editor (nano to be precise)
      - Digest verification fixes
      - Terminal and File Browser improvements
      - Lang / Translation updates
      and more.

      Having said that, a TWRP addon.d setup is being worked on, that will remove the need to reflash TWRP after flashing ROM or an OTA through a ROM updater. Last but not least, the EDL reboot button may be added back, assuming it works without any issues.
      You peru!!!
      1
      Is the latest version stable for use?
      Yes
      1
      Clarifications for the TWRP addon.d function (TWRP Survival)

      TWRP's addon.d will only work in the following scenarios:
      a) When updating your ROM through the ROM's Updater application
      b) When dirty-flashing a newer build of the same ROM you have installed from recovery

      Last but not least, TWRP's addon.d (TWRP survival) may not work in all ROMs as some ROMs choose not to have permissive update-engine domain. This essentially results in SELinux denials, preventing the addon.d script from executing when SELinux is enforcing. You can read more about the said issue here. Thereby, having Magisk is the only way of having a working addon.d environment consistent to all ROMs as of now since it makes ROMs allow all addon.d scripts to run (makes update-engine permissive). Having said that and as mentioned in the previous link, some ROMs like LineageOS and CrDroid do not need Magisk for addon.d scripts to work, as they don't block said scripts by default.
    • 9
      TWRP-recovery.jpg

      Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.

      Code:
      Code:
      #include <std_disclaimer.h>
      /*
      *
      * We are not responsible for bricked devices, dead SD cards,
      * thermonuclear war, or you getting fired because the alarm app failed. Please
      * do some research if you have any concerns about features included in this ROM
      * before flashing it! YOU are choosing to make these modifications, and if
      * you point the finger at us for messing up your device, we will laugh at you.
      *
      */

      Features:
      - Open Source
      - Payload.bin support (ROM flashing works)
      - Proper MTP support (for both 4.9 and 3.18 kernels)
      - Working decryption for both FBE and FDE
      - Adoptable Storage is working
      - Android 11 support (No bootloops to recovery mode)
      - NTFS, F2FS, exFAT, FAT32 support for SD Cards and USB drives
      - Ability to flash splash images directly to the splash partition
      - Adjusted theme to account for the notch (the clock doesn't overlap with the notch)
      - No TWRP app installation prompts
      - Older 3.4.0 button-style reboot menu instead of the newer listbox-style one
      - Addon.d script to make TWRP survive ROM updates

      Download:
      TWRP image: https://drive.google.com/file/d/19ysSbW31NG4QF5OClbox-mArIb17KbpT/view?usp=sharing
      TWRP Installer: https://drive.google.com/file/d/1-wk_0kOe_e-2XDDiv08BxJhn1ixWXjUw/view?usp=sharing

      Installation Instructions:
      - Make sure your bootloader is unlocked. If not, unlock it first.
      - Reboot to Bootloader (aka Fastboot mode)
      - Execute:
      Code:
      fastboot boot twrp-3.5.2_9-2-daisy-unofficial.img
      - Flash the TWRP Installer zip to keep TWRP permanently

      Notes:
      - You can ignore any "Failed to unmount /vendor: Device or resource busy" errors since they do not cause any issues (this
      happens when switching the active slot while the vendor partition is mounted).
      - This TWRP does not have the newer 3.5.0 theme changes in the reboot menu because it is confusing for a significant amount
      of users and does not match the rest of the button-style design.
      - The TWRP app checks and prompts have been completely removed due to the app causing a lot of issues including bootloops
      since it is not designed for A/B devices.
      - The portrait_hdpi theme has been adjusted to have more padding in the status bar and to account for the presence of the
      notch (the clock's position has been modified in order for the clock not to get overlapped by the notch)
      - TWRP's addon.d will only work in the following scenarios:
      a) When updating your ROM through the ROM's Updater application
      b) When dirty-flashing a newer build of the same ROM you have installed from recovery
      - TWRP's addon.d (TWRP survival) may not work in all ROMs as some ROMs choose not to have permissive update-engine domain. This essentially results in SELinux denials, preventing the addon.d script from executing when SELinux is enforcing. You can read more about the said issue here (https://github.com/topjohnwu/Magisk/commit/cba0d040000d6ff38c6646bb9d7daa12beae2878). Thereby, having Magisk is the only way of having a working addon.d environment consistent to all ROMs as of now since it makes ROMs allow all addon.d scripts to run (makes update-engine permissive). Having said that and as mentioned in the previous link, some ROMs like LineageOS and CrDroid do not need Magisk for addon.d scripts to work, as they don't block said scripts by default.

      Source code:
      Recovery Source: https://github.com/LinkBoi00/android_bootable_recovery
      Device tree: https://github.com/LinkBoi00/twrp_device_xiaomi_daisy
      Kernel source: https://github.com/LinkBoi00/twrp_kernel_xiaomi_daisy

      XDA:DevDB Information
      TWRP-3.5.2_9-2-Unofficial, Tool/Utility for the Xiaomi Mi A2 Lite

      Contributors
      LinkBoi
      Source Code: https://github.com/LinkBoi00/twrp_device_xiaomi_daisy


      Version Information
      Status:
      Stable
      Current Stable Version: 3.5.2_9-2
      Stable Release Date: 2021-05-04

      Created 2020-10-19
      Last Updated 2021-05-04
      7
      TWRP 3.5.0_9-1 Recovery Update

      Download:
      TWRP image: https://drive.google.com/file/d/1Pi4m8XLAMu_RUhKaaHuggkfiY6QQB6-Q/view?usp=sharing
      TWRP Installer: https://drive.google.com/file/d/18tIyVJ6I4ReqllI29wrhnvJ7B-k3IDgE/view?usp=sharing

      Changelog (from 3.4.0-3):
      - Merge all TWRP 3.5.0_9 source changes (https://twrp.me/site/update/2020/12/31/twrp-3.5.0-released.html)
      - Fixed Decryption for both FBE and FDE
      - Fixed Adoptable Storage issues
      - Fixed recovery bootloops with Android 11 ROMs
      - Backup persist as image instead of as a filesystem
      - Updated the recovery installer
      - Added support for F2FS
      - Updated kernel, for the bootable image, to 4.9.250
      - Set maximum and default brightness to 101 and 85 respectively
      - Include logcat for debugging
      - Changed the system mount point from /system_root to /system
      - Updated MTP configuration from @TogoFire
      - General system stability improvements to enhance the user experience

      More info:
      - This TWRP does not have the newer 3.5.0 theme changes in the reboot menu because it is confusing for a significant amount
      of users and does not match the rest of the button-style design.

      Sources:
      - Recovery source: https://github.com/LinkBoi00/android_bootable_recovery
      - Recovery device tree: https://github.com/LinkBoi00/twrp_device_xiaomi_daisy
      - Recovery kernel Source: https://github.com/LinkBoi00/twrp_kernel_xiaomi_daisy

      At 11:35 PM UTC of 01/01/2021 the files were updated to fix the logat function. If you updated TWRP before that, you can continue using it. The download links have been updated both in this post and In the OP
      5
      Status update:

      For anyone wondering, TWRP 3.5.2 is coming soon. Highlights of said update include:
      - a text editor (nano to be precise)
      - Digest verification fixes
      - Terminal and File Browser improvements
      - Lang / Translation updates
      and more.

      Having said that, a TWRP addon.d setup is being worked on, that will remove the need to reflash TWRP after flashing ROM or an OTA through a ROM updater. Last but not least, the EDL reboot button may be added back, assuming it works without any issues.
      3
      Team Win Recovery Project 3.5.2_9-2 Update

      Download:

      TWRP image: https://drive.google.com/file/d/19ysSbW31NG4QF5OClbox-mArIb17KbpT/view?usp=sharing
      TWRP Installer: https://drive.google.com/file/d/1-wk_0kOe_e-2XDDiv08BxJhn1ixWXjUw/view?usp=sharing

      Changelog (from 3.5.0-1):
      - Synced with all TWRP 3.5.2_9 source changes (https://twrp.me/site/update/2021/04/07/twrp-3.5.2-released.html)
      - Added addon.d script to make TWRP persist through OTA updates and dirty flashes of the same ROM
      - Removed the ability to flash TWRP through the Magisk app (Magisk Manager), as it was causing issues
      - Bump device version to 2
      - Set ro.treble.enabled to true since daisy supports treble
      - fstab: Add removable flag to vendor
      - General system stability improvements to enhance the user experience
      2
      Is anything wrong with official daisy TWRP build? Why go with unofficial? Couldn't tell from description...
      Bugs in official:
      - Update_engine_sideload (Flashing Custom ROMs in TWRP is broken)
      - Mtp
      - Compatibility with 4.9 kernels
      - SD card being broken (someone reported)
      - Decryption
      - Changing slots while vendor is mounted reboots the device
      - fix recovery bootloop from the advanced menu is broken
    Our Apps
    Get our official app!
    The best way to access XDA on your phone
    Nav Gestures
    Add swipe gestures to any Android
    One Handed Mode
    Eases uses one hand with your phone