In rare circumstances a boot loop can occur. This happened to me twice and as I use full disk encryption I first thought it is related to encrypted devices only. But it affects both types!
Problem
Booting fine, PIN entering of the SIM went fine, entering the decryption password went fine -> green robot is displayed. Normally it needs some time about 1-2 minutes or so from now on to see the login screen. Even after 15 minutes the same picture nothing happening anymore.
First booted into recovery and as I use sediTWRP I'm able to decrypt without any problems.
Then I backed up everything by TWRP and my internal storage manually as that is nothing TWRP can do. (adb shell, cd /external_sd/ ; mount /sdcard; tar czf sdcard.tgz /sdcard ).
Well as said I thought it might be because of the encryption so I completely wiped out /data and /sdcard to have an unencrypted device. I also deleted /efs/metadata which holds the crypt parameters and now I had a complete unencrypted device holding all my backuped data.
Booting unencrypted leaves the boot logo displayed and ... hanging. The same as for the encrypted part! So it has nothing directly to do with encrypting the device.
As that has happened to me the second time in the last 6 months I decided to investigate further what the root cause here is. ... and I found it!
Reason
I will not write all the debug code here and tests I made but finally I have detected the root cause of such hang.
Ok only a short (and most important) one:
while true; do lsof >> /cache/lsof.debug; sleep 0.2; done
Android tries to access several XML files when in booting state. And the boot process will wait until those are processed. This will just be a second or less of time to wait normally so you will not recognize that.
But there is a real BUG with that behaviour: When the XML is there but somehow zeroed out (means it exists but it is in fact empty inside) Android will hang!
In my case the files preventing the boot were:
All those files are 0 size so empty and they are tried to being accessed by a system app within the boot process.
Solution
Well those XMLs are filled by Android once booted up so it is absolutely safe to delete them.
Doing this manually and doing that for the above only is may not sufficient so the solution would be to find out which xmls are blocking the boot process and then checking if they are 0 size. If they have 0 bytes delete them.
Description
In rare circumstances a boot loop can occur. This happened to me twice and as I use full disk encryption I first thought it is related to encrypted devices only. But it affects both types!
Problem
Booting fine, PIN entering of the SIM went fine, entering the decryption password went fine -> green robot is displayed. Normally it needs some time about 1-2 minutes or so from now on to see the login screen. Even after 15 minutes the same picture nothing happening anymore.
First booted into recovery and as I use sediTWRP I'm able to decrypt without any problems. Then I backed up everything by TWRP and my internal storage manually as that is nothing TWRP can do. (adb shell, cd /external_sd/ ; mount /sdcard; tar czf sdcard.tgz /sdcard ).
Well as said I thought it might be because of the encryption so I completely wiped out /data and /sdcard to have an unencrypted device. I also deleted /efs/metadata which holds the crypt parameters and now I had a complete unencrypted device holding all my backuped data.
Booting unencrypted leaves the boot logo displayed and ... hanging. The same as for the encrypted part! So it has nothing directly to do with encrypting the device.
As that has happened to me the second time in the last 6 months I decided to investigate further what the root cause here is. ... and I found it!
Reason
I will not write all the debug code here and tests I made but finally I have detected the root cause of such hang. Ok only a short (and most important) one:
while true; do lsof >> /cache/lsof.debug; sleep 0.2; done
Android tries to access several XML files when in booting state. And the boot process will wait until those are processed. This will just be a second or less of time to wait normally so you will not recognize that. But there is a real BUG with that behaviour: When the XML is there but somehow zeroed out (means it exists but it is in fact empty inside) Android will hang! In my case the files preventing the boot were:
All those files are 0 size so empty and they are tried to being accessed by a system app within the boot process.
Solution
Well those XMLs are filled by Android once booted up so it is absolutely safe to delete them. Doing this manually and doing that for the above only is may not sufficient so the solution would be to find out which xmls are blocking the boot process and then checking if they are 0 size. If they have 0 bytes delete them.