Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem: Cockpit's tests detected a regression with shrinking a LUKS LV in our RHEL 9.2 image refresh [1].
Version-Release number of selected component (if applicable):
The image build log[2] contains the full list of package differences, the most plausible ones are these:
cryptsetup (2.4.3-5.el9 -> 2.6.0-2.el9)
device-mapper (9:1.02.185-3.el9 -> 9:1.02.187-3.el9)
kernel (5.14.0-205.el9 -> 5.14.0-226.el9)
lvm2 (9:2.03.16-3.el9 -> 9:2.03.17-3.el9)
How reproducible: Always
Steps to Reproduce:
lvcreate TEST -n vol -L 200m
cryptsetup luksFormat /dev/mapper/TEST-vol
cryptsetup luksOpen /dev/mapper/TEST-vol l1
mkfs -t ext4 /dev/mapper/l1
fsadm -y resize /dev/mapper/l1 150M
lvresize TEST/vol -L-30M
Actual results:
cryptsetup resize 319488 sectors /dev/dm-1
[... ⬆ repeats a lot ]
Child 14121 exited abnormally
Failed to resize crypt dev with lvresize_fs_helper.
Expected results: Resize should be successful, like in previous RHEL versions, and all other Linux distros.
Additional info:
[1] https://github.com/cockpit-project/bots/pull/4226
[2] https://cockpit-logs.us-east-1.linodeobjects.com/image-refresh-logs/rhel-9-2-20230102-062525.log
To hit this bug you need to independently resize only the file system (using fsadm or an fs-specific command), and then use lvresize which will resize the crypt device and the LV. lvresize uses the helper only to resize the crypt device:
/usr/libexec/lvresize_fs_helper --cryptresize --cryptpath /dev/dm-3 --newsizebytes 163577856
and the bit of code that only resizes the crypt device contains the typo.
(I don't understand why the shell code loops when the invalid command name is used.)
Marking Verified:Tested in the latest rpms.
kernel-5.14.0-229.el9 BUILT: Thu Jan 5 05:38:37 PM CET 2023
lvm2-2.03.17-4.el9 BUILT: Tue Jan 10 06:40:12 PM CET 2023
lvm2-libs-2.03.17-4.el9 BUILT: Tue Jan 10 06:40:12 PM CET 2023
[root@virt-540 ~]# echo "Str0ngP455w0rd###" | lvreduce --yes --fs resize -L -435M resize_matrix/resize_lv
Rounding size to boundary between physical extents: 432.00 MiB.
File system found on crypt device /dev/dm-3 on LV resize_matrix/resize_lv.
File system size 31289507840b is adjusted for crypt data offset 16777216b.
File system ext4+crypto_LUKS found on resize_matrix/resize_lv.
File system size (29.56 GiB) is larger than the requested size (29.14 GiB).
File system reduce is required using resize2fs.
File system fsck will be run before reduce.
cryptsetup resize is needed for reduce.
Reducing file system ext4 to 29.14 GiB (31289507840 bytes) on /dev/dm-3...
e2fsck /dev/dm-3
/dev/dm-3: 11/1941504 files (0.0% non-contiguous), 165911/7749632 blocks
e2fsck done
resize2fs /dev/dm-3 30556160k
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/dm-3 to 7639040 (4k) blocks.
The filesystem on /dev/dm-3 is now 7639040 (4k) blocks long.
resize2fs done
cryptsetup resize 61112320 sectors /dev/dm-3
cryptsetup done
Reduced file system ext4 on /dev/dm-3.
File system found on crypt device /dev/dm-3 on LV resize_matrix/resize_lv.
Size of logical volume resize_matrix/resize_lv changed from <29.58 GiB (7572 extents) to <29.16 GiB (7464 extents).
Logical volume resize_matrix/resize_lv successfully resized.
[root@virt-540 ~]#
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 (lvm2 bug fix and enhancement 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-2023:2544