Bug 1985288
| Summary: | cryptsetup resize on a LUKS container on top of an LVM logical volume unmounts the filesystem contained on the LUKS | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Martin Pitt <mpitt> | ||||
| Component: | systemd | Assignee: | Michal Sekletar <msekleta> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Frantisek Sumsal <fsumsal> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 9.1 | CC: | agk, dtardon, extras-qa, fedoraproject, filbranden, flepied, gmazyland, jamacku, kkoukiou, lnykryn, mmarusak, msekleta, mvollmer, okozina, ssahani, s, systemd-maint-list, systemd-maint, yuwatana, zbyszek, z | ||||
| Target Milestone: | beta | Keywords: | Bugfix, Reopened, Reproducer, Triaged | ||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | CockpitTest | ||||||
| Fixed In Version: | systemd-252-7.el9 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | 1934567 | Environment: | |||||
| Last Closed: | 2023-05-09 08:21:58 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: | |||||||
| Bug Depends On: | 1934567, 2138081 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
|
Description
Martin Pitt
2021-07-23 10:12:48 UTC
Expanding the reproducer to translate the complex step 1 into CLI: modprobe scsi_debug dev_size_mb=300 DEV=/dev/sda # this is usually right for a VM with virtiofs, where the root device is /dev/vda vgcreate testvg $DEV lvcreate testvg -n vol -L 200m cryptsetup luksFormat --pbkdf-memory 32768 /dev/mapper/testvg-vol cryptsetup luksOpen /dev/mapper/testvg-vol c1 mkfs -t ext4 /dev/mapper/c1 mount /dev/mapper/c1 /mnt/ Seems to work with systemd 249 -> closing. (In reply to David Tardon from comment #3) > Seems to work with systemd 249 -> closing. Our tests are still occasionally failing with systemd-249-9.el9.x86_64. I am afraid the reproducer we have given you were not correct, sorry for that. The important bit is that systemd needs to take an interest in the mount point, and it does that when it is listed in /etc/fstab. I attach a script for reproducing the bug. Just run it a couple of times and you should see "umount: /mnt: not mounted." When I ran the script in our rhel-9-0 CI image, the bug happened 27 out of 100 times. The chain of events that causes the unmount is this: - "cryptsetup resize" temporarily suspends the device - something triggers a uevent about the device - udev runs while the device is still suspended: - DM_SUSPENDED=1 => ID_FS_TYPE is removed => SYSTEMD_READY=0 - systemd unmounts /mnt because the device is treated as if it had disappeared This is timing sensitive; udev needs to run while the device is suspended. All the remaining things would have happened for many years already I guess, if only udev would have been triggered while a LUKS container is suspended. Thus, if you need a reliable reproducer, replace "cryptsetup resize" in the BUG script with dmsetup suspend /dev/mapper/luks0 udevadm trigger udevadm settle dmsetup resume /dev/mapper/luks0 Created attachment 1859037 [details]
Reproducer
We still see this on all Fedora versions, RHEL 9, Debian and Ubuntu releases. This regression isn't fixed anywhere. I've posted the PR with fix upstream. https://github.com/systemd/systemd/pull/24177 (In reply to Michal Sekletar from comment #9) > I've posted the PR with fix upstream. > > https://github.com/systemd/systemd/pull/24177 Awesome, thanks a lot! This issue should be fixed via rebase to systemd v252. Just for completeness is reincarnation of this bug handled via bug #2158628. Optimal fix is a drop of duplicate CHANGE event in kernel posted in 'suspend'. fix merged to github main branch -> https://github.com/redhat-plumbers/systemd-rhel9/pull/145 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 (systemd 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:2531 |