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 2165691 - should the LV be extended when --fs resize is used and an inactive LUKS device exists on top, causing the fs check to fail?
Summary: should the LV be extended when --fs resize is used and an inactive LUKS devic...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: lvm2
Version: 9.2
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: David Teigland
QA Contact: cluster-qe
URL:
Whiteboard:
: 2165771 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-30 19:14 UTC by Corey Marthaler
Modified: 2023-11-07 11:28 UTC (History)
8 users (show)

Fixed In Version: lvm2-2.03.21-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:53:27 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-6632 0 None None None 2023-04-19 22:23:07 UTC
Red Hat Issue Tracker RHELPLAN-146930 0 None None None 2023-01-30 19:17:01 UTC
Red Hat Product Errata RHBA-2023:6633 0 None None None 2023-11-07 08:53:53 UTC

Description Corey Marthaler 2023-01-30 19:14:13 UTC
Description of problem:
LV + LUKs, where the LV is active, but the LUKS is not. Using --fs resize will cause lvextend's fs check to fail and the error code will be non zero, however, the resize of the volume will still happen.


SCENARIO - luks_no_fs_inactive_resizefs_extend:  Create a variety of Encrypted LUKS LV types and attempt to extend the size while INACTIVE and w/o a filesystem, but with the use of --fs resize
adding entry to the devices file for /dev/sda
creating PV on virt-557.cluster-qe.lab.eng.brq.redhat.com using device /dev/sda
creating VG on virt-557.cluster-qe.lab.eng.brq.redhat.com using PV(s) /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde
vgcreate    resize_matrix /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde
  Volume group "resize_matrix" successfully created
 
lvcreate --yes --type linear -n resize_lv  -L 30G resize_matrix  
Wiping crypto_LUKS signature on /dev/resize_matrix/resize_lv.
  Wiping crypto_LUKS signature on /dev/resize_matrix/resize_lv.
  Logical volume "resize_lv" created.
 
'echo "Str0ngP455w0rd###" | cryptsetup luksFormat /dev/resize_matrix/resize_lv'
'echo "Str0ngP455w0rd###" | cryptsetup luksOpen /dev/resize_matrix/resize_lv resize_luks'
'echo "Str0ngP455w0rd###" | cryptsetup luksClose resize_luks'
deactivating LV resize_lv on virt-557.cluster-qe.lab.eng.brq.redhat.com
lvchange --yes -an  resize_matrix/resize_lv
Adding additional space to resize_matrix/resize_lv on virt-557.cluster-qe.lab.eng.brq.redhat.com
lvextend --yes --fs resize -L +446M resize_matrix/resize_lv
 
 
[root@virt-557 ~]# lvs -a -o +devices
  LV        VG            Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices    
  resize_lv resize_matrix -wi------- 30.00g                                                     /dev/sda(0)
 
[root@virt-557 ~]# lvextend --yes --fs resize -L +446M resize_matrix/resize_lv
  Rounding size to boundary between physical extents: 448.00 MiB.
  Logical volume resize_matrix/resize_lv must be active for file system resize.
 
[root@virt-557 ~]# lvchange -ay resize_matrix
 
[root@virt-557 ~]# lvextend --yes --fs resize -L +446M resize_matrix/resize_lv
  Rounding size to boundary between physical extents: 448.00 MiB.
  Size of logical volume resize_matrix/resize_lv changed from 30.00 GiB (7680 extents) to <30.44 GiB (7792 extents).
  Cannot find active LUKS dm-crypt device using resize_matrix/resize_lv.
  File system extend error.
  Logical volume resize_matrix/resize_lv successfully resized.
[root@virt-557 ~]# echo $?
5
 
[root@virt-557 ~]# echo "Str0ngP455w0rd###" | cryptsetup luksOpen /dev/resize_matrix/resize_lv resize_luks
[root@virt-557 ~]# lvextend --yes --fs resize -L +446M resize_matrix/resize_lv
  Rounding size to boundary between physical extents: 448.00 MiB.
  Size of logical volume resize_matrix/resize_lv changed from <30.44 GiB (7792 extents) to <30.88 GiB (7904 extents).
  File system found on crypt device /dev/dm-3 on LV resize_matrix/resize_lv.
  No file system found on /dev/dm-3.
  Logical volume resize_matrix/resize_lv successfully resized.
[root@virt-557 ~]# echo $?
0


Version-Release number of selected component (if applicable):
kernel-5.14.0-239.el9    BUILT: Thu Jan 19 04:29:56 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

Comment 1 David Teigland 2023-01-30 23:09:12 UTC
> # lvextend --yes --fs resize -L +446M resize_matrix/resize_lv
>  Rounding size to boundary between physical extents: 448.00 MiB.
>  Size of logical volume resize_matrix/resize_lv changed from 30.00 GiB (7680 extents) to <30.44 GiB (7792 extents).
>  Cannot find active LUKS dm-crypt device using resize_matrix/resize_lv.
>  File system extend error.
>  Logical volume resize_matrix/resize_lv successfully resized.
> # echo $?
> 5

This is not ideal and can be improved.

lvextend --resizefs should fail in the case where crypto_LUKS is seen on the LV, but the crypt device is missing.

Failing is correct because the user requested resizefs, but lvextend is unable to do it. (It's unable to even look for a fs when the crypt device is missing, but we assume there would be a fs there since the user has requested resizing it.)

In the example above, lvextend would ideally fail before extending the LV.  That's not always possible for resizefs, but when it is possible it's the preferred behavior.  In this case we can easily do that, and with that fixed, the example looks like this:

$ echo "Str0ngP455w0rd###" | cryptsetup luksFormat /dev/test/foo
$ echo "Str0ngP455w0rd###" | cryptsetup luksOpen /dev/test/foo foocr
$ cryptsetup luksClose foocr
$ lvextend -L+32M --resizefs test/foo
  LUKS dm-crypt device must be active for fs resize.
$ echo $?
5

Comment 3 David Teigland 2023-01-31 21:33:54 UTC
*** Bug 2165771 has been marked as a duplicate of this bug. ***

Comment 6 Corey Marthaler 2023-05-16 19:27:57 UTC
Marking Verified:Tested in the latest rpms.

kernel-5.14.0-306.el9    BUILT: Sat Apr 29 05:45:15 PM CEST 2023
lvm2-2.03.21-1.el9    BUILT: Fri Apr 21 02:33:33 PM CEST 2023
lvm2-libs-2.03.21-1.el9    BUILT: Fri Apr 21 02:33:33 PM CEST 2023



lvcreate --yes --type striped -n resize_lv  -L 30G -i 2 resize_matrix  
Using default stripesize 64.00 KiB.
  Wiping crypto_LUKS signature on /dev/resize_matrix/resize_lv.
  Wiping crypto_LUKS signature on /dev/resize_matrix/resize_lv.
  Logical volume "resize_lv" created.

'echo "Str0ngP455w0rd###" | cryptsetup luksFormat /dev/resize_matrix/resize_lv'
'echo "Str0ngP455w0rd###" | cryptsetup luksOpen /dev/resize_matrix/resize_lv resize_luks'
'echo "Str0ngP455w0rd###" | cryptsetup luksClose resize_luks'
deactivating LV resize_lv on grant-01.6a2m.lab.eng.bos.redhat.com
lvchange --yes -an  resize_matrix/resize_lv

Adding additional space to resize_matrix/resize_lv on grant-01.6a2m.lab.eng.bos.redhat.com
lvextend --yes --fs resize -L +420M resize_matrix/resize_lv 
Logical volume resize_matrix/resize_lv must be active for file system resize.

activating LV resize_lv -ay on grant-01.6a2m.lab.eng.bos.redhat.com
lvchange --yes -ay  resize_matrix/resize_lv

Adding additional space to resize_matrix/resize_lv on grant-01.6a2m.lab.eng.bos.redhat.com
lvextend --yes --fs resize -L +519M resize_matrix/resize_lv 
LUKS dm-crypt device must be active for fs resize.

PRE:31457280.0 POST:31457280.0
lvremove  -f resize_matrix/resize_lv
Logical volume "resize_lv" successfully removed.

Comment 9 Corey Marthaler 2023-05-26 14:48:18 UTC
Works in the latest build as well. Marking VERIFIED.

kernel-5.14.0-306.el9    BUILT: Sat Apr 29 05:45:15 PM CEST 2023
lvm2-2.03.21-2.el9    BUILT: Thu May 25 12:03:04 AM CEST 2023
lvm2-libs-2.03.21-2.el9    BUILT: Thu May 25 12:03:04 AM CEST 2023



------------------------------------------------------------
lvcreate --yes --type raid1 -n resize_lv  -L 30G -m 2 resize_matrix  
Wiping crypto_LUKS signature on /dev/resize_matrix/resize_lv.
  Wiping crypto_LUKS signature on /dev/resize_matrix/resize_lv.
  Logical volume "resize_lv" created.

lvconvert --yes  --raidintegrity y resize_matrix/resize_lv
  Using integrity block size 512 for unknown file system block size, logical block size 512, physical block size 4096.
  Logical volume resize_matrix/resize_lv has added integrity.
'echo "Str0ngP455w0rd###" | cryptsetup luksFormat /dev/resize_matrix/resize_lv'
'echo "Str0ngP455w0rd###" | cryptsetup luksOpen /dev/resize_matrix/resize_lv resize_luks'
'echo "Str0ngP455w0rd###" | cryptsetup luksClose resize_luks'
deactivating LV resize_lv on grant-01.6a2m.lab.eng.bos.redhat.com
lvchange --yes -an  resize_matrix/resize_lv
Adding additional space to resize_matrix/resize_lv on grant-01.6a2m.lab.eng.bos.redhat.com
lvextend --yes --fs resize -L +602M resize_matrix/resize_lv 
Logical volume resize_matrix/resize_lv must be active for file system resize.
activating LV resize_lv -ay on grant-01.6a2m.lab.eng.bos.redhat.com
lvchange --yes -ay  resize_matrix/resize_lv
Adding additional space to resize_matrix/resize_lv on grant-01.6a2m.lab.eng.bos.redhat.com
lvextend --yes --fs resize -L +557M resize_matrix/resize_lv 
LUKS dm-crypt device must be active for fs resize.
PRE:31457280.0 POST:31457280.0
lvremove  -f resize_matrix/resize_lv
Logical volume "resize_lv" successfully removed.

Comment 12 errata-xmlrpc 2023-11-07 08:53:27 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:6633


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