11

I'm on a Ubuntu 16.04 computer with a LUKS encrypted drive trying to mount an old Ubuntu 16.04 LUKS encrypted drive. When I open the drive in Nautilus, after entering the correct password I get the following pop-up error

Unable to access “127 GB Encrypted” Operation cancelled

Relevant? output of sudo fdisk -l after doing sudo cryptsetup luksOpen /dev/sdb3 my_encrypted_volume:

Disk /dev/sdb: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 1D78C9DC-B51C-4729-8D7D-BB2B7C207511

Device       Start       End   Sectors   Size Type
/dev/sdb1     2048   1050623   1048576   512M EFI System
/dev/sdb2  1050624   1550335    499712   244M Linux filesystem
/dev/sdb3  1550336 250068991 248518656 118.5G Linux filesystem


Disk /dev/mapper/my_encrypted_volume: 118.5 GiB, 127239454720 bytes, 248514560 sectors

I've tried a number of answers from Mount encrypted volumes from command line? without success.

If I do the accepted answer

(this one)

udisksctl unlock -b /dev/sdb5
udisksctl mount -b /dev/mapper/ubuntu-root

I get something like Object /org/freedesktop/UDisks2/block_devices/dm_2d3 is not a mountable filesystem.

If I do the highest voted answer

(this one)

sudo cryptsetup luksOpen /dev/sdb3 my_encrypted_volume
sudo mkdir /media/my_device
sudo mount /dev/mapper/my_encrypted_volume /media/my_device

I get mount: unknown filesystem type 'LVM2_member'

raphael
  • 486
  • 2
  • 5
  • 18

2 Answers2

20

Scrolling through one of the related questions I found an answer that worked.

sudo cryptsetup luksOpen /dev/sdb3 my_encrypted_volume
sudo vgimportclone /dev/mapper/my_encrypted_volume

This latter output a bunch of scary WARNING until

Volume group "ubuntu-vg" successfully renamed to "ubuntu-vg1"
Notifying lvmetad about changes since it was disabled temporarily.
(This resolves any WARNING message about restarting lvmetad that appears above.)
  Reading all physical volumes.  This may take a while...
  Found volume group "ubuntu-vg" using metadata type lvm2
  Found volume group "ubuntu-vg1" using metadata type lvm2

I then ran sudo vgchange -ay (possibly unnecessarily) and then ran

sudo mount /dev/ubuntu-vg1/root /media/my_device/

And voila! The drive appeared in Nautilus

raphael
  • 486
  • 2
  • 5
  • 18
  • 3
    Worked for me. Also, the `vgchange -ay` was necessary. – Gohu May 23 '18 at 13:42
  • Worked for me on Mint 19, but now I'm trying to undo it, so I can remove the drive and insert another. `sudo umount /media/my_device` works, but then `sudo vgchange -a n mint-vg` complains that 'Logical volume mint-vg/root contains a filesystem in use. Can't deactivate volume group "mint-vg" with 2 open logical volume(s)'. So how do I deactivate it? Using `lvchange` somehow, maybe? And then, I assume, it's `sudo vgremove -f /dev/mapper/my_encrypted_volume` and `sudo cryptsetup luksClose my_encrypted_volume`? – Michael Scheper Oct 04 '18 at 09:19
  • 1
    Running this: `sudo vgimportclone /dev/mapper/my_encrypted_volume` Resulted in this: `Device /dev/mapper/my_encrypted_volume has active LVs, deactivate first.` To solve it, I've run `sudo gparted`, right click on the encrypted partition and "Deactivate". Hope it will help somebody in my same situation (I guess there's a command line for it too) – d.lime Jun 27 '19 at 09:41
0

Run the below command since the drive maybe deactivated due to many wrong password attempts or something else.

sudo vgchange -ay

You should get an output similar to below:

root@nc:~# vgchange -ay
  2 logical volume(s) in volume group "pny-vg" now active
  3 logical volume(s) in volume group "nc-vg" now active
David Kariuki
  • 198
  • 1
  • 12