How to mount encrypted /data partition in recovery mode?

I installed Universal ADB drivers
Rebooted PC,
rebooted phone, entered fastboot,
typed fastboot boot recovery twrp-3.7.0_11-0-FP4.img in a terminal
same < waiting for any device >
Unplugged-plugged the cable, nothing changed

“fastboot boot” is a command for a on time boot in TWRP,
“fastboot flash” is for permanent install (even if you can revert by flashing recovery-e via fastboot or via the install feature in TWRP itself)

according to TWRP website :

adb reboot bootloader

You should now be in fastboot mode.

Download the correct image file and copy the file into the same folder as your platform-tools. Rename the image to twrp.img and type:

fastboot flash recovery twrp-3.7.0_11-0-FP4.img

fastboot reboot

Note many devices will replace your custom recovery automatically during first boot. To prevent this, use Google to find the proper key combo to enter recovery. After typing fastboot reboot, hold the key combo and boot to TWRP. Once TWRP is booted, TWRP will patch the stock ROM to prevent the stock ROM from replacing TWRP. If you don’t follow this step, you will have to repeat the install.

according to my readings :

you also could try
fastboot reboot recovery

.

.

other method :

the phone in recovery mode, connected to a PC via USB, select “apply an update” → “apply from adb”
on the PC, open a terminal from the folder where you downloaded twrp-installer-3.7.0_11-0-FP4.zip an type :

adb sideload twrp-installer-3.7.0_11-0-FP4.zip

On the phone, go back to the main menu and choose advanced, reboot to recovery

not at all - if your phone hasn’t locked bootloader, you can boot into twrp on-the-fly, no flashing involved, just boot your devices twrp image and follow the examples in this thread where things worked out

fastboot boot twrp.img (no “recovery” between boot and .img file)

1 Like

Thank you two
I’d rather try tcecyk’s solution that does not involve flashing a new ROM, (I just want to delete some files and hope to come back to previous state), but so far I am not able to use twrp correctly. fastboot boot twrp.img (with the right path and file name) gives me the same < waiting for any device >

On my phone, in Recovery I tap Enter fastboot (or in a terminal on my PC I type adb reboot fastboot)
then in a terminal I type fastboot devices and I have nothing. Perhaps a first error comes already from there…
Whereas in Recovery mode adb devices gives me my device, authorized

Run Windows update, with the phone connected and in Fastboot mode.

(You are likely to see right now that your phone in Fastboot mode is seen by Windows Device manager as a " :warning: Problem device".)

1 Like

Could be the old downloaded updates install files i you don’t have deleted them,
Go to check in the /data/lineageos_updates folder.

Otherwise, your called “internal storage” is located in /sdcard when “physical micro-SDcard” is located in /external_sd

All the folders are said empty (/data, /sdcard,…) with adb shell ls.

You are right, in the Device Manager my phone in Fastboot mode is marked as problem device (“no driver installed”), when undetected in recovery. I ran Windows update, and it is the same : >fastboot devices brings me none.

I installed TWRP with this method you suggested. Then went back into Recovery to enable ADB and try mount /data. I had not the same answer (as before):

>adb shell
FP4:/ $ mount /data
mount: '/dev/block/bootdevice/by-name/userdata' not user mountable in fstab
1|FP4:/ $ cat /etc/fstab
/dev/block/by-name/metadata /metadata ext4 discard 0 0
/dev/block/bootdevice/by-name/userdata /data f2fs discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt 0 0
/dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 barrier=1 0 0
/dev/block/bootdevice/by-name/modem_b /vendor/firmware_mnt vfat shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 0 0
/dev/block/bootdevice/by-name/dsp_b /vendor/dsp ext4 barrier=1 0 0
/dev/block/bootdevice/by-name/bluetooth_b /vendor/bt_firmware vfat shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 0 0

In TWRP, if you tap on the “Advanced” button, you will find the “File Manager”

Maybe that is a typo, but below is

the full Windows drivers workup

It is a known issue that there are often a variety of Windows drivers for some Android devices. It will vary by device, but Windows may have provided a simple driver allowing communication with the device normally, but not in fastboot mode. Sometimes the “full” driver might have the name “Combination driver”. Windows is expected to be able to find such driver automatically as follows.

To check and fix

Connect the phone, powered on, normally booted, to you Windows PC with a good usb data cable, and open Windows Device Manager.

Open a terminal alongside and use the command

adb devices

to check that you can communicate with the phone. The expected response is for the device to identify itself with serial number and another string, for example

abc2345def device

Any device with a driver issue whould appear in Device manager as :warning: Problem device.

If you see a :warning: Problem device, run Windows Update, ensure the warning clears.

Now importantly check the phone in the other bootable modes. Boot the phone into Recovery mode, Device Manager still open; use the command

adb devices

Boot into Fastboot mode and use the command

fastboot devices

Should the :warning: appear at any stage, run Windows Update again.

Still an issue, what is the output of

adb --version

Is it up to date compare with https://developer.android.com/tools/releases/platform-tools#3501_march_2024

Thank you, after reboot I finally have TWRP interface. I tapped Advanced i found all the folders. For now eveything looks empty…

So it could be not decrypted

Folders that are not empty :
/acct
/apex
/config
/dev
/mnt
/odm
/proc
/res/images
/sbin
/sys
/system
/tmp
/twres
/vendor/etc
and /

I tried to delete 3 files in /tmp (ex : com.android.apex.cts.shim.apex), I got always the same display :

Android Rescue Party trigger! Possible solutions? Either : 
 1.Wipe caches, and/or
 2. Format data, and/or
 3. Clean-flash you ROM.

The reported problem is:
 '--reason=RescueParty'

Updating partition details...
Failed to mount '/data' (Invalid argument)
...done
Unable to mount storage
Updating partition details...
Failed to mount '/data' (Invalid argument)
...done
Unable to mount storage
Full SELinux support is present.
Unable to mount /data/media/TWRP/.twrps
MTP Enabled

with 2 options :
Back and Reboot System

but when I tapped Back the file did not appear anymore.

Unfortunately this is not enough…

With cd /

Do you recognise the contents of

/sdcard

and

/external_sd

With the TWRP file manager you can copy files from one location to another. If you know you have space on your SD card you can copy large files you recognise from /sdcard (internal storage) to /external_sd (the SD card). One might especially look for movies /mp4.There is a “Sort by Size” button top right.

/sdcard is empty, both in TWRP and in terminal :

FP4:/ # cd /
FP4:/ # ls -l sdcard/
total 0

The heaviest files are now TWRP language files… Whitch I tested to move to /external_sd successfully. The problem is that my data files that cause storage space to be considered “almost full” are not to be found… :pensive:

Perhaps there are more clues starting from the top of the thread :slight_smile:

This seems a very reasonable idea How to mount encrypted /data partition in recovery mode? - #25 by tcecyk although I have never been in this position myself, this is a thing which I find I can do from TWRP > Wipe > Advanced wipe > Wipe Cache +Dalvic /Art, which I just tried on another phone without apparent harm on reboot to system.

It seems to me that doing it this way might harm your next running system. So you might consider if this happened would you be able to clear some storage (on possibly a fragile system), then adb sideload preferably the same build on the device right now. (I say sideload as I do not know for sure if the standard fastboot flash script will always delete data.) The sideload builds are available from

@aibd - if the space wasn’t enough to generate a new dalvik cache after upgrade, wiping it to try again won’t change the outcome. The updater needs to better account for the cache requirement before going into the ota unpack/apply procedure and refuse if conditions aren’t met beforehand.

@Ecowano - within twrp - if you customize the mount command without relying on the fstab entry, does it say Invalid argument too?

mkdir the mointpoint separately, then instead of mount /data you issue

mkdir -p /mnt/userdata
mount -t f2fs /dev/block/bootdevice/by-name/userdata /mnt/userdata

The FP4 twrp can’t decrypt the userdata yet (though z3ntu worked on applying the FP5 approach), but as other example in the thread show - you can get by seeing just the file group to delete some big media file and get enough disk headroom again.

1 Like

Yep.

 mkdir -p /mnt/userdata
 mount -t f2fs /dev/block/bootdevice/by-name/userdata /mnt/userdata
mount: '/dev/block/bootdevice/by-name/userdata'->'/mnt/userdata': Invalid argument

Weird thing :

ls -l /mnt/system
total 0

when 3 days ago I had :

 find . -type f -size +10M
[...]
find: ./proc/605/exe: No such file or directory
./mnt/system/system/apex/com.android.permission.capex
./mnt/system/system/apex/com.android.art.capex
./mnt/system/system/apex/com.android.vndk.current.apex
./mnt/system/system/apex/com.android.i18n.apex
./mnt/system/system/app/MagicEarth/oat/arm64/MagicEarth.vdex
./mnt/system/system/app/MagicEarth/MagicEarth.apk
[... a lot of files]

does moving can be done in the first instance ?

i think this can be deleted, because easily replaceable, but maybe not so big…to make the device bootable…