Quantcast
Channel: Active questions tagged adb - Android Enthusiasts Stack Exchange
Viewing all articles
Browse latest Browse all 356

Access encrypted /data Partition over ADB and recovery (TWRP, LineageOS 16, Redmi Note 4)

$
0
0

I have a Redmi Note 4 (mido) Android phone with a broken screen: the screen lights up, but otherwise it stays entirely "black". I already replaced the screen, but with no luck - the cause of the error must be somewhere else. The phone has data-encryption enabled with an unlock-pattern. Now I'm trying to access the data on the phone, but did not succeed so far. Here is what I've done so far:

  • Connected the phone to a PC over USB.
  • Started the phone in fastboot-mode by pressing and holding the buttons vol-down and power simultaneously.
  • Booted the latest version of TWRP for mido: fastboot boot twrp-3.3.1-0-mido.img.
  • Opened adb shell and presumably managed to decrypt the data (found instructions in the TWRP Commandline Guide):

TWRP decrypt:

~ # twrp decrypt 41236Attempting to decrypt data partition via command line.Data successfully decrypted, new block device: '/dev/block/dm-0'Updating partition details......doneUnable to mount storage~ #

Unfortunately, the block device /dev/block/dm-0 cannot be mounted.

This is the result of fdisk:

~ # fdisk -l /dev/block/dm-0Disk /dev/block/dm-0: 57.0 GB, 57033580032 bytes255 heads, 63 sectors/track, 6933 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/block/dm-0 doesn't contain a valid partition table

So I pulled an Image of the block device with adb pull /dev/block/dm-0. This image has a size of 57,033,580,032 bytes.

I tried to mount this image in Ubuntu 20.04, but did not succeed:

# file /media/sf_U_DRIVE/Note4Data/dm-0.img/media/sf_U_DRIVE/Note4Data/dm-0.img: data# fdisk -l /media/sf_U_DRIVE/Note4Data/dm-0.imgDisk /media/sf_U_DRIVE/Note4Data/dm-0.img: 53,12 GiB, 57033580032 bytes, 111393711 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes# mount -o loop /media/sf_U_DRIVE/Note4Data/dm-0.img /mnt/Note4Datamount: /mnt/Note4Data: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.# mount -t ext4 -o loop /media/sf_U_DRIVE/Note4Data/dm-0.img /mnt/Note4Data[ 6986.649794] EXT4-fs (loop3): VFS: Can't find ext4 filesystemmount: /mnt/Note4Data: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.# mount -t f2fs -o loop /media/sf_U_DRIVE/Note4Data/dm-0.img /mnt/Note4Data[ 7004.610412] F2FS-fs (loop3): Can't find valid F2FS filesystem in 1th superblock[ 7004.615289] F2FS-fs (loop3): Can't find valid F2FS filesystem in 2th superblockmount: /mnt/Note4Data: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.

I wonder if I need to mount the image in another way (with offsets? with LVM?) or if the decryption did not work. TWRP creates a log file in /tmp/recovery.log. After running the twrp decrypt command, the following lines are added:

I:Command 'decrypt 41236' receivedI:Set page: 'singleaction_page'I:operation_start: 'TWRP CLI Command'Attempting to decrypt data partition via command line.D:crypt_ftr->fs_size = 111393711I:starting verify_hw_fde_passwdI:Using scrypt with keymaster for cryptfs KDFI:TWRP keymaster max API: 3I:Signing safely-padded objectkeymaster module name is Keymaster QTI HALkeymaster version is 256Found keymaster1 module, using keymaster1 API.I:Extra parameters for dm_crypt: fde_enabled iceI:target_type = req-cryptI:real_blk_name = /dev/block/mmcblk0p49, extra_params = fde_enabled iceE:test mount returned 0I:Found no matching fstab entry for uevent device '/devices/virtual/block/dm-0' - addI:Found no matching fstab entry for uevent device '/devices/virtual/block/dm-0' - changeData successfully decrypted, new block device: '/dev/block/dm-0'I:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'Updating partition details...I:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'I:Unable to mount '/sdcard1'I:Actual block device: '', current file system: 'auto'I:Unable to mount '/usb-otg'I:Actual block device: '', current file system: 'auto'...doneI:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'Unable to mount storage/data | /dev/block/dm-0 | Size: 0MB Used: 0MB Free: 0MB Backup Size: 0MBFlags: Can_Be_Mounted Can_Be_Wiped Can_Be_Backed_Up Wipe_During_Factory_Reset Wipe_Available_in_GUI IsPresent Can_Be_Encrypted Is_Encrypted Is_Decrypted Has_Data_Media Can_Encrypt_Backup Use_Userdata_EncrSymlink_Path: /data/mediaSymlink_Mount_Point: /sdcardPrimary_Block_Device: /dev/block/mmcblk0p49Decrypted_Block_Device: /dev/block/dm-0Crypto_Key_Location: footerLength: -16384Display_Name: dataStorage_Name: Internal StorageBackup_Path: /dataBackup_Name: dataBackup_Display_Name: DataStorage_Path: /data/mediaCurrent_File_System: ext4Fstab_File_System: ext4Backup_Method: filesMTP_Storage_ID: 65539I:Unmounting main partitions...I:Done reading ORS command from command lineI:operation_end - status=0I:Set page: 'decrypt_pattern'I:Set page: 'main'I:Set page: 'clear_vars'I:Set page: 'main2'SELinux contexts loaded from /file_contextsFull SELinux support is present.I:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'I:Unable to mount settings storage during GUI startup.I:Copying file /cache/recovery/log to /cache/recovery/last_logI:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'I:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'Unable to mount /data/media/TWRP/.twrpsI:Attempt to load settings from settings file...I:InfoManager file '/data/media/TWRP/.twrps' not found.I:Backup folder set to '/data/media/TWRP/BACKUPS/f707e0500604'I:Copying file /etc/recovery.fstab to /cache/recovery/recovery.fstabI:Version number saved to '/cache/recovery/.version'I:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'I:Unable to mount '/sdcard1'I:Actual block device: '', current file system: 'auto'I:Unable to mount '/usb-otg'I:Actual block device: '', current file system: 'auto'I:TWFunc::Set_Brightness: Setting brightness control to 255I:PageManager::LoadFileToBuffer loading filename: '/twres/languages/en.xml' directlyparsing languageFileparsing languageFile doneI:Translating partition display namesI:Backup folder set to '/data/media/TWRP/BACKUPS/f707e0500604'I:Starting MTPI:[MTP] Starting MTPI:Can't probe device /dev/block/dm-0I:Unable to mount '/data'I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'MTP EnabledI:Check_Lifetime_Writes result: '648837'I:Switching packages (TWRP)I:Starting Adb Backup FIFOI:Set page: 'main'I:Set page: 'clear_vars'I:Set page: 'main2'I:[MTP] created new mtpserver objectI:[MTP] MtpServer::run fd: 18I:TWFunc::Set_Brightness: Setting brightness control to 5I:TWFunc::Set_Brightness: Setting brightness control to 0

Any ideas what I should try next or where I could find helpful information?


Viewing all articles
Browse latest Browse all 356

Trending Articles