[CLOSED] Decrypting Xiaomi Mi10T Pro Internal Storage

Status
Not open for further replies.
Search This thread

Leonniar

Senior Member
Sep 23, 2021
83
4
Hello guys,
I run into a problem recently were my device won't boot. I tried a plethora of different solutions but nothing worked, I will have to factory reset to fix the issue.
My problem right now is that I can't access my files to make a backup. On my computer the device is connected and recognized but I can't access it's files. I also have TWRP and in TWRP Recovery it's unable to mount the Internal Storage and it shows up as 0MB. After a lot of research what seems to be the problem is that my files are encrypted, I don't know why this is (I guess for protection) but I didn't have any problems before. To my understanding if the phone is booted up you can access the files but if it can't boot then they stay encrypted. The encryption key should still be in my phone since I haven't formated it.
So how can I decrypt my data so that I can backup my files ? there must be a way for cases like this when something happens and the device can't boot, since the key is in the device it's self and I have the phone I should be able to, I also have access to every single account (google, xiaomi etc.) that is associated with this smartphone. If for security reasons that is not possible, would an authorized repair center be able to do it with proof of purchase and ownership ?
I am not 100% sure of my os version but it was 12.5.x.x, I have the unofficial twrp 3.5.0_10-beta. USB Debugging is enabled. Any other information you might need I can provide!

Thanks a lot everyone !
 
Solution
Code:
I:Unable to decrypt metadata encryption
E:Unexpected value for crypto key location
E:Error getting crypt footer and key
Code:
I:operation_start: 'Repair Partition'
Repairing Data using fsck.f2fs...
I:Repair command: /system/bin/fsck.f2fs /dev/block/sda34
        Info: No support kernel version!
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 4096
Info: total sectors = 28051451 (109575 MB)
        Invalid SB CRC offset: 1205917355
        Can't find a valid F2FS superblock at 0x0
        Invalid SB CRC offset: 876348585
        Can't find a valid F2FS superblock at 0x1
/system/bin/fsck.f2fs /dev/block/sda34 process ended with ERROR: 255
Unable to repair Data.
you have formatted userdata...

Leonniar

Senior Member
Sep 23, 2021
83
4
you lose Magisk superuser but you won't lose root. just install apk from github again.

the other issue sounds like you lost baseband, probably due booting into wrong slot.
Oh ok great, easy to do.

I am not sure why this happened, trying to change slots using cmd and fastboot
"fastboot --set-active=b" or "fastboot --set-active=a"
I get:
"Device does not support slots" So most likely it didn't boot in the wrong slot, any other ideas ? Should I make a separate thread if it's not an easy fix ? I don't want to keep bothering you.
Thanks again !
 
Last edited:

Leonniar

Senior Member
Sep 23, 2021
83
4
Did baseband work last time rooted with Magisk? check the about phone - baseband version
Yeah I had no problems, calls sms internet everything worked. About the baseband, I can't go into settings because the device is locked, tried to get it via ADB:
"adb shell getprop gsm.version.baseband" this didn't return anything
"adb shell getprop | grep baseband" with this I got an error "'grep' is not recognized as an internal or external command"
 

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
it seems you forgot to remove mi account after unlocking bootloader, now you're locked in FRP.

download stock ROM according to your current buildno and flash radio/modem from fastboot (or flash all partitions and start from scratch)
 

Leonniar

Senior Member
Sep 23, 2021
83
4
it seems you forgot to remove mi account after unlocking bootloader, now you're locked in FRP.

download stock ROM according to your current buildno and flash radio/modem from fastboot (or flash all partitions and start from scratch)
Am I not supposed to have a mi account with an unlocked bootloader ? No guide mentioned that and I kept it because I use a lot of it's features (cloud, that's were I save contacts etc.)

For the stock ROM I just need to find the latest version right ? I don't need the older version that was preinstalled in the device correct ? Any idea how to find which one I need to use ? The box and manual of the phone provide no information, I've found many websites to download the ROMs but none that help you find the right one with your build number like you mentioned
I also noticed that some ROMs with the same version name have Types that are either fastboot or recovery which one should I download ?
 
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
no need to remove mi account. but keep in mind you have to unlock FRP each time you factory reset device.

check fastboot for hints
Code:
fastboot getvar all
 

Leonniar

Senior Member
Sep 23, 2021
83
4
no need to remove mi account. but keep in mind you have to unlock FRP each time you factory reset device.
OK great, that's fine by me
check fastboot for hints
I got nothing usefull, only serialno but tried searching with that already and found nothing, I couldn't find any information using it to guide me to my Stock ROM.
I did notice that baseband and bootloader version came up empty.

I also noticed that some ROMs with the same version name have Types that are either fastboot or recovery which one should I download ?
 

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
download the fastboot variant for global, flash from fastboot with flash_all_except_storage.bat

you can check version in TWRP. mount System and check build.prop for ro.build.fingerprint
Code:
adb shell
# mount /system_root
# mount /system
# grep ro.build.fingerprint /system*/system/build.prop
 
Last edited:

Leonniar

Senior Member
Sep 23, 2021
83
4
OK give me a moment because I am not familiar with how to do this part:
download the fastboot variant for global, flash from fastboot with flash_all_except_storage.bat
you can check version in TWRP. mount System and check build.prop for ro.build.fingerprint
Code:
adb shell
# mount /system_root
# mount /system
# grep ro.build.fingerprint /system*/system/build.prop

Running the commands, "# mount /system_root" didn't return something
"# mount /system" I got this: mount: '/system' not in fstab
"# grep ro.build.fingerprint /system*/system/build.prop" also returned nothing

Also, I am searching for ROMs at xiaomifirmwareupdater.com and it mentions: "This page shows a single update only." Will that work ?

Edit:
I have ADB and Fastboot installed on my computer but I can't find the "flash_all_except_storage.bat" script. Can I do the same thing using cmd ? Or is it better to just find and download the script ?
 
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
you can of course install recent version, but bear in mind Anti-Rollback Protection will prevent downgrades. I don't like Android 12 but that's up to you.

no need to quote all of my posts btw, just use the reply button ;)
 
Last edited:

Leonniar

Senior Member
Sep 23, 2021
83
4
Great, I will take a look first thanks. I am using reply but it quotes everything automatically hahaha

Just a bit of clarification, should I put the ROM inside the platform-tools directory or just he .bat file or I don't have to move anything at all. Also I am not sure how to run flash_all_except_storage.bat with cmd.
I have CMD open and cd-ed into the platform-tools dir already

Edit:
Is that correct ?
Path- Environment Variables
 
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
cd into extracted ROM directory where flash_all_except_storage.bat is. just type 'fastboot devices' and 'flash_all_except_storage.bat' if fastboot is in path.

edit: if \ABD 2\ is no typo then yes ;)
 

alecxs

Forum Moderator
Staff member
Feb 17, 2016
4,242
7
2,916
gitlab.com
no clue what is the problem with that batch file..

either comment out first two lines with notepad (prefix REM) or add these first line maybe?

Code:
@echo off
setlocal enabledelayedexpansion
REM fastboot %* getvar product 2>&1 | findstr /r /c:"^product: *apollo" || echo Missmatching image and device
REM fastboot %* getvar product 2>&1 | findstr /r /c:"^product: *apollo" || exit /B 1

btw: you can select terminal output with mouse, copy with Enter key, and paste the text in [CODE]tags[/CODE] here. screenshots are hard to read on mobile.
 
Last edited:
  • Like
Reactions: Leonniar
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    TWRP will ask for lock screen credentials used for decrypting userdata partition. on FBE encryption the partition is mounted and even with no credentials provided one should at least see encrypted files.

    In your case it's bit more complicated as that device uses FBE + metadata encryption. while in TWRP provide recovery.log to see what is going on. (share link to pastebin.com with expiration date 1 month)
    Code:
    adb pull /tmp/recovery.log

    Note: there exist no relation between (FDE) encryptable= and (FBE) fileencryption= flags, these flags aren't interchangeable.
    https://github.com/mhmdeve/twrp_dev...-twrp/recovery/root/system/etc/twrp.fstab#L18
    1
    no clue what is the problem with that batch file..

    either comment out first two lines with notepad (prefix REM) or add these first line maybe?

    Code:
    @echo off
    setlocal enabledelayedexpansion
    REM fastboot %* getvar product 2>&1 | findstr /r /c:"^product: *apollo" || echo Missmatching image and device
    REM fastboot %* getvar product 2>&1 | findstr /r /c:"^product: *apollo" || exit /B 1

    btw: you can select terminal output with mouse, copy with Enter key, and paste the text in [CODE]tags[/CODE] here. screenshots are hard to read on mobile.
    1
    Yep, still "RKQ1.200826.002/V12.5.4.0.RJDEUXM" as expected, the same as first time, the same one I keep/try flashing.

    "ro.build.version.release=11", to my understanding that means android 11, so no android 12 either

    Edit:
    Could it be a problem with flash_all.bat failing so many times ? Because I've tried to run it like 10 times so far and it only run without errors once, and another time when it crashed after metadata.

    Just a tip: if you had bootloop and automatically entered fastboot, better boot into fastboot mode manually on your own again, either with the power button method or fastboot command method.

    Everytime after a flashing process, whether success or failed, and would need to flash something in fastboot, reboot to fastboot mode manually to avoid some unexpected processing remnants when automatically entering fastboot mode.

    Reboot PC and unplug USB cable then plug it back.
    Change an USB cable might also help.

    Also, if the ROM folder name is long, rename it short like "ROM". Sometimes there's issue without this renaming. Put it in as the location like: "F:\ROM\"
    This is probably the reason when you flash the fastboot ROM, but it finished in an instant. I see it was told.

    I don't have this phone, but it may help in some way.