LVM-on-LUKS Failed to mount error
I've been encountering an error in both Thunar and Nautilus, on several OSes including a minimal Arch install of Xfce with Thunar and then Nautilus.
The issue appears when decrypting a LVM-on-LUKS encrypted device.
I've managed to reproduce with various setups:
- minimal installs of openSUSE, Arch, slackware
- USB sticks and SSD mounted via USB adapter
- GPT partition table on a
8309 Linux LUKS
partition and MSDOS partition table marked as83 Linux
- LUKS v1 and v2
From what I can tell, gvfs, gio or whatever (libblockdev?) is responsible for this is assuming that LUKS containers always contain a mountable partition, instead of actually verifying the contents. I saw the same error when decrypting/"opening" an empty LUKS container.
In all these cases, both Thunar and Nautilus behave the same: an "Error" dialog with Failed to mount "label".
and Operation was cancelled.
And then life goes on, the LVM partitions appear and can be mounted, for an empty LUKS container, nothing else really happens.
In openSUSE I always see this in the kernel logs and dmesg:
[89758.094447] traps: gvfs-udisks2-vo[1307] general protection fault ip:7f88e781c7ee sp:7ffd9c4d1910 error:0 in libgio-2.0.so.0.7000.5[7f88e7767000+1d6000]
[89850.922378] traps: gvfs-udisks2-vo[3103] general protection fault ip:7f4548a447ee sp:7fff99fa2020 error:0 in libgio-2.0.so.0.7000.5[7f454898f000+1d6000]
But nothing on Arch, and with thunar, there are several warnings for the LVM partitions and always an extra one, which I assume is for the LUKS container:
thunar-volman: Unknown block device type "disk".
The simplest way to reproduce this is to have a single partition that is a luks formatted container:
cryptsetup luksFormat /dev/sdZ1
And then open Thunar and "open" the encrypted device, and you'll see the error appear with an empty container. Alternatively, you can just open the container and create a LVM setup:
cryptset open /dev/sdZ1 ABCD
pvcreate /dev/mapper/ABCD
vgcreate Luks /dev/mapper/ABCD
lvcreate -L 10G -n One Luks
lvcreate -L 10G -n Two Luks
To reset all this and see the error a 2nd time in the file manager, you need to first unmount the partitions, then disable the LVM partitions (logical volumes) and finally close the crypt container:
umount /dev/mapper/Luks-*
vgchange -an Luks
cryptsetup close /dev/mapper/ABCD
These are the versions from my main OS, openSUSE 15.5:
thunar 4.18.7-lp155.194.2
libgio 2.70.5-150400.3.8.1
gvfs 1.48.2-150400.4.6.1
libblockdev 2.26-150400.1.5
And these are the versions from a VirtualBox (not from the OS repo, but downloaded from the official website, with USB pass-through support) install of Arch:
thunar 4.18.7-1
nautilus 44.2.1-1
glib2 2.78.0-2
gvfs 1.52.0-1
libblockdev 3.0.3-4
And I also tested against the latest version of thunar, built from source.
P.S. IIRC, I've been seeing this for a long time, a decade maybe, but I've only now gotten around to report it, so it's probably not a high priority and it's after all just an annoyance, you can close the dialog and continue with what you are doing, but I would like some pointers, maybe I can fix it myself.