Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2043299

Summary: [4.9] Ignition fails when reusing existing statically-keyed LUKS volume
Product: OpenShift Container Platform Reporter: RHCOS Bug Bot <rhcos-bot>
Component: RHCOSAssignee: Benjamin Gilbert <bgilbert>
Status: CLOSED ERRATA QA Contact: HuijingHei <hhei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.9CC: dornelas, hhei, jligon, mrussell, nstielau
Target Milestone: ---Keywords: Regression
Target Release: 4.9.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2043296 Environment:
Last Closed: 2022-06-30 05:31:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2043296, 2043298    
Bug Blocks:    

Description RHCOS Bug Bot 2022-01-21 00:29:33 UTC
Backport the fix for bug 2043296 to 4.9.

Comment 1 RHCOS Bug Bot 2022-01-25 04:34:03 UTC
This bug has been reported fixed in a new RHCOS build and is ready for QE verification.  To mark the bug verified, set the Verified field to Tested.  This bug will automatically move to MODIFIED once the fix has landed in a new bootimage.

Comment 2 HuijingHei 2022-01-29 07:58:57 UTC
Preverify passed with RHCOS 49.84.202201262103-0 according to steps in https://bugzilla.redhat.com/show_bug.cgi?id=2043296#c2, can get failure message on the console when using rhcos-49.84.202201212103-0-qemu.x86_64.qcow2

Comment 3 RHCOS Bug Bot 2022-06-09 16:49:57 UTC
The fix for this bug has landed in a bootimage bump, as tracked in bug 2043298 (now in status MODIFIED).  Moving this bug to MODIFIED.

Comment 6 HuijingHei 2022-06-16 03:36:51 UTC
Verify passed using rhcos-49.84.202206151501-0-qemu.x86_64.qcow2

Steps to verify:

Prepare ignition config using command:
$ butane -o 2043299.ign -r -p -s 2043299.bu

$ cat 2043299.bu
variant: fcos
version: 1.4.0
storage:
  disks:
  - device: /dev/vdb
    wipe_table: true
    partitions:
    - number: 1
  luks:
  - name: disk1
    device: /dev/vdb1
    key_file:
      inline: mykey
  filesystems:
  - device: /dev/disk/by-id/dm-name-disk1
    format: xfs
    path: /var/mnt/encrypted_test
    with_mount_unit: true
systemd:
  units:
    - name: serial-getty
      dropins:
      - name: autologin-core.conf
        contents: |
          [Service]
          # Override Execstart in main unit
          ExecStart=
          # Add new Execstart with `-` prefix to ignore failure`
          ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM

============================================
1. Create snapshot of a RHCOS 4.9 image
qemu-img create -f qcow2 -F qcow2 -o backing_file=rhcos-49.84.202206151501-0-qemu.x86_64.qcow2 rhcos-49.84.202206151501-0-qemu.x86_64.hhei.qcow2 16G

2. Create an empty qcow2 disk to use as a secondary disk
qemu-img create -f qcow2 2043299.qcow2 5G

3. Set variables
VM_NAME=rhcos49
VCPUS=2
RAM_MB=4096
IMAGE=/home/fedora/data/rhcos-49.84.202206151501-0-qemu.x86_64.hhei.qcow2
LUKS_DISK=/home/fedora/data/2043299.qcow2
IGNITION_CONFIG=/home/fedora/data/ign/2043299.ign

4. Run the virt-install command
virt-install --connect="qemu:///system" --name="${VM_NAME}" --vcpus="${VCPUS}" --memory="${RAM_MB}" --import --disk path="${IMAGE}",format=qcow2,bus=virtio --disk path="${LUKS_DISK}",format=qcow2,bus=virtio --qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGNITION_CONFIG}" --os-variant rhel8.4 --graphics=none

5. Confirm initial install was successful
6. Destroy/undefine the VM
virsh destroy "${VM_NAME}" && virsh undefine "${VM_NAME}"

7. Delete + recreate the root disk

rm "${IMAGE}"

qemu-img create -f qcow2 -F qcow2 -o backing_file=rhcos-49.84.202206151501-0-qemu.x86_64.qcow2 ${IMAGE} 16G

8. Re-run virt-install
virt-install --connect="qemu:///system" --name="${VM_NAME}" --vcpus="${VCPUS}" --memory="${RAM_MB}" --import --disk path="${IMAGE}",format=qcow2,bus=virtio --disk path="${LUKS_DISK}",format=qcow2,bus=virtio --qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGNITION_CONFIG}" --os-variant rhel8.4 --graphics=none

9. Observe a succesfull install + reuse of the secondary disk
[core@localhost ~]$ df -Th | grep mnt
/dev/mapper/disk1 xfs       5.0G   68M  5.0G   2% /var/mnt/encrypted_test

Comment 10 errata-xmlrpc 2022-06-30 05:31:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.9.40 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:5180