Rescue LUKS encrypted partition: Error unlocking device
Posted: Sun Mar 23, 2014 3:18 am
[PROBLEM]
Playing around with encrypted USB sticks, I just ran into a problem with a stick that was previously reported to have "unrecovered read error":
[SOLUTION]
1) Draw a "dd" image:
Thanks to the article "Backup And Restore Files To/From A LUKS Encrypted Partition Image File", I also figured out how to access and mount this image file instead of the usb-stick device:
2) Create a loopback device:
3) Mount the luks_image file:
Actually, the encrypted partition should already show up in your OS' file browser. On XFCE for example, you can mount the luks_image now by opening the encrypted partition in Thunar.
But of course, you can also do it the good old experts' way:
Voila.
Links:
Playing around with encrypted USB sticks, I just ran into a problem with a stick that was previously reported to have "unrecovered read error":
After some unplugging/replugging the stick, it's encrypted partition finally showed up again. Unfortunately, when trying to unlock it, you get the following error:[258363.812786] end_request: critical target error, dev sde, sector 0
[258363.863612] sd 10:0:0:2: [sde] Unhandled sense code
[258363.863617] sd 10:0:0:2: [sde] Result: hostbyte=invalid driverbyte=DRIVER_SENSE
[258363.863621] sd 10:0:0:2: [sde] Sense Key : Medium Error [current]
[258363.863625] sd 10:0:0:2: [sde] Add. Sense: Unrecovered read error
dmesg | tail also has something to say:Error unlocking device: cryptsetup exited with exit code 1: device-mapper: reload ioctl failed: Invalid argument.
Code: Select all
[260836.603738] device-mapper: table: 252:0: crypt: Device lookup failed
[260836.603743] device-mapper: ioctl: error adding target to table
[SOLUTION]
1) Draw a "dd" image:
Code: Select all
$ sudo dd if=/dev/sdg1 of=luks_image.bin bs=1024k conv=noerror,sync
2) Create a loopback device:
Code: Select all
$ sudo losetup /dev/loop1 luks_image.bin
Actually, the encrypted partition should already show up in your OS' file browser. On XFCE for example, you can mount the luks_image now by opening the encrypted partition in Thunar.
But of course, you can also do it the good old experts' way:
Code: Select all
$ sudo mount /dev/loop1 /mnt/luks_partition
Links: