USB drive with lvm on an encrypted partition does not unmount cleanly when removed, making it impossible to use again without a reboot or use of command line tools

Bug #1654113 reported by Ben Blout on 2017-01-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
Undecided
Unassigned

Bug Description

I have a USB drive with two partitions, one unencrypted and one encrypted. The encrypted partition serves as the physical volume for a LVM volume group.

cfdisk shows me:
                                Disk: /dev/sdb
              Size: 74.5 GiB, 80026361856 bytes, 156301488 sectors
                       Label: dos, identifier: 0x0006866a

    Device Boot Start End Sectors Size Id Type
>> /dev/sdb1 * 2048 500094 498047 243.2M 83 Linux
    /dev/sdb2 501758 156301311 155799554 74.3G 5 Extended
    └─/dev/sdb5 501760 156301311 155799552 74.3G 83 Linux

When I plug in the drive, one partition is mounted automatically. A popup window also appears, prompting for a password to unlock the volume. After I enter the password, four more volumes appear on my Desktop, and in /media/username:

$ ls -l /media/username
total 25
drwxr-xr-x 22 root root 4096 Jan 6 2014 0c321a15-e3b4-47b5-a173-05adfb5ea40c
drwxrwxrwt 9 root root 12288 Dec 21 00:26 14ea30b5-5ace-4bc7-a483-7d800ee77579
drwxr-xr-x 15 root root 4096 Dec 21 00:27 41f9c7bb-62e5-4afd-b4c1-efdecfd70083
drwxr-xr-x 7 root root 4096 Nov 12 2013 42d838d8-b797-4782-8473-5d42a29667c1
drwxr-xr-x 4 root root 1024 Mar 18 2014 ba0575b2-f570-4e40-b374-f1d3dc0ca48b

The output of findmnt is as follows, with my username again replaced with 'username':

TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/burrow-root
│ ext4 rw,relatime,errors=remo
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,
[snip]
├─/boot /dev/sda1 ext2 rw,relatime,block_valid
├─/home /dev/mapper/burrow-home
│ ext4 rw,relatime,data=ordere
├─/media/username/ba0575b2-f570-4e40-b374-f1d3dc0ca48b
│ /dev/sdc1 ext2 rw,nosuid,nodev,relatim
├─/media/username/14ea30b5-5ace-4bc7-a483-7d800ee77579
│ /dev/mapper/antler-temp
│ ext4 rw,nosuid,nodev,relatim
├─/media/username/42d838d8-b797-4782-8473-5d42a29667c1
│ /dev/mapper/antler-home
│ ext4 rw,nosuid,nodev,relatim
├─/media/username/41f9c7bb-62e5-4afd-b4c1-efdecfd70083
│ /dev/mapper/antler-var
│ ext4 rw,nosuid,nodev,relatim
└─/media/username/0c321a15-e3b4-47b5-a173-05adfb5ea40c
                                      /dev/mapper/antler-root
                                                 ext4 rw,nosuid,nodev,relatim

To unmount the drive, I can right click on each volume on the desktop, choose unmount, and I receive a pop up notification that the drive has been safely removed.

After unplugging the USB drive, the icon for the unencrypted volume disappears from the desktop, but the icons for the lvm volumes remain. I have attached the long errors that appear in the syslog.

When plugging the drive back in, the unencrypted partition is again mounted, and I am prompted for a password. Nothing further happens. If I double click on the encryted drive icon on the desktop, I am again prompted for a password, and then receive this error:

Failed to mount "80 GB Encrypted"
Error unclocking /dev/sdb5: Command-line `cryptsetup luksOpen "/dev/sdb5" "luks-1d2a9dd8-91a4-4e34-9531-b0cde53579c0" ' exited with non-zero exit status 5: Device luks-1d2a9dd8-91a4-4e34-9531-b0cde53579c0 already exists.

The usb drive is unusable without a reboot, or issuing this command, antler is the volume group name:
$ sudo vgchange -a n antler
  0 logical volume(s) in volume group "antler" now active

Upon issuing this command, the icons for the four lvm volumes disappears from my desktop. If I now plug in the drive, it acts normally.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: lvm2 2.02.133-1ubuntu10
ProcVersionSignature: Ubuntu 4.4.0-57.78-generic 4.4.35
Uname: Linux 4.4.0-57-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.4
Architecture: amd64
CurrentDesktop: XFCE
Date: Wed Jan 4 19:40:18 2017
InstallationDate: Installed on 2016-11-28 (37 days ago)
InstallationMedia: Xubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
SourcePackage: lvm2
UpgradeStatus: No upgrade log present (probably fresh install)

Ben Blout (bdb-new) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers