Created attachment 1219251 [details] log.luks Description of problem: RFE: Libguestfs should support LUKS partition in guest image Version-Release number of selected component (if applicable): libguestfs-1.32.7-3.el7.x86_64 How reproducible: 100% Steps: 1. Create 7.2 guest with LUKS encryption. Install a RHEL7.2 guest image (retain some space at the partition step),then boot it and create partition with LUKS: # fdisk /dev/vda --> create a new partition /dev/vda3 for testing # cryptsetup luksFormat /dev/vda3 # cryptsetup luksOpen /dev/vda3 my_test # mkfs.ext4 /dev/mapper/my_test # mkdir /mnt/my_test # mount /dev/mapper/my_test /mnt/my_test Configure this LUKS partition to automatically mounted at boot: # touch /root/.my_test # cryptsetup luksAddKey /dev/vda3 /mnt/.my_test # vim /etc/crypttab my_test /dev/vda3 /root/.my_test # vim /etc/fstab /dev/mapper/my_test /mnt/my_test ext4 defaults 0 0 # init 0 2. # guestfish -a rhel7.2-LUKS.qcow2 -i ------------------------------------------------------------------------------- Enter key or passphrase ("/dev/sda3"): libguestfs: error: vfs_type: vfs_type_stub: /dev/mapper/my_test: No such file or directory libguestfs: error: mount: mount_stub: /dev/mapper/my_test: No such file or directory guestfish: some filesystems could not be mounted (ignored) Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: Red Hat Enterprise Linux Server 7.2 (Maipo) /dev/rhel/root mounted on / /dev/sda1 mounted on /boot libguestfs: error: lvm_canonical_lv_name: lvm_canonical_lv_name_stub: /dev/mapper/my_test: No such file or directory /dev/mapper/my_test mounted on /mnt/my_test ><fs> ls /etc/mapper/my_test libguestfs: error: ls0: opendir: /etc/mapper/my_test: No such file or directory -------------------------------------------------------------------------------- Please refer to attachment for detailed log of: # guestfish -a rhel7.2-LUKS.qcow2 -i -v -x exit Actual results: Can't mount the LUKS partition. Expected results: Should mount the LUKS partition successfully. Additional info:
When it asked for the passphrase: > Enter key or passphrase ("/dev/sda3"): did you enter the right passphrase there?
The problem is that, when opening the LUKS partition, a "random" mapname is generated for them, so later then when trying to resolve the mount points in fstab the mapping specified is not found (and thus the errors about /dev/mapper/my_test above, for example). Ideally, we need to parse crypttab to get the proper mapname -- luckly augeas seems to support it already.
(In reply to Richard W.M. Jones from comment #1) > When it asked for the passphrase: > > > Enter key or passphrase ("/dev/sda3"): > > did you enter the right passphrase there? Yes,the passwd is right. And thanks for Pino's explanation.
I wonder if we still need this bug. Virt-v2v has supported LUKS for a while. We also have: https://bugzilla.redhat.com/show_bug.cgi?id=1809453 "[RFE] Add support for LUKS encrypted disks with Clevis & Tang"
(In reply to Richard W.M. Jones from comment #4) > I wonder if we still need this bug. Virt-v2v has supported LUKS for > a while. Yes, we do need this bug, as the situation described in the bug (LUKS partitions with mapping described in /etc/crypttab) is not supported by libguestfs yet. > We also have: > https://bugzilla.redhat.com/show_bug.cgi?id=1809453 > "[RFE] Add support for LUKS encrypted disks with Clevis & Tang" This is something completely different, and unrelated, from this bug.