Bug 1977228

Summary: Failed to open LUKS encrypted disk on rhel9
Product: Red Hat Enterprise Linux 9 Reporter: Xiaodai Wang <xiaodwan>
Component: libguestfsAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: chhu, juzhou, mxie, rjones, tyan, tzheng, virt-maint, vwu, xinyli
Target Milestone: betaKeywords: Automation, Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-30 02:28:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xiaodai Wang 2021-06-29 09:06:20 UTC
Description of problem:
Failed to open LUKS encrypted disk on rhel9

Version-Release number of selected component (if applicable):
virt-v2v-1.45.1-1.el9.1.x86_64
libguestfs-1.45.6-7.el9.x86_64
qemu-kvm-6.0.0-6.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Convert a guest which has luks encryption disks.
# virt-v2v -i libvirt -ic vpx://root.x.x/data/x.x.x.x/?no_verify=1 -o null esx6.7-rhel7.8-swap_luks-non_os_3luks-xxx -it vddk -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=xxx  -ip /root/v2v_vpx_passwd
2. Type correct password.


Actual results:
libguestfs: trace: v2v: luks_uuid "/dev/sda3"
command: blkid returned 0^M
command: blkid: stdout:^M
crypto_LUKS^M
guestfsd: => vfs_type (0xc6) took 0.01 secs^M
guestfsd: <= luks_uuid (0x1fb) request length 56 bytes^M
commandrvf: stdout=n stderr=y flags=0x0^M
commandrvf: udevadm --debug settle -E /dev/sda3^M
SELinux enabled state cached to: disabled^M
No filesystem is currently mounted on /sys/fs/cgroup.^M
Failed to determine unit we run in, ignoring: No data available^M
commandrvf: stdout=y stderr=y flags=0x0^M
commandrvf: cryptsetup luksUUID /dev/sda3^M
libguestfs: trace: v2v: luks_uuid = "37990053-c744-4f9e-ba7b-1944d18ac3db"
libguestfs: trace: v2v: cryptsetup_open "/dev/sda3" "***" "cryptsda3"
guestfsd: => luks_uuid (0x1fb) took 0.01 secs^M
guestfsd: <= cryptsetup_open (0x1fc) request length 96 bytes^M
commandrvf: stdout=n stderr=y flags=0x0^M
commandrvf: udevadm --debug settle -E /dev/sda3^M
SELinux enabled state cached to: disabled^M
No filesystem is currently mounted on /sys/fs/cgroup.^M
Failed to determine unit we run in, ignoring: No data available^M
command: blkid '-c' '/dev/null' '-o' 'value' '-s' 'TYPE' '/dev/sda3'^M
command: blkid returned 0^M
command: blkid: stdout:^M
crypto_LUKS^M
command: cryptsetup '-d' '/tmp/crypt9878fa.key' 'open' '/dev/sda3' 'cryptsda3' '--type' 'luks'^M
command: cryptsetup returned 1^M
command: cryptsetup: stderr:^M
Cannot open keyslot (using hash sha256).^M
ocaml_exn: 'cryptsetup_open' raised 'Failure' exception^M
guestfsd: error: cryptsetup exited with status 1: Cannot open keyslot (using hash sha256).^M
guestfsd: => cryptsetup_open (0x1fc) took 0.02 secs^M
libguestfs: trace: v2v: cryptsetup_open = -1 (error)
/usr/bin/virt-v2v: could not find key to open LUKS encrypted /dev/sda3.

Try using --key on the command line.

Original error: cryptsetup_open: cryptsetup exited with status 1: Cannot open keyslot (using hash sha256). (0)

Expected results:
v2v should run success.

Additional info:
The issue cannot be reproduced by libguestfs-1.45.6-6.el9.x86_64

Comment 1 Richard W.M. Jones 2021-06-29 14:44:36 UTC
This is likely to be a duplicate of:
https://bugzilla.redhat.com/show_bug.cgi?id=1977214

Comment 2 Xiaodai Wang 2021-06-30 02:27:58 UTC
Yes, I verified it with libguestfs-1.45.6-9.el9.x86_64 and it works well.

Comment 3 Xiaodai Wang 2021-06-30 02:28:31 UTC

*** This bug has been marked as a duplicate of bug 1977214 ***