[Xiaomi Mi 5 ROMs, Kernels, Recoveries, & Other Dev] FcukBloat:
I could reinstall miui 8 via fastboot, then did some investigations about this encryption, then installed custom rom formatting everything, result is still something is wrong for me with encryption. but maybe I am wrong...

[MENTION=455439]bgcngm[/MENTION] can you please look all the steps below?

I think all this is in topic, but if you prefer I can open a separate thread ;)

so all I did is this:

starting situation: stuck at bootlogo, phone not booting

1. flashed xiaomi 6.9.8 global rom via fastboot with all these commands (luckily it worked this time):

fastboot flash tz tz.mbn

fastboot flash rpm rpm.mbn

fastboot flash aboot emmc_appsboot.mbn

fastboot flash hyp hyp.mbn

fastboot flash modem NON-HLOS.bin

fastboot format system

fastboot flash system system.img

fastboot flash cache cache.img

fastboot format userdata

fastboot flash userdata userdata.img

fastboot erase boot

fastboot flash boot boot.img

fastboot flash dsp adspso.bin

fastboot erase splash

fastboot flash splash splash.img

fastboot flash cust cust.img

2. could boot in miui. didn't enable any encryption or security unlock method

3. factory reset from within miui

4. reboot to miui

5. reboot to TWRP

TWRP didn't ask me for any password, but clicking on the log button, I could see:

"Data successfully decrypted, new block device: '/dev/block/dm-0'
Updating partition details...
...done
Succesfully decrypted with default password.
Updating partition details...
...done
Full SELinux support is present.
MTP Enabled

...so I think encryption was enabled automatically by miui as you said.

so at this point I did:

- factory reset (use rm -rf instead of formatting option is NOT enabled)

- reboot to TWRP > in log I could still see "Data successfully decrypted etc" at the top

- advanced wipe > wipe data (again use rm -rf instead of formatting option is NOT enabled)

- reboot to recovery > in log I could still see "Data successfully decrypted etc" at the top

.....this mean I couldn't remove encryption just formatting data right?

then:

6. wipe system/cache/dalvik/data (again use rm -rf instead of formatting option is NOT enabled)

7. flash AOSP custom rom from user [MENTION=5296790]33bca[/MENTION]

8. reboot to TWRP > in log I could still see "Data successfully decrypted etc" at the top

9. reboot into aosp rom > to boot I needed to enter decrypt password > 'default_password' is accepted but it says data is too damaged so you need factory reset etc

10. reboot to TWRP and tried both format data from advanced wipe menu and factory reset > but when booting AOSP rom I still saw same message about encryption, data damaged etc so couldn't boot in any way

11. via adb: fastboot format userdata

12. fastboot reboot

13. could then boot into AOSP rom, but only once

14. every time I tried to reboot then, got stuck at mi bootlogo all the time

15. but now with phone not booting, and after formatting userdata via adb, if I enter in TWRP in log I see this message:

Updating partition details...
...done
Full SELinux support is present.
MTP Enabled

...so encryption is gone only formatting userdata via adb?? do you confirm?

now will have to/can only reflash all miui rom partitions with fastboot....

I agree last steps (from flashing AOSP rom on) can be a rom problem, but all the previous? why can't get rid of that encryption unless I format user data via adb... am I missing something? when you say to format data you mean from twrp > wipe menu right?

thanks a lot in advance hope you can shed some light on this... I am getting crazy...!

ps. I am using your twrp from second post, test3 version