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.

Bug 1659579

Summary: online fsadm resize of luks volume now requires passphrase
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: cryptsetupAssignee: Ondrej Kozina <okozina>
Status: CLOSED WONTFIX QA Contact: Storage QE <storage-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.0CC: agk, jbrassow, mbroz, okozina, prajnoha
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1750680 (view as bug list) Environment:
Last Closed: 2021-02-01 07:31:13 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 Corey Marthaler 2018-12-14 17:27:24 UTC
Description of problem:

## RHEL7.6

3.10.0-957.el7.x86_64

cryptsetup-2.0.3-3.el7    BUILT: Tue Jul 31 09:34:18 CDT 2018
cryptsetup-libs-2.0.3-3.el7    BUILT: Tue Jul 31 09:34:18 CDT 2018
cryptsetup-reencrypt-2.0.3-3.el7    BUILT: Tue Jul 31 09:34:18 CDT 2018
lvm2-2.02.180-8.el7    BUILT: Mon Sep 10 04:45:22 CDT 2018
lvm2-libs-2.02.180-8.el7    BUILT: Mon Sep 10 04:45:22 CDT 2018
lvm2-cluster-2.02.180-8.el7    BUILT: Mon Sep 10 04:45:22 CDT 2018


[root@harding-03 ~]# dmsetup ls  | grep raid
raid_sanity-open_LUKS_fsadm_resize      (253:31)
raid_sanity-open_LUKS_fsadm_resize_rimage_1     (253:30)
raid_sanity-open_LUKS_fsadm_resize_rimage_0     (253:28)
raid_luksvolume (253:32)
raid_sanity-open_LUKS_fsadm_resize_rmeta_1      (253:29)
raid_sanity-open_LUKS_fsadm_resize_rmeta_0      (253:27)

[root@harding-03 ~]# lvs -a -o +devices
  LV                                VG           Attr       LSize Cpy%Sync Devices
  open_LUKS_fsadm_resize            raid_sanity  Rwi-aor--- 2.00g 100.00   open_LUKS_fsadm_resize_rimage_0(0),open_LUKS_fsadm_resize_rimage_1(0)
  [open_LUKS_fsadm_resize_rimage_0] raid_sanity  iwi-aor--- 2.00g          /dev/mapper/mpatha2(1)
  [open_LUKS_fsadm_resize_rimage_1] raid_sanity  iwi-aor--- 2.00g          /dev/mapper/mpatha1(1)
  [open_LUKS_fsadm_resize_rmeta_0]  raid_sanity  ewi-aor--- 4.00m          /dev/mapper/mpatha2(0)
  [open_LUKS_fsadm_resize_rmeta_1]  raid_sanity  ewi-aor--- 4.00m          /dev/mapper/mpatha1(0)

[root@harding-03 ~]# df -h
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/raid_luksvolume        2.0G  2.0G     0 100% /mnt/open_LUKS_fsadm_resize

[root@harding-03 ~]# lvextend -L +1G -r /dev/raid_sanity/open_LUKS_fsadm_resize
  Extending 2 mirror images.
  Size of logical volume raid_sanity/open_LUKS_fsadm_resize changed from 2.00 GiB (512 extents) to 3.00 GiB (768 extents).
  Logical volume raid_sanity/open_LUKS_fsadm_resize successfully resized.
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mapper/raid_luksvolume is mounted on /mnt/open_LUKS_fsadm_resize; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/raid_luksvolume is now 785408 blocks long.

[root@harding-03 ~]# df -h
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/raid_luksvolume        3.0G  2.0G  865M  70% /mnt/open_LUKS_fsadm_resize





## RHEL8.0

kernel-4.18.0-49.el8    BUILT: Tue Dec  4 06:01:31 CST 2018
cryptsetup-2.0.6-1.el8    BUILT: Mon Dec  3 07:46:20 CST 2018
cryptsetup-libs-2.0.6-1.el8    BUILT: Mon Dec  3 07:46:20 CST 2018
cryptsetup-reencrypt-2.0.6-1.el8    BUILT: Mon Dec  3 07:46:20 CST 2018
lvm2-2.03.01-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
lvm2-libs-2.03.01-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
lvm2-dbusd-2.03.01-1.el8    BUILT: Thu Nov  1 04:31:09 CDT 2018


[root@hayes-01 ~]# dmsetup ls  | grep raid
raid_sanity-open_LUKS_fsadm_resize      (253:4)
raid_sanity-open_LUKS_fsadm_resize_rimage_1     (253:3)
raid_sanity-open_LUKS_fsadm_resize_rimage_0     (253:1)
raid_luksvolume (253:5)
raid_sanity-open_LUKS_fsadm_resize_rmeta_1      (253:2)
raid_sanity-open_LUKS_fsadm_resize_rmeta_0      (253:0)

[root@hayes-01 ~]# lvs -a -o +devices
  LV                                VG          Attr       LSize Cpy%Sync Devices
  open_LUKS_fsadm_resize            raid_sanity Rwi-aor--- 2.00g 100.00   open_LUKS_fsadm_resize_rimage_0(0),open_LUKS_fsadm_resize_rimage_1(0)
  [open_LUKS_fsadm_resize_rimage_0] raid_sanity iwi-aor--- 2.00g          /dev/sdk1(1)
  [open_LUKS_fsadm_resize_rimage_1] raid_sanity iwi-aor--- 2.00g          /dev/sdg1(1)
  [open_LUKS_fsadm_resize_rmeta_0]  raid_sanity ewi-aor--- 4.00m          /dev/sdk1(0)
  [open_LUKS_fsadm_resize_rmeta_1]  raid_sanity ewi-aor--- 4.00m          /dev/sdg1(0)

[root@hayes-01 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/raid_luksvolume  2.0G  2.0G     0 100% /mnt/open_LUKS_fsadm_resize

[root@hayes-01 ~]# lvextend -L +1G -r /dev/raid_sanity/open_LUKS_fsadm_resize
  Extending 2 mirror images.
  Size of logical volume raid_sanity/open_LUKS_fsadm_resize changed from 2.00 GiB (512 extents) to 3.00 GiB (768 extents).
  Logical volume raid_sanity/open_LUKS_fsadm_resize successfully resized.
Enter passphrase for /dev/mapper/raid_sanity-open_LUKS_fsadm_resize: 
No key available with this passphrase.
fsadm: Failed to resize active LUKS device
  /usr/sbin/fsadm failed: 1

## Now you're left w/ the 3G LV, but a 2G luks/fs device

[root@hayes-01 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/raid_luksvolume  2.0G  2.0G     0 100% /mnt/open_LUKS_fsadm_resize

[root@hayes-01 ~]# lvs -a -o +devices
  LV                                VG          Attr       LSize Cpy%Sync Devices
  open_LUKS_fsadm_resize            raid_sanity Rwi-aor--- 3.00g 100.00   open_LUKS_fsadm_resize_rimage_0(0),open_LUKS_fsadm_resize_rimage_1(0)
  [open_LUKS_fsadm_resize_rimage_0] raid_sanity iwi-aor--- 3.00g          /dev/sdk1(1)
  [open_LUKS_fsadm_resize_rimage_1] raid_sanity iwi-aor--- 3.00g          /dev/sdg1(1)
  [open_LUKS_fsadm_resize_rmeta_0]  raid_sanity ewi-aor--- 4.00m          /dev/sdk1(0)
  [open_LUKS_fsadm_resize_rmeta_1]  raid_sanity ewi-aor--- 4.00m          /dev/sdg1(0)


Version-Release number of selected component (if applicable):
cryptsetup-2.0.6-1.el8    BUILT: Mon Dec  3 07:46:20 CST 2018
cryptsetup-libs-2.0.6-1.el8    BUILT: Mon Dec  3 07:46:20 CST 2018
cryptsetup-reencrypt-2.0.6-1.el8    BUILT: Mon Dec  3 07:46:20 CST 2018

kernel-4.18.0-49.el8    BUILT: Tue Dec  4 06:01:31 CST 2018
lvm2-2.03.01-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
lvm2-libs-2.03.01-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
lvm2-dbusd-2.03.01-1.el8    BUILT: Thu Nov  1 04:31:09 CDT 2018
device-mapper-1.02.153-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
device-mapper-libs-1.02.153-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
device-mapper-event-1.02.153-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018
device-mapper-event-libs-1.02.153-1.el8    BUILT: Thu Nov  1 04:29:08 CDT 2018

Comment 1 Ondrej Kozina 2018-12-14 17:46:40 UTC
Yes, this is expected. We switched to LUKS2 by default in RHEL8 and LUKS2 format uploads volume keys in dm-crypt target via kernel keyring. The query for passphrase pops up when cryptsetup detects key in dm-crypt is passed via kernel keyring.

You may workaround it by adding --disable-keyring parameter to "cryptsetup open" command. It won't ask for the passphrase in fsadm resize afterwards.

Comment 2 Corey Marthaler 2019-08-13 18:12:08 UTC
What should be done with this issue, if this new behavior is expected?

1. I verified that "--disable-keyring" at luksOpen time does turn off the passphrase request during the fsadm resize
2. I verified that w/o "--disable-keyring", a proper passwd does properly resize both the underlying lvm device and fs
3. The only remaining issue w/ the new behavior is if a valid paswd isn't given and you end up with a resized LV but not luks/fs device and now need manual intervention.

Comment 3 Corey Marthaler 2019-08-14 18:28:12 UTC
Also "--disable-keyring" *doesn't* help you if you reencrypt either.


[root@hayes-01 ~]# lvcreate  --virtualsize 1G -T snapper_thinp/POOL -n origin                                                                                                                                                                
  Logical volume "origin" created.                                                                                                                                                                                                            
                                                                                                                                                                                                                                                   
[root@hayes-01 ~]# echo Str0ngP455w0rd### | cryptsetup luksFormat /dev/snapper_thinp/origin                                                                                                                                                       
[root@hayes-01 ~]# echo Str0ngP455w0rd### | cryptsetup luksOpen --disable-keyring /dev/snapper_thinp/origin luks_origin                                                                                                                            
                                                                                                                                                                                                                                                      
[root@hayes-01 ~]# mkfs.ext4 /dev/mapper/luks_origin                                                                                                                                                                                                  
mke2fs 1.44.6 (5-Mar-2019)                                                                                                                                                                                                                              
[...]                                                                                                                                                                                                                                                   
Writing superblocks and filesystem accounting information: done                                                                                                                                                                                          
[root@hayes-01 ~]# mount /dev/mapper/luks_origin /mnt/origin

[root@hayes-01 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/luks_origin  977M  2.5M  908M   1% /mnt/origin

[root@hayes-01 ~]# lvextend -L +500M -r /dev/snapper_thinp/origin
  Size of logical volume snapper_thinp/origin changed from 1.00 GiB (256 extents) to <1.49 GiB (381 extents).
  Logical volume snapper_thinp/origin successfully resized.
resize2fs 1.44.6 (5-Mar-2019)
Filesystem at /dev/mapper/luks_origin is mounted on /mnt/origin; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/luks_origin is now 386048 (4k) blocks long.

[root@hayes-01 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/luks_origin  1.5G  3.0M  1.4G   1% /mnt/origin

[root@hayes-01 ~]# lvextend -L +500M -r /dev/snapper_thinp/origin
  Size of logical volume snapper_thinp/origin changed from <1.49 GiB (381 extents) to <1.98 GiB (506 extents).
  Logical volume snapper_thinp/origin successfully resized.
resize2fs 1.44.6 (5-Mar-2019)
Filesystem at /dev/mapper/luks_origin is mounted on /mnt/origin; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/luks_origin is now 514048 (4k) blocks long.

# now reencrypt
[root@hayes-01 ~]# echo Str0ngP455w0rd### | cryptsetup reencrypt --resilience none --active-name luks_origin
Finished, time 00:21.004, 2008 MiB written, speed  95.6 MiB/s   

# Doesn't work after reencryption
[root@hayes-01 ~]# lvextend -L +500M -r /dev/snapper_thinp/origin
  Size of logical volume snapper_thinp/origin changed from <1.98 GiB (506 extents) to 2.46 GiB (631 extents).
  Logical volume snapper_thinp/origin successfully resized.
Enter passphrase for /dev/mapper/snapper_thinp-origin: 
No key available with this passphrase.
fsadm: Failed to resize active LUKS device
  /usr/sbin/fsadm failed: 1

Comment 4 Ondrej Kozina 2019-08-20 14:10:09 UTC
(In reply to Corey Marthaler from comment #3)

This is bug in online reencryption. Currently we reload keys in kernel keyring despite --disable-keyring parameter. Do you agree to clone this into separate bug?

Comment 7 RHEL Program Management 2021-02-01 07:31:13 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.