XA2 4113 crashing on setup wizard stock ROM - Sony Xperia XA2 Questions & Answers

Hi All,
First post here and apologies for the length.
I have a new XA2 4113 which is crashing on the Android first time setup screen after I have flashed stock ROM with Emma which I had to do as I messed up a TWRP flash. Same/similar issue as: https://forum.xda-developers.com/xperia-xa2/help/flash-to-stock-xperia-rom-t4019873.
Full timeline:
New XA2 unlocked, boot out of box, allow OTA update to 9.0 (first mistake I believe), unlock bootloader. All good so far.
Attempt to flash TWRP, made a mess of it by running fastboot flash rather than fastboot boot (second mistake), phone bricked.
Eventually recover phone to usable fastboot/flashmode state. Attempt to use Flashtool to flash stock, didn't work (after more research I find that Flashtool is not suitable for newer Sony phones).
Used Newflasher to flash various ROMs, either get stuck in bootloop on SONY logo or have the same problem crashing at first time setup screen.
Flash AOSP 8.1, phone boots and is usable. Flash GApps (various sizes, all correct 8.1 versions) phone bootloops. This may well be me not flashing Gapps properly.
Try Lineage 17.0, phone boots but many issues with apps freezing (I probably didn't install Lineage correctly).
Install EMMA, flash stock ROM 50.1 & 50.2, same problem crashing at first time setup whichever ROM is used.
Used EMMA to flash both A and B partitions (by changing active partition in fastboot between flashes, and also letting the phone boot after flash then flashing again). Same issue with crashing at first time setup when booting from A, however when booting from B phone is stuck in bootloop at SONY logo.
TLR, phone crashes on stock ROM on partition A, won't boot on partition B.
My initial aim was to have sony stock ROM with root. I now fear that I have permanently damaged partition B.
If anyone has any ideas on how to resolve my issues they would be much appreciated. Failing that if anyone can recommend a custom ROM that is close to SONY stock that I could use instead that would be great.
Thanks in advance.

0

Seppppx said:
Updating up to Android 9 wasn't a mistake.
You should try multiple firmwares with experifirm. I have had issues with some, but other worked great. (Belgium turned out the best) Flash the firmware with newflasher and you should be fine.
I have had the same issues you mention with a particular version of the XA2 firmware (I think it was the polish version). Flashing Belgium firmware fixed that.
Click to expand...
Click to collapse
Thanks Seppppx,
I will try a bunch of different firmwares as suggested and revert with results.

Now with Logcat!
Hi Again XDA,
So I have tried 7 different firmwares from Xperifirm with Newflasher and still have an issue.
I have flashed all 7 both with and without the TA files (as suggested in another post on here) and also tried Y & N for the persist flash (3rd Y/N question in Newflasher process).
My only progress has been with the Belgian firmware (thanks Seppppx) which has allowed me to get past the android setup wizard, however the phone crashes and reboots after approx 20-30 seconds of running. It runs long enough for me to set a PIN, if I don't unlock the phone after boot it runs quite happily until I do. This has allowed me to run some adb commands and I have a Logcat from the crash.
Most of the Logcat is gibberish to me but the below snippet occurs less than a second before the phone crashes and looks fairly terminal:
Code:
04-07 18:47:59.105 1809-1809/? E/Zygote: System zygote died with exception
java.lang.RuntimeException: Unable to start receiver com.sonymobile.coresettings.BootCompletedReceiver: java.lang.RuntimeException:
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3400)
at android.app.ActivityThread.access$1200(ActivityThread.java:205)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1667)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:280)
at com.android.server.SystemServer.run(SystemServer.java:471)
at com.android.server.SystemServer.main(SystemServer.java:311)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
Caused by: java.lang.RuntimeException:
at com.sonymobile.coresettings.CoreSettingsJNI.unprotectData(Native Method)
at com.sonymobile.coresettings.UtilityImpl.DecryptData(UtilityImpl.java:89)
at com.sonymobile.coresettings.AdbNonSecureSwitchImpl.IsEnabled(AdbNonSecureSwitchImpl.java:62)
at com.sonymobile.coresettings.BootCompletedReceiver.onReceive(BootCompletedReceiver.java:33)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3386)
at android.app.ActivityThread.access$1200(ActivityThread.java:205)*
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1667)*
at android.os.Handler.dispatchMessage(Handler.java:106)*
at android.os.Looper.loop(Looper.java:280)*
at com.android.server.SystemServer.run(SystemServer.java:471)*
at com.android.server.SystemServer.main(SystemServer.java:311)*
at java.lang.reflect.Method.invoke(Native Method)*
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)*
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)*
04-07 18:47:59.105 1809-1809/? D/AndroidRuntime: Shutting down VM
04-07 18:47:59.105 1809-1809/? E/AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
java.lang.RuntimeException: Unable to start receiver com.sonymobile.coresettings.BootCompletedReceiver: java.lang.RuntimeException:
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3400)
at android.app.ActivityThread.access$1200(ActivityThread.java:205)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1667)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:280)
at com.android.server.SystemServer.run(SystemServer.java:471)
at com.android.server.SystemServer.main(SystemServer.java:311)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
Caused by: java.lang.RuntimeException:
at com.sonymobile.coresettings.CoreSettingsJNI.unprotectData(Native Method)
at com.sonymobile.coresettings.UtilityImpl.DecryptData(UtilityImpl.java:89)
at com.sonymobile.coresettings.AdbNonSecureSwitchImpl.IsEnabled(AdbNonSecureSwitchImpl.java:62)
at com.sonymobile.coresettings.BootCompletedReceiver.onReceive(BootCompletedReceiver.java:33)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3386)
at android.app.ActivityThread.access$1200(ActivityThread.java:205)*
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1667)*
at android.os.Handler.dispatchMessage(Handler.java:106)*
at android.os.Looper.loop(Looper.java:280)*
at com.android.server.SystemServer.run(SystemServer.java:471)*
at com.android.server.SystemServer.main(SystemServer.java:311)*
at java.lang.reflect.Method.invoke(Native Method)*
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)*
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)*
I'm not very familiar with this but FATAL EXCEPTION in SYSTEM PROCESS:main sounds pretty bad to me. Any seriously techy types out there who can interpret the above and tell me if I'm barking up the right tree or not? I can post the full Logcat if it helps.
Thanks in advance.

Related

[RECOVERY][Unofficial][amami] TWRP 3.4.0

Finally there is a TWRP capable of decrypting /data on android versions > nougat.
Big thanks @NeoArian
I haven't tested everything in detail as I mostly focused on decryption. If you experience issues or can confirm something working that's not green in the table down below, please share.
Code:
#include <std_disclaimer.h>
/*
* Your warranty is now void.
*
* 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. Hard & a lot.
*
*/
Status
List template by TWRP
Code:
[B]Blocking checks[/B]
- [COLOR="green"]Correct screen/recovery size[/COLOR]
- [COLOR="green"]Working Touch, screen[/COLOR]
- [COLOR="green"]Backup to internal/microSD[/COLOR]
- Restore from internal/microSD
- [COLOR="green"]reboot to system[/COLOR]
- [COLOR="green"]ADB[/COLOR]
[B]Medium checks[/B]
- update.zip sideload
- [COLOR="green"]UI colors (red/blue inversions)[/COLOR]
- [COLOR="green"]Screen goes off (and on :))[/COLOR]
- F2FS/EXT4 Support, exFAT/NTFS where supported
- [COLOR="green"]all important partitions listed in mount/backup lists[/COLOR]
- backup/restore to/from external (USB-OTG) storage
- backup/restore to/from adb
- [COLOR="green"]decrypt /data[/COLOR]
- Correct date
[B]Minor checks[/B]
- MTP export
- [COLOR="green"]reboot to bootloader[/COLOR]
- [COLOR="green"]reboot to recovery[/COLOR]
- [COLOR="green"]poweroff[/COLOR]
- [COLOR="green"]battery level[/COLOR]
- [COLOR="green"]temperature[/COLOR]
- encrypted backups
- [COLOR="green"]input devices via USB (USB-OTG) - keyboard, mouse[/COLOR]
- USB mass storage export
- [COLOR="green"]set brightness[/COLOR]
- [COLOR="green"]vibrate[/COLOR]
- [COLOR="green"]screenshot[/COLOR]
Limitations
Following limitations are known:
none
Click to expand...
Click to collapse
prerequisites
For reboot to recovery from your android system (and OTA updates) your ROM needs the following patches 1, 2 and 3. Following ROM's currently support this:
AICP 14
AICP 15
LineageOS 15
LineageOS 16
LineageOS 17
Click to expand...
Click to collapse
For correct time inside TWRP your ROM needs the following patch. Following ROM's currently support this:
AICP 15
LineageOS 16
LineageOS 17
Click to expand...
Click to collapse
Download
SourceForge
AndroidFileHost
Click to expand...
Click to collapse
How to build
https://github.com/115ek/manifest#build-twrp
Click to expand...
Click to collapse
XDA:DevDB Information
[RECOVERY][Unofficial][amami] TWRP 3.4.0, Tool/Utility for the Sony Xperia Z1 Compact
Contributors
115ek, NeoArian
Source Code: https://github.com/115ek/twrp_device_sony_amami
Version Information
Status: Beta
Created 2019-08-25
Last Updated 2020-08-22
Changelog
15.09.2020 3.4.0-1
again: fix non working OTA update in rare cases (rebooting to recovery and stucking there unable to install update automatically)
22.08.2020 3.4.0-0
latest TWRP changes
29.02.2020 3.3.1-0.4
display sony bootlogo at boot
show version number
remove TWRP app
19.09.2019 3.3.1-0.3
fix non working OTA update (rebooting to recovery and stucking there unable to install update automatically)
05.09.2019 3.3.1-0.2
enable reboot to bootloader (fastboot mode) (you have to connect the phone via usb BEFORE rebooting)
25.08.2019 3.3.1-0.1
decrease size
allow decryption in any case of patchlevel value
25.08.2019 3.3.1-0
initial release
Reserved
Backup to microSD seems to be working fine (haven't restored anything yet):good:
I uploaded a new build 3.3.1-0.1 with decreased size and a "more clean" way to allow /data decryption.
Furthermore I thought about getting this official.
BTW: You won't see the increased version number in TWRP. It's still 3.1.1-0
115ek said:
I uploaded a new build 3.3.1-0.1 with decreased size and a "more clean" way to allow /data decryption.
Furthermore I thought about getting this official.
BTW: You won't see the increased version number in TWRP. It's still 3.1.1-0
Click to expand...
Click to collapse
Hi, thank you for this build. I was waiting to try Pie on my z1 compact and I'm glad I did because the version of TWRP was blocking my use of encryption.
Sadly I didn't have luck installing the latest builds (the ones from 3 days ago and one week ago) on my Z1 Compact. I got this error:
Code:
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
When trying to flash to recovery partition. The same command worked to flash back to 3.2.3 (not sure if necessary, done just in case). If there's any way you could look into these builds I'd appreciate it!
bananabytes said:
Hi, thank you for this build. I was waiting to try Pie on my z1 compact and I'm glad I did because the version of TWRP was blocking my use of encryption.
Sadly I didn't have luck installing the latest builds (the ones from 3 days ago and one week ago) on my Z1 Compact. I got this error:
Code:
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
When trying to flash to recovery partition. The same command worked to flash back to 3.2.3 (not sure if necessary, done just in case). If there's any way you could look into these builds I'd appreciate it!
Click to expand...
Click to collapse
What command did you use?
Code:
fastboot flash recovery
or
Code:
fastboot flash FOTAKernel
Do you have the newest bootloader installed? So can you boot directly into recovery with VOL down and power pressed (with 3.2.3 version where flashing was successful)?
Or do you use the method with pressing VOL down when the LED lights up?
EDIT:
By looking at your error code I get the feeling it has something to do with fastboot directly. libsparse is a build dependency of the fastboot binary.
What version of fastboot are you using?
I'm using fastboot installed from the packetmanager with
Code:
apt install fastboot
.
Code:
fastboot --version
gives fastboot version 1:8.1.0+r23-5~18.04.
This would mean 27.0.0 or 27.0.1 according to this scheme. I don't know why they are using different naming schema
However, I'd guess you're using an outdated version (or a very current one - but I don't think so).
115ek said:
What command did you use?.
Click to expand...
Click to collapse
I used fastboot flash recovery, with the newest bootloader. This time I got into recovery by selecting it in my older TWRP because I always get the up/down method mixed up, I have done it before it's just easier that way.
115ek said:
By looking at your error code I get the feeling it has something to do with fastboot directly. libsparse is a build dependency of the fastboot binary.
...
However, I'd guess you're using an outdated version (or a very current one - but I don't think so).
Click to expand...
Click to collapse
I am actually indeed using a very current version, 29.0.2 (so your second less likely guess was correct!) I'm on Manjaro/Arch so we get the bleeding edge updates unlike if you are on a Debian/Ubuntu system that's tied to a lot of different libraries and held back. This is exactly why I stopped using those distros but this is the first time I've had the problem in reverse. I don't know if this is a bug that was introduced into fastboot or what. I do see that the more recent versions have things to do with partitioning. This may be a bug to open with fastboot or to look into further with them? But if it's not a bug with them it would be good to have the build working on the latest fastboot.
bananabytes said:
I used fastboot flash recovery, with the newest bootloader. This time I got into recovery by selecting it in my older TWRP because I always get the up/down method mixed up, I have done it before it's just easier that way.
I am actually indeed using a very current version, 29.0.2 (so your second less likely guess was correct!) I'm on Manjaro/Arch so we get the bleeding edge updates unlike if you are on a Debian/Ubuntu system that's tied to a lot of different libraries and held back. This is exactly why I stopped using those distros but this is the first time I've had the problem in reverse. I don't know if this is a bug that was introduced into fastboot or what. I do see that the more recent versions have things to do with partitioning. This may be a bug to open with fastboot or to look into further with them? But if it's not a bug with them it would be good to have the build working on the latest fastboot.
Click to expand...
Click to collapse
Can you please verify that you also fail with the fastboot binary from here
It's also 29.0.2 and it works fine for me.
I have tried this version with LOS 16 and it worked well. Some things to improve
boot to fastboot is not possible
backup and restore of boot is not possible
good catch with encryption, I have give it up :good:
Micha_Btz said:
boot to fastboot is not possible
Click to expand...
Click to collapse
Well, I actually didn't know this was possible in earlier versions. However it should work now --> see the changelog
You have to connect usb cable before rebooting to bootloader, otherwise it won't work and just reboot the system.
Micha_Btz said:
backup and restore of boot is not possible
Click to expand...
Click to collapse
I can't confirm that. What exactly was the problem for you? Backing up or restoring? Did you got any errors?
Have had a look yesterday, Backup and restore of boot is possible (don't now what happends)
@115ek,
I have a mysterious problem with 3.3.1-0.0.and 3.3.1-0.1:
I used all twrp versions before without problems and now your twrp did not show the correct date (1970-xx-xx) and time (7-8 hours back).
I tried the following several times:
1. reflash your twrp, clear recovery and flash again,
2. flash older versions: date and time was wrong even after reboot
The only way to get the correct date/time back in twrp was (at least for me) flash stock ROM with EMMA and after flashing twrp 3.2.3 my backup.
I do not want to repeat this as this is a lot of work incl. copying back the internal storage.
tramp20 said:
@115ek,
I have a mysterious problem with 3.3.1-0.0.and 3.3.1-0.1:
I used all twrp versions before without problems and now your twrp did not show the correct date (1970-xx-xx) and time (7-8 hours back).
I tried the following several times:
1. reflash your twrp, clear recovery and flash again,
2. flash older versions: date and time was wrong even after reboot
The only way to get the correct date/time back in twrp was (at least for me) flash stock ROM with EMMA and after flashing twrp 3.2.3 my backup.
I do not want to repeat this as this is a lot of work incl. copying back the internal storage.
Click to expand...
Click to collapse
Can you try the latest version?
At first you have to set the right timezone in TWRP settings.
The time is stored in a real time clock (RTC) which runs even if the device is powered off. Setting and reading it's value is done by a kernel driver. If you set the right time in android system it gets stored in the RTC. Then, if you boot into TWRP, the time is read again. And for me this works fine. However it takes some seconds (there's a wrong time at the beginning).
115ek said:
Can you try the latest version?
At first you have to set the right timezone in TWRP settings.
The time is stored in a real time clock (RTC) which runs even if the device is powered off. Setting and reading it's value is done by a kernel driver. If you set the right time in android system it gets stored in the RTC. Then, if you boot into TWRP, the time is read again.
Click to expand...
Click to collapse
Thank you. I know this all, I tried reset to default in TWRP and set TZ etc. but these two mentioned TWRP versions do not read the RTC time (AICP ROM).
All TWRP versions before were ok. I tried this several times.
I noticed this "bug" on my Z1c after a backup with your TWRP (Date from 1970 and a complete false time even after setting the TZ).
Even after flashing one of the older TWRP date/time are wrong (only in TWRP), after booting to Android date/time is correct until I boot to TWRP again.
As I wrote the way back to a correct date/time in TWRP was for me flashing stock ROM with EMMA.
Where is this "kernel driver"? In your TWRP version or in a hidden partition? Sorry I do not know much of these internals.
I assume you did not change in the newest version something regarding this problem.
I have not the time to try the last version for now
Generic question re: encrypting this device
Installed this twrp version and (unlike others) I don't see anything strange. Only thing I haven't tried so far is restoring a nandroid backup I created with this twrp release.
A few days back after I had installed this the first time Itried to encrypt my phone; after a while I received the message that encryption was completed.
Then upon reboot of the device I had to unlock it even before boot sequence had started. Aftter unlocking booting resumed and from then on everything appeared to be as before.
This surprised me a bit because on my other phone (OnePlus6 running stock OOS Pie) I have to unlock after boot sequence has completed. But OK, this may be the LOS 16 way.
Then I devided to unencrypt the phone (this is my secondary device and I only use it for playing around a bit, until I decide to sell it, maybe). Again, from my OP6 I'm used to the fact that if I remove any device locking pattern encryption is gone. But obviously not on my Z1c: after I had removed the security pattern (= set security to nothing) everything appeared to be normal. But after the next reboot all data were gone.
Question: is there a supported way to unencrypt this phone without losing any data?
If there isn't such a way: what happens to my Nandroid backups I took while the phone was encrypted? Are they still usable e.g. after I install a ROM update?
tramp20 said:
Thank you. I know this all, I tried reset to default in TWRP and set TZ etc. but these two mentioned TWRP versions do not read the RTC time (AICP ROM).
All TWRP versions before were ok. I tried this several times.
I noticed this "bug" on my Z1c after a backup with your TWRP (Date from 1970 and a complete false time even after setting the TZ).
Even after flashing one of the older TWRP date/time are wrong (only in TWRP), after booting to Android date/time is correct until I boot to TWRP again.
As I wrote the way back to a correct date/time in TWRP was for me flashing stock ROM with EMMA.
Where is this "kernel driver"? In your TWRP version or in a hidden partition? Sorry I do not know much of these internals.
I assume you did not change in the newest version something regarding this problem.
I have not the time to try the last version for now
Click to expand...
Click to collapse
Flashing stock ROM isn't necessary - I'm 99% sure. Maybe you can get a log with
Code:
adb pull /tmp/recovery.log
while your in TWRP and connected to a PC...
The kernel driver is - as the name says - located in the kernel, which is part of the recovery.img
So everyone flashing this image should have the same functionality (in theory). As it works for me (and some others) I'm just wondering.
lm089 said:
Installed this twrp version and (unlike others) I don't see anything strange. Only thing I haven't tried so far is restoring a nandroid backup I created with this twrp release.
A few days back after I had installed this the first time Itried to encrypt my phone; after a while I received the message that encryption was completed.
Then upon reboot of the device I had to unlock it even before boot sequence had started. Aftter unlocking booting resumed and from then on everything appeared to be as before.
This surprised me a bit because on my other phone (OnePlus6 running stock OOS Pie) I have to unlock after boot sequence has completed. But OK, this may be the LOS 16 way.
Then I devided to unencrypt the phone (this is my secondary device and I only use it for playing around a bit, until I decide to sell it, maybe). Again, from my OP6 I'm used to the fact that if I remove any device locking pattern encryption is gone. But obviously not on my Z1c: after I had removed the security pattern (= set security to nothing) everything appeared to be normal. But after the next reboot all data were gone.
Question: is there a supported way to unencrypt this phone without losing any data?
If there isn't such a way: what happens to my Nandroid backups I took while the phone was encrypted? Are they still usable e.g. after I install a ROM update?
Click to expand...
Click to collapse
The behaviour is totally expected as amami uses the deprecated full disk encryption (FDE). Most likely your oneplus 6 is using file based encryption (FBE). That's the reason it can boot to your lockscreen because some files necessary for booting aren't encrypted (or not encrypted using your password...). To boot a device with fully encrypted /data you have to decrypt it first. If you're interested in details have a look here.
The other thing sounds a bit strange. However I don't know if it's possible to remove the FDE completely. Maybe the device just sets a default password then?
Concerning your question:
What definitely should work is taking a backup in TWRP (of course need to decrypt /data before), then format /data and restore the backup. Anyhow - I didn't test such a case so far.
115ek said:
Flashing stock ROM isn't necessary - I'm 99% sure. Maybe you can get a log with
Code:
adb pull /tmp/recovery.log
while your in TWRP and connected to a PC...
The kernel driver is - as the name says - located in the kernel, which is part of the recovery.img
Click to expand...
Click to collapse
Flashing stock ROM was the only way that all older TWRP could read the correct date again after trying your twrp version.
I will try to get a log if I have enough time.
So the recovery.img = twrp.img or at least a part of it?
Thank you.
New update:
As I had problems with installing OTA updates (especially with /data encrypted, but not limited to) on LineageOS 16.0 I came up with a fix.
Download Currently only on sourceforge - android filehost is buggy at the moment...
19.09.2019 3.3.1-0.3
fix non working OTA update (rebooting to recovery and stucking there unable to install update automatically)
Edit:
As reminder for me / interested guys: This commit breaks the OTA updating in some cases (when mmap isn't sufficient). The buildflag
Code:
-D_FILE_OFFSET_BITS=64
doesn't work as intended on my setup. Maybe I missed something.
tramp20 said:
@115ek,
I used all twrp versions before without problems and now your twrp did not show the correct date (1970-xx-xx) and time (7-8 hours back).
Click to expand...
Click to collapse
Have the same time/date problem with twrp-3.3.1-0.3-amami.img
recovery.log >> https://pastebin.com/rBdHAmz2
Also does not reboot into the recovery from system (AICP 14), just shutdown and then power+volume down works.

Unbrick device: missing files?

Hi
Weeks ago I started a thread at a more general level, and got no answer, so I presume my question/request should have been more device-focused.
My problem: unlock pattern is not accepted, at boot stage, after having fastboot flash_all_except_storage.sh, so it cannot decrypt userdata, therefore it doesn't boot. Not to say I cannot access my data.
Device: Xiaomi MiA2 Lite. Bootloader unlocked. Magisk rooted
What I did:
- "Justification": I just came from a trip with no connectivity, too tired (without giving a second thought), resolved several family tech issues, and as I've had not problem upgrading the same device from a relative with the same configuration, I made no backup of mine.
- I was trying to upgrade from 10.0.10.0 to 10 10.0.12.0, but OTA was sistematically failing, despite I'd followed the same recommended procedure than in my relatives':
the Magisk uninstall - OTA_update - Magisk install_on_empty_slot procedure.
- I first tried flashing stock boot, in order to override the OTA error. What I got is the system destroy message!
- At that moment I only new about the fastboot file from xiaomi, that only shows 10.0.9.0.
Downloaded it, and ran (downgraded) the flash_all_except_storage.sh of this version.
It seemed to work well until I got stuck in "incorrect pattern" (previous to the full boot)
What I tried:
- I repeated the flashing, just in case, with no success.
- Also tried to access userdata with twrp-3.3.0-0 and 3.3.1-dees_troy. No success.
- Then, too late (don't know why this xiaomi doesn't upload the latest), I found at xda-dev newer fastboots images (10.0.10.0 and 10.0.12.0). Tried to flash_all_except_storage, but not changes at all.
- I have no doubt on my pattern
- Important: I got the warning of 9 attempts left (hope that the ones within TWRP do not count).
So my "request":
- The most important: any help on how could I regain access to my userdata partition?
Let me add that I have a previous unencrypted TWRP userdata backup (only that partition), from a few months before. It contains a /persist/data directory
Could I get any file from it that is part of the encryption process? (I can see, for instance, keymaster64)
In this case, what should I do?
- and, secondly, (I guess some of you have a good level, obviously not me): what could have broken the access to the userdata? In my previous mobiles, flashing boot, system or vendor caused not problems to me. I ask it because it's not my first problem rooting this 2 slot device.
Thanks in advance

[INFO] Understanding and troubleshooting bootloops

Since this device tends to bootloop easily and because I've seen lots of questions about it and information is spread across many threads and posts, I'm writing this guide to help you guys troubleshoot bootloops before asking generic "help me" questions.
I) Terminology
1) BROM - A readonly memory on the SoC that runs right when the device boots. Loads the preloader. SPFT talks to it after authentication.
2) Preloader - MTK firmware that resides on flash. It is loaded on the chip's SRAM. It is responsible for initializing DRAM, and is one way of authenticating SPFT (the other is authenticating directly with the BROM, but I believe the way thi is done is known only to MTK and OEM engineers, and not even to authorized service centers). It also loads LK. Its source is distributed to OEMs, but is otherwise unavailable. Plenty of leaks for other devices can be found on the internet (some from the OEMs themselves).
3) LK - Little Kernel. This seems to be the most common platform for Android bootloaders. Mediatek has its own proprietary branch. Same source status as preloader. As an android bootloader, it is responsible for loading recovery or usual kernel image, as well as fastboot flashing.
4) Kernel - If you're on these forums, you should know what it is. You can find it in boot.img
5) DTBO - The device tree for the linux kernel. It specifies which hardware is available on the device. On usual (x86) PC platforms, the BIOS and Option ROMs store device information and offer it to the kernel (through UEFI/ACPI). As arm boards do not have such those, the linux kernel uses dtbos which play the same role.
II) Boot process
1) The ARM cores on the SoC start and jump to the address of the BROM.
2) (I'm not very sure of this, there's too little information) BROM puts the cores into a known state, should listen on the in-build UART for some time (half a decade ago, some leaks said something about 150ms), and if it doesn't receive anything, it loads the preloader.
3) The preloader initializes basic stuff like DRAM (phone's ram), watchdog, USB, etc. If the phone is connected to SPFT, it talks to it and authenticates it (the (in)famous "Account not authorized for this operation" should come from a check in here). I believe it also turns on the charging light. On a normal boot, it further loads lk. I belive that it also shows the chinese menu on pressing the Vol- button on factory preloader, but I did not check this.
4) LK (the one that comes with factory preloader) checks if Vol+ is pressed, and displays the bootloader menu (the one with the 4 english entries). When selecting recovery, it loads recovery. If normal boot is selected, it loads boot.img and dtbo.img and I believe it makes some checks on them (possibly of signatures, see the kernel trees). It then loads the proper image from the logo.bin partition and displays it (note: I've checked Logo Builder; rebuilding the logo.bin partition with it makes LK reboot before showing any image - this is done after the boot menu); examples are the one where it shows "Unlocked" or the Fastboot background. It also checks vbmeta for verified boot. Then it boots the selected entry.
5) The linux kernel does some hardware init, mounts system and starts Android's init.
6) Android does its usual init, mounting vendor, loading modules and firmware, turning on stuff like wifi, bluetooth, gnss, etc.
III) Tips for diagnosing bootloops
1) When bootlooping, plug your phone in a computer and check for the following (this is from my experience):
a) Charging light turning on
b) Vol+ menu showing up
c) Redmi logo showing up
d) Charging light turning off
e) Boot animation showing up
2) Things to do based on where things didn't work as in (1):
If (a) doesn't turn on, you're most likely in deep ****, and I'm not sure who can help you. Edit: Try pressing Vol+ and see if a device with VIDID 0x0e8d:0x0003 shows up. That would be the BROM. If it shows up, try using SPFT (most likely won't work, but you have nothing to lose anyway).
If (b), try SPFT. If it shows "Account not authorized", you have the stock preloader. There's a couple threads here with some methods that may or may not work. Otherwise, ATM you'll quite literally have to pay for your mistake. Grab your wallet and your Windows VM. You'll need them. Be prepared to search for the least shady guy that can help you and have your usb passthrough (on the upstream hub) ready.
If (c) - i.e. you have the menu but no logo, this means you've got LK. Since the Redmi logo doesn't show up, it means something is not quite how lk likes it (and lk is very picky on this phone). If you can, you'll probably want to use fastboot and flash a known good image for whatever you changed. If not, use SPFT.
If (d) - i.e. you have the logo but the charging light doesn't turn off, this means LK didn't boot the linux kernel. Flash a different (working) kernel.
If (e) - the charging light turns off, but you have no boot animation, this means either the kernel panics before it can start Android or that Android failed to boot properly.
From here on, you can use /sys/fs/pstore/console-ramoops to diagnose the problem.
If you do get a boot animation or are close to it, you might also want to try using adb logcat (especially if you've turned on adb debugging, and your ROM can do it on boot).
3) /sys/fs/pstore/console-ramoops
You can access it on a normal boot on some roms (or mount it manually if you've got root), or it's usually mounted automatically on TWRP. This is the kernel log from the last boot and is theoretically stored in RAM (I have reasons to doubt that). Basically, it works like dmesg, but for the last boot.
While it is polluted by zealous MTK debugging info, scrolling through it can often show where the problem is. If you can figure it out yourself, great. If not, post it here, and I (or somebody else) might try to figure out what went wrong and put it on a list of known bootloop reasons and fixes below.
4) Recommendations on posting about bootloop problems:
I think it would help a lot specifying which step from above fails. Also, if the charging light turns off, please, please provide /sys/fs/pstore/console-ramoops. You can easily get it with adb pull from TWRP and it helps *a lot* in figuring out what went wrong.
Hope this info will help you guys getting your devices working again faster (and provide more accurate info when asking for help).
P.S.: Another reference on MTK boot, also around 5 years old.
Reserved for List of bootloop problems:
Reserved
i have:
dm-verity error
Android system on your device is corrupted.
Device will boot in 5s
Click to expand...
Click to collapse
can't boot to my mobile in past week
just i can see my device with "fastboot devices" but not found with adb devices
and in device manager "Android ADB Interface" it's not recognize ( yellow question marks).
also have "adb server version (41) doesn't match this client (39); killing"
hello..
So... /sys/fs/pstore/dmesg-ramoops .. is not there .... /pstore do not exist :-\
and /proc/last_kmsg.. neither :-(
i have.. lineage-14.1-20190213-nightly-asanti-signed install it....
He will be generating them elsewhere???
OP, please add the infamous soft brick symptoms in detail, this maybe help someone in the future.
It shows redmi logo, it can enter vol + menu with some messages (I forgot the message), and it can enter vol - (bootloader), and it will ask for authorization when hooked to SPFT. And also link to that telegram post for work around.
And also, this is crucial info I found. Anything prior global 12.0.7 can be dirty flashed to anything prior that (even A10 to A9). 12.0.7 onward, 12.0.7 is the lowest you can get for dirty flash. I don't know for clean flash. Maybe work, maybe not.
fla5 said:
i have:
can't boot to my mobile in past week
just i can see my device with "fastboot devices" but not found with adb devices
and in device manager "Android ADB Interface" it's not recognize ( yellow question marks).
also have "adb server version (41) doesn't match this client (39); killing"
Click to expand...
Click to collapse
What have you done prior brick? Do you do something like flashing global rom in a locked bootloader chinese flavor phone? If yes, do the unbrick with SPFT. If not, and you have unlocked your bootloader and access to fastboot, I think dirty flash will do the trick.
Sorry for being a lil' off-topic but I would love to ask how to prevent a bootloop after flashing back to stock recovery or/and boot. It happened twice - I used magisk+twrp, an update rolled out, I flashed the stock recovery for my official from (extracted from the official package) and ended up with a loop, did the mi authorized acc unbrick and it worked perfectly, now with the 12.5 rolling out I am preety sure i'll end with a loop again when I'll flash the stock boot or/and recovery.
luq90 said:
Sorry for being a lil' off-topic but I would love to ask how to prevent a bootloop after flashing back to stock recovery or/and boot. It happened twice - I used magisk+twrp, an update rolled out, I flashed the stock recovery for my official from (extracted from the official package) and ended up with a loop, did the mi authorized acc unbrick and it worked perfectly, now with the 12.5 rolling out I am preety sure i'll end with a loop again when I'll flash the stock boot or/and recovery.
Click to expand...
Click to collapse
you need to restore stock recovery and boot. and you can't install the update via updater nor twrp. install full rom via fastboot update or via mi flash (dirty flash is ok). but for 12.5 update, do it in twrp
from 12.0.7 onwards, downgrade without erasing data will lead to bootloop (just flash the correct build for remedy)
Thank you for your answer kekesed97.
Sorry, I made a small mistake. By saying that I used twrp means I had it installed not used for the flash. When the update came out, I thought that installing via ADB the stock recovery and boot will let me update the device like a completly unmodded model. Tried this Twice and always ended with a loop. Afterwards the only solution was updating via flashtools (it's bricked anyway so let's update manually hehe).

SOLVED This device only boots to recovery after "successful" custom ROM installation

Hi all,
I'm happy to accept help as--to the extent of my abilities--this Mi 10T Lite is bricked. But it's not hard-bricked yet! Since I'm completely green to the world of ROM flashing, it's simply an issue of me following instructions I do not yet understand and butting my head against it when the result deviates from the tutorial.
Issue
The problem is this: with the help of instructions on this forum and YouTube I'm able to successfully perform an installation of LineageOS. No errors occur. But then when I reboot the device it will automatically boot to recovery instead and then it seems as if the installation has been undone or was never carried out.
Details
TWRP build: twrp_gauguin_mi10tl-rn9p5g_mi10i_3.5.a10_05-03-2021_d-bl-l_fix-mtp-after-format
LineageOS build: lineage-17.1-20210205-UNOFFICIAL-gauguin
OpenGApps version: open_gapps-arm-10.0-nano-20210314
Things I tried and phone's behavior
• I have tried other ROMs. Because perhaps it's Lineage's fault, I thought. But the same problem occurs with any ROM I try to install. Successful installation -> boot to system -> back to recovery.
• I tried rolling back to the back-up I took. But when I restore it and reboot the phone, it gets in an endless reboot cycle until I enter recovery or fastboot mode again.
• I unsuccessfully tried reinstalling the stock ROM (the stable release of MIUI 12.0). The installation was aborted with the error: assert failed: update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")). But this is a problem probably better suited for a thread on the Xiaomi community forum where the ROM is published. I would rather get LineageOS on my phone than going back to stock, but maybe this error is significant to the solution in some way.
• Looking for existing troubleshooting threads proved difficult because I'm not even sure what to look for. Googling "custom rom installs successfully but actually it doesn't" won't yield any results.
• I'm new at flashing custom ROMs. This is the second phone I installed Lineage on. The first phone was a Samsung Galaxy J3 and I succeeded without problem by simply following the instructions, so I'm even newer at troubleshooting for this. Be aware of that please!
The instructions I followed to try an install
Prerequisite: the phone's previous OS was MIUI 12, based on Android 10.
Wipe Dalvik / ART Cache, Data, and Cache.
Flash the ROM from the external SD card.
Flash OpenGApps from the external SD card.
Format Data.
Reboot.
After wiping everything can you go to the mounts menu and mount all partitions (mainly system data and cache)
As long as all partitions can be mounted the rom should flash assuming it's the right rom for the phone/firmware
Thank you for replying.
I'm using TWRP. And I found out that system was unchecked in the mounts menu all this time. As I understood it the only purpose for mounting a partition is to present it to a device connected via USB.
So when I check the checkbox for system to mount it, then after installation system is unmounted again. The console log mentions it unmounts system just before flashing. The result is the same: a "successful" installation and then reboot back into recovery without an OS installed.
How do I check what firmware version is currently installed on my Mi 10T Lite in recovery? It was fresh off the shelves, and it had the latest software installed as of March 20th.
CyanMatter said:
Thank you for replying.
I'm using TWRP. And I found out that system was unchecked in the mounts menu all this time. As I understood it the only purpose for mounting a partition is to present it to a device connected via USB.
So when I check the checkbox for system to mount it, then after installation system is unmounted again. The console log mentions it unmounts system just before flashing. The result is the same: a "successful" installation and then reboot back into recovery without an OS installed.
How do I check what firmware version is currently installed on my Mi 10T Lite in recovery? It was fresh off the shelves, and it had the latest software installed as of March 20th.
Click to expand...
Click to collapse
A rom zip should automatically mount partitions then unmount them after
The reason I asked for manual mount is to test there's no errors in mounting
Are you sure you're on android 10 and not android 11 as android 11 was out on the date you mentioned
This might also be the reason you can't flash stock firmware if you're flashing android 10 firmware when your device is already on android 11
In fastboot mode with phone connected to pc - in cmd/terminal type
fastboot getvar all
To get firmware version and device info
TheFixItMan said:
A rom zip should automatically mount partitions then unmount them after
The reason I asked for manual mount is to test there's no errors in mounting
Are you sure you're on android 10 and not android 11 as android 11 was out on the date you mentioned
This might also be the reason you can't flash stock firmware if you're flashing android 10 firmware when your device is already on android 11
Click to expand...
Click to collapse
I'm positive it's on Android 10, but you're making me doubt that. A search shows plenty of articles announcing Android 11 has been rolling out for this device indeed.
So if in theory this device is actually on Android 11, then I should be able to flash this ROM: https://forum.xda-developers.com/t/rom-unofficial-11-0-gauguin-dotos.4231683/
I downloaded the ROM based on Android 11 mentioned above, but when I try to install it this time it throws this error:
assert failed: update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list"))
I don't understand what it means, I can find only one thread that mentions the error. In their case they solved it by formatting data a couple of times until it took. But it doesn't work for me.
EDIT: I just found out I can put a file, any random file, in my internal storage and have it disappear when I reboot to recovery. That doesn't make sense to me. That shouldn't happen, right?
EDIT 2: Disregard that. It seems to have been a weird blip because I can't reproduce it. It's strange because files I put in there disappeared without me wiping anything.
CyanMatter said:
I downloaded the ROM based on Android 11 mentioned above, but when I try to install it this time it throws this error:
assert failed: update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list"))
I don't understand what it means, I can find only one thread that mentions the error. In their case they solved it by formatting data a couple of times until it took. But it doesn't work for me.
EDIT: I just found out I can put a file, any random file, in my internal storage and have it disappear when I reboot to recovery. That doesn't make sense to me. That shouldn't happen, right?
EDIT 2: Disregard that. It seems to have been a weird blip because I can't reproduce it. It's strange because files I put in there disappeared without me wiping anything.
Click to expand...
Click to collapse
All I can suggest is try flashing one of the latest stock firmware files via fastboot so at least you'll have a working device
V12.0.2.0.RJSMIXM or V12.0.1.0.RJSEUXM (download on pc)
Download latest MIUI ROMs for Mi 10T Lite - Xiaomi Firmware
The Xiaomi Mi Note 10 Lite is a full package and it can be found under $300. The curved 6.47″ AMOLED display and aluminum bezels give the phone a premium look without sacrificing functionality. It seems like Xiaomi Mi Note 10 Lite can be the best phone you can get for this budget. The AMOLED...
xiaomifirmware.com
Instructions
How to flash Xiaomi firmware via Fastboot & Recovery mode
Flashing your Redmi/Mi smartphone with Xiaomi official firmware (MIUI) will help you fix certain software issues on the phone. It also helps you to get rid of root and all modifications made to your phone system software. To upgrade, update or fix minor software problems on your phone, flashing...
www.leakite.com
TheFixItMan said:
All I can suggest is try flashing one of the latest stock firmware files via fastboot so at least you'll have a working device
V12.0.2.0.RJSMIXM or V12.0.1.0.RJSEUXM (download on pc)
Download latest MIUI ROMs for Mi 10T Lite - Xiaomi Firmware
The Xiaomi Mi Note 10 Lite is a full package and it can be found under $300. The curved 6.47″ AMOLED display and aluminum bezels give the phone a premium look without sacrificing functionality. It seems like Xiaomi Mi Note 10 Lite can be the best phone you can get for this budget. The AMOLED...
xiaomifirmware.com
Instructions
How to flash Xiaomi firmware via Fastboot & Recovery mode
Flashing your Redmi/Mi smartphone with Xiaomi official firmware (MIUI) will help you fix certain software issues on the phone. It also helps you to get rid of root and all modifications made to your phone system software. To upgrade, update or fix minor software problems on your phone, flashing...
www.leakite.com
Click to expand...
Click to collapse
Ok, so... funny thing happened. I followed this advice and it worked, I can boot my system into MIUI 12 again!
BUT when flashing the firmware, after 7 minutes the flashing tool reported an error and seemed to have aborted the process; status: error:Not catch checkpoint (\$fastboot -s .* lock),flash is not done. Meanwhile, while I was worried it failed, the device actually rebooted into the stock OS.
Here is the relevant part of the log. The failed checkpoint does not seem to be crucial to the process. These are the last lines, and I masked my device code as I'm worried it's identifying information.
Code:
[02:13:37 {device code}]:info2:Rebooting OKAY [ 0.001s]
[02:13:37 {device code}]:info2:Finished. Total time: 0.001s
[02:13:37 {device code}]:begin FlashDone
[02:13:37 {device code}]:errMsg is null
[02:13:37 {device code}]:begin checkPoint
[02:13:37 {device code}]:error:Not catch checkpoint (\$fastboot -s .* lock),flash is not done
[02:13:37 {device code}]:process exit.
[02:13:37 {device code}]:flashSuccess False
[02:13:37 {device code}]:isFactory False CheckCPUID False
[02:13:37 {device code}]:before:flashSuccess is False set IsUpdate:True set IsDone True
[02:13:37 {device code}]:after:flashSuccess is False set IsUpdate:false set IsDone true
Still, thank you lots for your help! At least I can use my device now. Next time I'll double check my software versions before flashing a custom ROM.

Unable to enter bootloader mode on one particular XZ2c but can on other XZ2c phones.

I bought a third XZ2c H8324 to install LineageOS onto. The first two phones I had no problems, but this third phone won't boot into bootloader mode for an unknown reason.
When I hold down the vol up button when plugging the phone into the PC, the LED flashes red and blue forever until I let go of the vol up button. Then the charge icon appears on the screen instead of the LED staying blue.
Background: I first backed up the TA partition which involved flashing firmware with newflasher then flashing again to the newest firmware with newflasher again. I'm wondering if I did something different and caused a problem. The files used are the same ones I used for the other two phones. I did notice after the firmware downgrade with newflasher that the shell output had an error:
Instead of the normal output at the last part of flashing with newflasher:
#Device is put now out of flash mode.
#Sent command: Sync
#Waiting sync to finish…
#……………… done
#Sent command: continue.
#Done.
#Closing device.
I got a timeout error after #Waiting sync to finish....
The same error occured when using newflasher to update to the latest firmware again. The stock firmware boots normally.
I don't know if using newflasher somehow caused the problem or not.
I don't know if bootloader mode worked prior to flashing the firmware because I didn't test it.
[edit: Issue resolved.
I decided to download another H8324 firmware with XperiFirm, this time I used the Australian variant. Then with Androxyde's FlashTool, I did Tools >> Bundles >> Create to make an .ftf file. Then flashed it with all check boxes in the Wipe-Sin catagory ticked.
I don't understand why this firmware fixed it and not the french one I used before, but whatever the case may be, if someone else encounters the same problem they can see my path to success.]

Categories

Resources