• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Messed up TWRP - stuck on decrypting

Search This thread

Destroy666x

Member
Nov 22, 2015
23
0
So, recently, my Magisk stopped working. I thought I fixed it with seveal steps, including updating Magisk and TWRP, and it worked fine at first, but after one of restarts TWRP started requesting encryption password and doesn't boot into system. Entering system pass/pin doesn't let me into TWRP either, it's stuck on "Attempting to decrypt FBE for User 0".

I haven't done anything related to flashing in 1.5 year so I'm kind of lost now. What would be the best way to recover from this without losing any data? I assume some ADB actions, but what do I need to do exactly?
 

Destroy666x

Member
Nov 22, 2015
23
0
One more note that I thought was irrelevant: I installed Viper in Magisk. Didn't expect such patch could do this, but after some googling I found 2 people having simila issue afte installing that. Please help! Would replacing boot image to MIUI's help in that case?
 

Destroy666x

Member
Nov 22, 2015
23
0
That does not help. If it was as easy as googling I'd have it fixed a long time ago. I don't want to lose any data, to remind. But tried flashing original boot.img as it doesn't mes with data and it didn't halp. Any othe ideas?

EDIT: ok, after desperately flashing back both TWRP and boot.img repeatedly and trying to get into TWRP it somehow did something and I got into the system at least to do some fresh backups with Titanium and potentially other apps. I have no clue how to proceed though as I need Magisk to work. Well, the first thing will be to ty to uninstall Viper. But not sure it was the cause in the first place and I'm too afraid to restart. Any clues on what may be the culpit and how to poceed in the safest way?

EDIT2: nvm, ofc I can't really do a full backup using Titanium since Magisk got disabled after flashing original boot.img. Neither uninstall the Viper module. So even more not sure what to do now. Would temporarily disabling the password help?

EDIT3: "google it" type of advice forced me to brick even further as trying to install Magisk/dm-verity now ended up with bootloop. Also, interestingly, older TWRP doesn't have this decyption issue, more info: https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1610
 
Last edited:

kekesed97

Senior Member
"Decryption issue", eh. I bet you are using 12.0.7/12.0.8/12.5.1. Some folk at Xiaomi decides to do a different approach on encryption, rendering encryption issue. This issue has been solved in a newer version of TWRP except for 12.5.1. But do tell me your current MIUI version.
Use MiFlash to flash your CURRENT version of MIUI (or something above or below, I don't care. Just don't downgrade from 12.0.7, you'll face even more headaches) with "Flash all except data" command. Your device will fine, your data will also intact. I've done this dozen of times.
Another piece of advice: don't carry over your magisk module if you're planning to install a stock boot. Install everything freshly.
 

LR7875

Senior Member
Jun 25, 2021
746
263
Samsung Galaxy Tab 2
Xiaomi Mi Pad
That does not help. If it was as easy as googling I'd have it fixed a long time ago. I don't want to lose any data, to remind. But tried flashing original boot.img as it doesn't mes with data and it didn't halp. Any othe ideas?

EDIT: ok, after desperately flashing back both TWRP and boot.img repeatedly and trying to get into TWRP it somehow did something and I got into the system at least to do some fresh backups with Titanium and potentially other apps. I have no clue how to proceed though as I need Magisk to work. Well, the first thing will be to ty to uninstall Viper. But not sure it was the cause in the first place and I'm too afraid to restart. Any clues on what may be the culpit and how to poceed in the safest way?

EDIT2: nvm, ofc I can't really do a full backup using Titanium since Magisk got disabled after flashing original boot.img. Neither uninstall the Viper module. So even more not sure what to do now. Would temporarily disabling the password help?

EDIT3: "google it" type of advice forced me to brick even further as trying to install Magisk/dm-verity now ended up with bootloop. Also, interestingly, older TWRP doesn't have this decyption issue, more info: https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1610
Sorry, I apologize for that
 

Destroy666x

Member
Nov 22, 2015
23
0
"Decryption issue", eh. I bet you are using 12.0.7/12.0.8/12.5.1. Some folk at Xiaomi decides to do a different approach on encryption, rendering encryption issue. This issue has been solved in a newer version of TWRP except for 12.5.1. But do tell me your current MIUI version.
Use MiFlash to flash your CURRENT version of MIUI (or something above or below, I don't care. Just don't downgrade from 12.0.7, you'll face even more headaches) with "Flash all except data" command. Your device will fine, your data will also intact. I've done this dozen of times.
Another piece of advice: don't carry over your magisk module if you're planning to install a stock boot. Install everything freshly.
Thanks for reply. MIUI 11.0.6.0. Thinking about upgrading to 12 but won't that lose data? I read that flashing ROMs in general results in data loss, does flashing current one differ because it's basically the same system? And I guess because of that option. Do I need MiFlash for it or is that also available in any othe tool?

Also, to make sure we undestand data in the same way, by data I mean the following:
- app data, obvious
- app permissions, annoying to set up if lost as I have lots of apps
- notification settings, similarly as above
- other system settings, not as annoying but still some work
Would love to keep all of these.
 

kekesed97

Senior Member
Thanks for reply. MIUI 11.0.6.0. Thinking about upgrading to 12 but won't that lose data? I read that flashing ROMs in general results in data loss, does flashing current one differ because it's basically the same system? And I guess because of that option. Do I need MiFlash for it or is that also available in any othe tool?
Official upgrades won't lose your data (dirty flashable, as the name suggest "update"). In that case, use fastboot upgrade. I will recommend to hold to somewhere in 12.0.5 or 12.0.6, because if you messed up something, you can still downgrade to many versions, maybe up to initial version?
I did many downgrades before because I have tripped AVB many times, something like <newer A10 version available> -> installed magisk and TWRP -> AVB tripped -> <some A9 MIUI via miflash> -> fastboot update via mi flash pro to <same newer A10 version available> -> rinse and repeat until I got a stable system. Without costing any data. But with headaches, indeed.
Mi Flash is also another option. Make sure you choose the "flash_all_except_data". Or else, more unnecessary headaches.

Also, to make sure we undestand data in the same way, by data I mean the following:
- app data, obvious
- app permissions, annoying to set up if lost as I have lots of apps
- notification settings, similarly as above
- other system settings, not as annoying but still some work
Would love to keep all of these.
1. App and app data will stay
2. I guess app permission is also stay. But do confirm, since I never had any issue except when I enable/disable MIUI optimizations
3. Personalization will stay
 
  • Like
Reactions: Crescendo Xenomorph

kekesed97

Senior Member
Could you be more specific what this exactly means and how to do it without reflashing data? Googling this results in many unrelated to eachother things.

Asking because I had poblems wih Mi Flash before, so would be great to have a reliable alternative just in case.
Oopsie! Swapped fastboot with recovery rom, ehehe.
Use recovery rom (the 2 gb one). This will require stock boot, stock recovery, mi account, and internet connection. Flashing is done via MiFlash Pro (Just click that "Flash in Recovery" botton or go to recovery tab).

images.jpeg

Figure 1: Mi Flash Pro main interface

Or use Mi Flash by loading fastboot rom (the 4gb one) to Mi Flash, and select "flash_all_except_data".

images (1).jpeg

Figure 2: Mi Flash with "flash_all_except_data" enabled
 
Last edited:
  • Like
Reactions: Destroy666x

Destroy666x

Member
Nov 22, 2015
23
0
Oh ok, I see, recovery ROM, downloadable easily from MIUI website, is something you upload though recovery and fastboot ROM through fastboot/MiFlash. Found them here https://c.mi.com/oc/miuidownload/detail?guide=2 along with MiFlash 2020 version (is this the latest version?) but how do I find older ROM versions, e.g. my 11.0.6.0? The MIUI website seems to be a total mess, honestly. And I don't trust random Google results, bunch of them seem like virus traps redirecing to Mediafire and similar upload websites.

Is this also the official MiFlash Pro website? https://miflashpro.com/

EDIT: yes, it seems, also found https://xiaomiflashtool.com/ for the other app's latest version
 
Last edited:

Destroy666x

Member
Nov 22, 2015
23
0
Ok thanks. Now I wanted to backup data through older TWRP 3.3.1 that decrypts correctly, just in case, but it fails because it can't copy `/data/misc_ce/10`:

Code:
I:Error adding file '/data/misc_ce/10' to '/external_sd/TWRP/BACKUPS/mfaajbdu5s79pfhy/2021-07-28--04-07-40_PPR1180610011/data.ext4.win007'           
Error creating backup.                                                                                                                               
I:ERROR tarList for thread ID 0

Any clue what this folder is about and how to get around this? Any other way to backup with this level of access?
From what I see it's something about additional user, maybe from the MIUI functionality, but 0 clue if deleting this is safe.
 

kekesed97

Senior Member
Ok thanks. Now I wanted to backup data through older TWRP 3.3.1 that decrypts correctly, just in case, but it fails because it can't copy `/data/misc_ce/10`:

Code:
I:Error adding file '/data/misc_ce/10' to '/external_sd/TWRP/BACKUPS/mfaajbdu5s79pfhy/2021-07-28--04-07-40_PPR1180610011/data.ext4.win007'          
Error creating backup.                                                                                                                              
I:ERROR tarList for thread ID 0

Any clue what this folder is about and how to get around this? Any other way to backup with this level of access?
From what I see it's something about additional user, maybe from the MIUI functionality, but 0 clue if deleting this is safe.
No idea.
SP Flash tools have low level access to your device, including read back in the correct memory region.
 

Destroy666x

Member
Nov 22, 2015
23
0
No idea.
SP Flash tools have low level access to your device, including read back in the correct memory region.

Fixed that: https://forum.xda-developers.com/t/...ils-because-of-data-misc_ce-10-error.4311899/ and have a backup.

Unfortunately, flashing the recovery ROM = still bootloop. Would flashing the fastboot one be any different if I choose to keep data? Would it flash someting extra?

I read that reading these logs may also help with debugging, but not sue what to look for.
Kernel log (/proc/lastkmsg): https://pastebin.com/T2xBBRvi - some error looking lines at the end, but non-comprehensible. Can I use them somehow futher?
dmesg log: https://ghostbin.com/paste/vyBDk - don't really see anything here, but it's quite long and not sure what to look for
logcat: https://ghostbin.com/paste/PSh7f - lots of "avc" errors

EDIT: well, I tried the fastboot one too, recovery got replaced with stock is the only diffeence I noticed, So I guess that means the data is 100% corrupt and the culprit. How would installing Magisk and the dm-verity/forceencypt zip corrupt the data though? Since that's the only thing I did before he bootloop started happening. Does dm-verity/forceencrypt even affect data? I think Magisk does, but this is really weird anyways. Maybe when I tried to install it on the TWRP with broken encryption it caused some file system failure? Does anyone know which /data dirs does the Magisk zip mess with? Maybe deleting those would help

EDIT2: ran Magisk as uninstall.zip in back installed TWRP 3.3.1, which apparently deletes its data files, but nope, didn't do anything.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    "Decryption issue", eh. I bet you are using 12.0.7/12.0.8/12.5.1. Some folk at Xiaomi decides to do a different approach on encryption, rendering encryption issue. This issue has been solved in a newer version of TWRP except for 12.5.1. But do tell me your current MIUI version.
    Use MiFlash to flash your CURRENT version of MIUI (or something above or below, I don't care. Just don't downgrade from 12.0.7, you'll face even more headaches) with "Flash all except data" command. Your device will fine, your data will also intact. I've done this dozen of times.
    Another piece of advice: don't carry over your magisk module if you're planning to install a stock boot. Install everything freshly.
    1
    Thanks for reply. MIUI 11.0.6.0. Thinking about upgrading to 12 but won't that lose data? I read that flashing ROMs in general results in data loss, does flashing current one differ because it's basically the same system? And I guess because of that option. Do I need MiFlash for it or is that also available in any othe tool?
    Official upgrades won't lose your data (dirty flashable, as the name suggest "update"). In that case, use fastboot upgrade. I will recommend to hold to somewhere in 12.0.5 or 12.0.6, because if you messed up something, you can still downgrade to many versions, maybe up to initial version?
    I did many downgrades before because I have tripped AVB many times, something like <newer A10 version available> -> installed magisk and TWRP -> AVB tripped -> <some A9 MIUI via miflash> -> fastboot update via mi flash pro to <same newer A10 version available> -> rinse and repeat until I got a stable system. Without costing any data. But with headaches, indeed.
    Mi Flash is also another option. Make sure you choose the "flash_all_except_data". Or else, more unnecessary headaches.

    Also, to make sure we undestand data in the same way, by data I mean the following:
    - app data, obvious
    - app permissions, annoying to set up if lost as I have lots of apps
    - notification settings, similarly as above
    - other system settings, not as annoying but still some work
    Would love to keep all of these.
    1. App and app data will stay
    2. I guess app permission is also stay. But do confirm, since I never had any issue except when I enable/disable MIUI optimizations
    3. Personalization will stay
    1
    Could you be more specific what this exactly means and how to do it without reflashing data? Googling this results in many unrelated to eachother things.

    Asking because I had poblems wih Mi Flash before, so would be great to have a reliable alternative just in case.
    Oopsie! Swapped fastboot with recovery rom, ehehe.
    Use recovery rom (the 2 gb one). This will require stock boot, stock recovery, mi account, and internet connection. Flashing is done via MiFlash Pro (Just click that "Flash in Recovery" botton or go to recovery tab).

    images.jpeg

    Figure 1: Mi Flash Pro main interface

    Or use Mi Flash by loading fastboot rom (the 4gb one) to Mi Flash, and select "flash_all_except_data".

    images (1).jpeg

    Figure 2: Mi Flash with "flash_all_except_data" enabled
    1
    Here for a streamlined versions or here if you need betas
    Mi flash is included in mi flash pro if you want all in one solution. It also have miui downloader embedded