yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Encryption is on by default. Adding a password/pin/etc just encrypts the key.

I know that twrp is a traditional place to do backup and restore from... But I'm not familiar with this. I have used dd to backup partitions (boot and system) and fastboot to restore. I rely on titanium and rsync to backup apps and data.

A twrp partition backup of userdata is useless without the encryption keys, which are stored elsewhere... I don't know if the details are known. I was looking at this the other day for someone and found 2 partitions that seemed to contain encryption keys.

A file backup (eg. tarball) would be ok I guess. You'd obviously need to have userdata setup with encryption and be able to mount it to do the restore.

Sounds bad. I didn't see that upgrading to 10.0.13.0.

If you just took a backup, that shouldn't have changed anything.

Do you have that SD card inserted? I'd try removing it so android doesn't have to see it.

If you've got a backup of your apps and data, the last resort would be a factory reset. If it's a problem with userdata or encryption, that should fix it.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
I tested taking the sdcard out (ejecting it first) and reboot... same strange behaviour. What really is strange is after the initial lagging the phone works just fine and smooth, the problem is only at starting up.

Will wait to get v10.0.13.10 complete stock rom to flash it clean (but cant find it anywhere yet)

Thanks!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] dallathebest:
When i do these command:

fastboot flash boot_b vanilla_boot.img

fastboot boot patched_boot.img

i have a bootloop, why?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Hi [MENTION=4964062]a1291762[/MENTION]

As you know I "have" 2 Mi A2 Lite; mine and a relative's (I'm the "mantainer"...)

I'm becoming a bit upset respect this procedure. I come from the easier rooting Nexus 4, Nexus 5X, and the behaviour of the combination of 2 slot device / Magisk / OTA update sometimes seems ramdom to me.

The other day I updated both phones (from 10.0.11.0 to 10.0.12.0) following the recommended procedure (Uninstall Magisk - Install OTA - Install Magisk to the inactive slot - reboot):

- my relative's had no problem

- mine ended (it's a bit longer...) with no access to userdata partition

Yesterday I repeated the same procedure to my relative's in order to update it from 10.0.12.0 to 10.0.13.0. But I got the OTA install error warning that received mine.

I'm sure I haven't tampered any partition. That's what I've read at logcat:

What could be failing?

If I'm not wrong, reflashing fastboot 10.0.12.0, applying OTA and reinstalling Magisk by booting pached_boot 10.0.13.0 would work fine, but as I've had this problem several times, I'd like to learn what's not working. (Or what may I be doing wrong, despite I'm sure I've done nothing different after the update)

Thanks!

xabier
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Backup

BTW, a1291762, It's a bit off topic, but as you mentioned it, and as there are so many different ways to do it, would you mind to share your exact backup procedure before updating? It would be very helpful.

(I'm a linux-ubuntu user)

Thanks!

xabier
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Thanks, again!

It's very useful in deed.

You're right and I'm not an expert in programming, but I can follow/adapt instructions well enough.

Now I see that some problems I had backing up with Titanium (calls and similar) are not only mine. And also copy separately SMS, calls (and wifi registres as well).

I've also found that I cannot fully trust cloud backups: both for missing data and for not giving away all my life to Google.

So, I'll start with a more regular backup supported by your criteria, and after will try the automatisation of the process.

In case I decide to travel the perl roads, I'll come back to you! ;)

Thanks!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
That was me... and a prove you are a very kind and helpful guy!

I posted a question here: https://xdaforums.com/gen...rdata-t3958666, but I haven't been lucky (at the moment).

I also assume that people from TWRP must know something about this, as TWRP decrypts userdata, but this site is so big, that I'm not sure how to be read by somebody with this knowledge.

Said that, and just to discard it, a silly thought: could install (not boot) twrp make any difference in accessing encrypted userdata?

Thanks,

xabier
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
It previously did.

TWRP 3.2.3 could not mount /data when booted but could when installed.

But 3.3.1 hasn't needed this in my experience.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Understood! Thanks!

BTW, any explanation why OTA refuses to install, complaining on system partition, if I had not tampered it?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
No. I had the same thing happen a few OTAs ago. Bad QA and release process?

I guess this is (partly) why they post fastboot images?
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
It's good to know it's not on my side, but this kind of inconsistencies has lead some of us (at least me), to make mistakes and lose data.

You believe you know the procedure, how to act in case of difficulty, but still you can suffer unexpected problems...

Hope I've truly learned, but in an unlocking/rooting guide, the first point should be: become familiar with backup, backup, practice again, backup... and once you are confident with the backup process, do (nearly) what you want.

Thanks a1291762!
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
Detecting the 10.0.13.0 security parch I completely uninstalled my Magisk and installed the OTA without problems. After my "experience" re <[GUIDE] Install Magisk with proper support for OTA updates #946> I used the magisk_boot.img above to get root and Magisk again. The device booted, and was Magisk rooted, fine. So, I went on with Magisk manager installing the patched_boot into the other slot. Crash, it ended up in the password issue, individual flashing magisk_boot into both slots replaced the password problem by permanent bootloop. TWRP had not been installed, system image (10.0.12.0) had not been touched but was also flashed anew but no success. As well, vanilla_boot (10.0.13.0?), re above, did not remove the bootloop. Until any better idea I go on testing, however, I hope I can avoid factory reset....

Any clue?

Thanks, grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
For your main problem I haven't got an answer/solution yet, but I'm not sure this pass I quote was necessary.

After booting with patched_boot, installing Magisk (I guess directly), there's nothing else you need to do
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
After booting with patched_boot, installing Magisk (I guess directly), there's nothing else you need to do[/QUOTE]

Thanks, you are right and I know better now: I mixed the process with step #14 from <[GUIDE] Install Magisk with proper support for OTA updates> neglecting that my update had already been successfully completed (actually, I was already on 10.0.13.0 disregarding the warning in Magisk Manager). Now I try to go on with flashing the images of payload.bin from 10.0.13.0 to avoid loosing my data and apps. (Apart from the non-Google Playstore apps (like iGO etc.) they could be restored from my Google account).

Hopefully the approach on: page 73 ff of <[GUIDE] Install Magisk with proper support for OTA updates> will help. But any better advice is well appreciated!

Thanks

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Thanks, you are right and I know better now: I mixed the process with step #14 from <[GUIDE] Install Magisk with proper support for OTA updates> neglecting that my update had already been successfully completed (actually, I was already on 10.0.13.0 disregarding the warning in Magisk Manager). Now I try to go on with flashing the images of payload.bin from 10.0.13.0 to avoid loosing my data and apps. (Apart from the non-Google Playstore apps (like iGO etc.) they could be restored from my Google account).

Hopefully the approach on: page 73 ff of <[GUIDE] Install Magisk with proper support for OTA updates> will help. But any better advice is well appreciated!

Thanks

grufty47[/QUOTE]

Yes, but in any case, don't flash 10.0.12.0 or earlier. It seems that doing so, breaks something and you lose access to your (usually encrypted) userdata.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
Yes, but in any case, don't flash 10.0.12.0 or earlier. It seems that doing so, breaks something and you lose access to your (usually encrypted) userdata.[/QUOTE]

Even flashing the individual partitions from the payload.bin of <miui_DAISYGlobal_V10.0.13.0.PDLMIXM_737bff8748_9.0> one by one did not remove my password or bootloop issue. Hence, I booted the TWRP-3.3.1-dees-troy, wiped Dalwick, Cache and Data and started again with a factory reset. :crying::crying: Ok, at least I started with V10.0.13.0 but need again to retrieve my apps and data from my Google account :crying: It is a heartache with AndroidOne or Xiaomi's implementation of OTA's or AndroidOne .

Thanks

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Sorry to hear that...

I haven't flashed my relatives' yet because there is not 10.0.13.0 fastboot image at the moment (if it ever happens).

It will be next time for backup exercises...

Don't forget yours! :p
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
and [MENTION=4964062]a1291762[/MENTION]:

Thanks, I am ok, I am on V10_0_13_0, apps retrieved (but not yet configured), Magisk installed. Just to discuss the way forward: If a new security patch is announced I'd suggest to 1st uninstall the Magisk images, 2nd uninstall Magisk completely, afterwards do the OTA update, then boot twrp-3.3.1-dees_troy-daisy to get access to /dev/block/mmcblk0p51 (including the slot_a boot file) copy that to the external SDcard or internal Download directory, install the Magisk Manager (e.g. from the external SDcard or internal Download directory), patch the boot file as per the Magisk procedure and fastboot boot the Magisk patched boot file to get Magisk root again.

By the way, fastboot images of V10_0_13_0 (<https://mirom.ezbox.idv.tw/en/phone/daisy/roms-global-stable/>) can be retrieved out of the payload.output of payload_dumper-win64.

Unfortunately, the payload output (fastboot images) are not formatted (in a directory) to be directly processed by MiuiFlash, perhaps, at least the flash_xxx.bat is missing, however they may be flashed by fastboot to the device. Obviously, this does not remove the encryption problem of the user data, as mentioned above only factory reset (user partition format) can heal that (with erasing all the data :crying:)

regards

grufty47

---------- Post added at 01:18 PM ---------- Previous post was at 01:16 PM ----------

and [MENTION=4964062]a1291762[/MENTION]:

Thanks, I am ok, I am on V10_0_13_0, apps retrieved (but not yet configured), Magisk installed. Just to discuss the way forward: If a new security patch is announced I'd suggest to 1st uninstall the Magisk images, 2nd uninstall Magisk completely, afterwards do the OTA update, then boot twrp-3.3.1-dees_troy-daisy to get access to /dev/block/mmcblk0p51 (including the slot_a boot file) copy that to the external SDcard or internal Download directory, install the Magisk Manager (e.g. from the external SDcard or internal Download directory), patch the boot file as per the Magisk procedure and fastboot boot the Magisk patched boot file to get Magisk root again.

By the way, fastboot images of V10_0_13_0 (<https://mirom.ezbox.idv.tw/en/phone/daisy/roms-global-stable/>) can be retrieved out of the payload.output of payload_dumper-win64.

Unfortunately, the payload output (fastboot images) are not formatted (in a directory) to be directly processed by MiuiFlash, perhaps, at least the flash_xxx.bat is missing, however they may be flashed by fastboot to the device. Obviously, this does not remove the encryption problem of the user data, as mentioned above only factory reset (user partition format) can heal that (with erasing all the data :crying:)

regards

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Here you have the latest fastboot, not payload.bin extracted (10.0.13.0):

https://xdaforums.com/showpost.php?p=80147347&postcount=106

I would always try first the restore images (uninstall magisk)-install OTA-install Magisk on inactive slot-reboot procedure.

In case it fails, backup :p, and then flash_all_except_storage, and then OTA, and then reinstall Magisk.

But now, running 12 I'll directly flash_all_except_storage version 13.

I've already patched new stock boot, so after flashing (still backing up), I'll boot on patched and install Magisk. (That is, the "standard" procedure ;))
[Xiaomi Mi A2 Lite Guides, News, & Discussion] xabier-bo:
Up & running (as it should always be...)
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
Thanks, I have saved it. Hopefully, flash_all_except_storage will not interfere with the encrytion problem if to be employed after the next crash. I am still installing and configuring my apps..., and for the time being my smarty is running smoothly. keep fingers crossed!

Nevertheless, as indicated in my previous post, a fool proof strategy for updating to future security/feature updates (Android 10) without the generous help of the forum would still be appreciated.

grufty47

wrt my suggestion in #66 re retrieving the new boot file after OTA and to patch it with Magisk: you should better go to the < /dev/block/by-name> directory to retrieve the new boot file (boot_a or boot_b, whatever slot you are working on), hence the full procedure is:

1st: uninstall the Magisk images, 2nd: uninstall Magisk completely, 3rd: check the slot (fastboot getvar current-slot; a | b), do: <fastboot boot twrp-3.3.1-dees_troy-daisy> to get access to /dev/block/by-name to retrieve the boot file (boot_a | _b) , copy that to the external SDcard or internal Download directory, reboot, install the Magisk Manager (e.g. from the external SDcard or internal Download directory), patch the boot file as per the Magisk procedure, copy the Magisk patched boot file (in /storage/emulated/0/Download) to your PC and do <fastboot boot Magisk patched boot_a | _b.img> from cmd line / Power Shell of your PC. After reboot check Direct Install in the Install menue of Magisk Manager to permanently get Magisk root again.

Done. Merits goes to a1291762 for the idea!

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
All,

to correct my earlier proposals above my favourite way to do OTA and install Magisk is to use "twrp-3.3.1-dees_troy-daisy.img" (can be downloaded via Google or TWRP app)

1.) before triggering the OTA uninstall any Magisk downloaded apps with Magisk "uninstall/restore image" option, afterwards uninstall Magisk completely

2.) do the OTA to 10.0.xx.0,

3.) put device into fastboot mode (push Volume down & power), connect it to the PC. Open a cmd window in the adb tools directory on your PC (shift, right click, select Power Shell)

4.) check the slot (a | b) of the device after the OTA and boot into TWRP

5.) <fastboot getvar current-slot>, (a | b), <fastboot boot twrp-3.3.1-dees_troy-daisy.img>, let TWRP boot.

6.) In the TWRP menu go to "enhanced" (erweitert) / File Manager (Datei Manager) to select the new boot image in mmcblk0p5x in the /dev/block/* directory.

7.) Depending on the return value of <fastboot getvar current-slot>, (a | b), copy mmcblk0p51 for working in slot a or mmcblk0p52 for working in slot b, respectively, to a user accessible location (SDcard or Download directory).

8.) reboot, install the Magisk Manager (e.g. from SDcard or Download directory), patch the latest OTA boot file (slot a = mmcblk0p51 , slot b = mmcblk0p52) as per the Magisk procedure (install Magisk, select and patch file), copy the Magisk patched boot file ("magisk_patched.img" in /storage/emulated/0/Download) to the adb tools directory of your PC,

9.) put Mi A2 lite into fastboot mode again, in the adb directory do: <fastboot boot magisk_patched.img> from cmd line / Power Shell on the PC.

10.) After reboot check "Direct Install" in the install menu of Magisk Manager to permanently get Magisk root again.

Eventually you may permanently install TWRP or reserve the TWRP functionality to boot if needed.

Done.

My investigation from comparing MD5/SHA-1 checksums gave that the mmcblk0p51.img partition/file contains the boot image in slot a, the mmcblk0p52.img contains the boot image in slot b. Make sure to establish the operating slot first to save the correct boot image for patching with Magisk!

Thanks goes to a1291762 for input to this approach!

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] yashinodon:
Works seamlessly. I didn't encountered any issues at all while following this method. This guide actually works better than any other guides about installing OTA while Magisk installed. Thanks for this.

Edit 1: Oops, I accidentally deleted my boot and patched boot backups for the latest October Security update (V10.0.15.0.PDLMIXM). Can anyone provide the image files?

Edit 2: It turned out that I've transfered the boot images from my device to my Macbook! xD
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Note that as of 10.0.15.0 and Magisk 20, I cannot get TWRP and Magisk into the same boot.img without breaking TWRP :(

Probably it's Magisk 20 rather than 10.0.15.0 that broke this and I just didn't check when I upgraded a few weeks ago.

At least you can still boot TWRP from fastboot if you need it :)
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
This process looks fine. I jump through extra hoops to make sure that my system doesn't boot without Magisk, but as your guide shows, there's no real need to do that.

When you're in TWRP, you can still get access to the by-name labels (so you don't have to guess at partition numbers). They're just in a slightly different path: /dev/block/platform/soc/7824900.sdhci/by-name
[Xiaomi Mi A2 Lite Guides, News, & Discussion] yashinodon:
You mean the 'system has been destroyed' thing?

I just flash the 9.6.4.0 aboot.img and backup the current aboot.img (10.0.15.0) by using the command:

adb shell
su
dd if=/dev/block/by-name/aboot_b (or a) of=/sdcard/aboot10.0.15.0.img bs=1024k
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
Yep. That's the one. I haven't needed to replace about before now.

It's the partition where fastboot lives, right? That scares me because fastboot is how I recover the device when things go wrong.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] yashinodon:
I think it contains the recovery kernel.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] grufty47:
Ok, after upgrade to 10.0.15.0 I can only check this with the next patch (10.0.16.0). As far as I remember before the Magisk root there is no </dev/block/by-name directory/boot_a|b>, it appears that the Magisk patch changes the directory structure.

However, even if /dev/block/platform/soc/7824900.sdhci/by-name/boot_a|b is available after booting of TWRP, there is still the need to identify which slot is on (a|b?), hence which boot image (boot_a = mmcblk0p51, boot_b = mmcblk0p52) needs to be used for patching by Magisk. I think the problem is both: (1st) identify the slot the device is on after OTA and (2nd) and then patch the correct boot image (boot_a = mmcblk0p51, boot_b = mmcblk0p52).

Unfortunately, we are still dependant on our seamlessly working TWRP (twrp-3.3.1-dees_troy.img), no clue yet to get access to the device's root (/) directory otherwise :confused:

By the way: on the first boot of my smarty after Magisk patch there was a pop-up in Magisk 20 notifying of loading something like a <mandatory enhancement> and, as far as I remember, I needed to apply magisk_patched.img again and then everything was fine... Magisk 20 appears to work now, TWRP can be booted if needed (I did not try yet).

Keep waiting for the surprises to come...

Cheers

grufty47
[Xiaomi Mi A2 Lite Guides, News, & Discussion] yashinodon:
Hello, just an update the V20.1 of Magisk just recently fixed being unable to boot to recovery after installing Magisk through a custom recovery on A/B devices.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
Dam#n it... I break it this time :(... hope there is a solucion.

I was with stock 10.0.14.0 version, fastbooted vanilla 14, did OTA to 10.0.15.0, then rebooted :(

Nexts boot up it asks for password in a black screen (I have no passwords, just fingerprint and pattern)

Is there any way to recover with out loosing my data/configs?

Tried to boot a and b but the same (one boot loops, the other asks for password)

Also, I have vanilla 14 and magisk patched 14, but booting from these gives me bootloop (android one colored line in middle screen like loading but nothing happens after about 10 minutes)

Any idea? would not like to format/wipe... (next time a backup would be wise :))

Thanks,
[Xiaomi Mi A2 Lite Guides, News, & Discussion] a1291762:
I don't think there is, once you get to this state. I think this means the encryption keys have become corrupted/lost.

I'm really curious to know _exactly_ what you did because I've seen a few people who had this symptom but it was never clear what triggered it.
[Xiaomi Mi A2 Lite Guides, News, & Discussion] sebadamus:
Hi, thanks for reading. Well, yesterday I search some more, but cound not find any clue about how to recover from that, some says re flashing fastboot image without erasing data... did tried that as last option, but... no luck. Other posts says first remove any kind of autentification (fingerprint, pattern, etc... before updating)

It happens like this:

1) being on 10.0.14 with latest Magisk, modules busybox ndk and systemless hosts (everythin enabled, root enabled) I did not uninstall magisk (this might been the problem)

2) I reboot to fastboot and flashed stock vanilla boot 10.0.14 (or just boot it cant remember now)

3) Flashed system and vendor to actual slots (if not OTA wont go)

4) Magisk manager installed, but magisk appears not rooted as I start from vanilla boot

5) Did the OTA, did not reboot yet... opened Magisk manager, tried to install root solution (first line that shows uninstalled as in point 4) click install, and it shows: patch a file or download only (here I got confused), so I reboot (I think I should have extracted vanilla boot again now being 10.0.15, I think...)

6) It reboot, started and bootlooped with the android middel screen line moving white screen for 5 minutes... reboot again and it started.

7) now black screen asking password to start (have not any password so... here I suffered :silly:)

Would be good to know which partitions have the "encrypt" keys so back them up first if it is possible in case of doing the magisk/patch/ota update wrongly (as I did)

Thanks,