adb – Xiaomi A2 stuck in a reboot loop because of data partition

I installed the October 2020 update for my Xiaomi A2, and then it entered a reboot loop, giving me a “Cannot load Android system” message.

Actually, when I boot up the phone, I automatically get to the recovery menu, which only gives me two options: wipe the data partition, or reboot. And rebooting sends me back to the recovery menu.

Here’s what I did:

  • First, using fastboot, I reinstalled the entire OS except the data partition. That ended up in the same reboot loop.
  • Then, using TWRP and executing it with fastboot boot twrp-3.4.0-1-jasmine_sprout.img I could adb shell into my device. From there I ran an fsck -f which did find a couple inode problem. But fixing those problems still did yield the same reboot loop.
  • Using TWRP again, I locally cloned my data partition using adb pull /dev/block/mmcblk0p69 data.img, then I tried the “wipe the data partition” option. My phone did reboot properly, but of course it was reset to factory settings.

Question: is there a way I can restore my phone to a working state with my previous data? I really don’t want to reconfigure all of it…

Also I don’t really understand what’s the problem with my original data partition. Is there a way to know why Android doesn’t want to boot with it and why it sends me to the recovery partition?

More info:

  • Running fsck on the local data.img says it has no error whatsoever
  • I can mount the data.img and browse it. It’s full of, well, files!