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.
Bug 2157591 - Error resizing logical LUKS volume: Process reported exit code 5: Failed to resize crypt dev with lvresize_fs_helper
Summary: Error resizing logical LUKS volume: Process reported exit code 5: Failed to r...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: lvm2
Version: 9.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard: CockpitTest
: 2156389 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-02 08:30 UTC by Martin Pitt
Modified: 2023-05-09 10:37 UTC (History)
10 users (show)

Fixed In Version: lvm2-2.03.17-4.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 08:23:51 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CLUSTERQE-6330 0 None None None 2023-01-04 20:08:47 UTC
Red Hat Issue Tracker RHELPLAN-143418 0 None None None 2023-01-02 08:32:38 UTC
Red Hat Product Errata RHBA-2023:2544 0 None None None 2023-05-09 08:24:05 UTC

Description Martin Pitt 2023-01-02 08:30:15 UTC
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

Comment 1 Martin Pitt 2023-01-02 12:59:39 UTC
*** Bug 2156389 has been marked as a duplicate of this bug. ***

Comment 3 David Teigland 2023-01-03 18:05:07 UTC
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.)

Comment 4 Martin Pitt 2023-01-03 18:10:38 UTC
Haha, isn't it nice when bugs are shallow for a change :-D Thanks David for the quick fix!

Comment 7 Corey Marthaler 2023-01-11 19:44:14 UTC
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 ~]#

Comment 10 Martin Pitt 2023-01-19 10:03:13 UTC
There is still a bug with resizing. But as this bug is so far ahead, and the reproducer is a bit different now, I filed that as bug 2162305.

Comment 12 errata-xmlrpc 2023-05-09 08:23:51 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 (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


Note You need to log in before you can comment on or make changes to this bug.