[Bug 2054131] Re: Regression: lvremove fails to remove all LVs if one is in use
Gunnar
2054131 at bugs.launchpad.net
Fri Feb 16 16:33:07 UTC 2024
Reported upstream as well: https://gitlab.com/lvmteam/lvm2/-/issues/10
** Bug watch added: gitlab.com/lvmteam/lvm2/-/issues #10
https://gitlab.com/lvmteam/lvm2/-/issues/10
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to lvm2 in Ubuntu.
https://bugs.launchpad.net/bugs/2054131
Title:
Regression: lvremove fails to remove all LVs if one is in use
Status in lvm2 package in Ubuntu:
New
Bug description:
When attempting to remove multiple logical volumes (LVs) with the
`lvremove -y` command, if any of the LVs are in use, the command fails
but still causes the LVs to disappear from the system. However, these
LVs reappear upon reactivating the volume group (VG), indicating they
were not properly removed. This behavior can lead to confusion and
inconsistent state of the VG and LVs. Expected behavior would either
fully remove all not-in-use LVs or leave all LVs unchanged if any LV
cannot be removed due to being in use.
The expected behavior, observed in previous versions, was to fully
remove all not-in-use LVs while leaving the ones that are in use
unchanged. This regression in functionality can disrupt workflows that
rely on lvremove to accurately reflect the state of LVs post-
operation, leading to administrative confusion and potential data
management issues.
Environments:
Affected:
- LVM versions:
LVM version: 2.03.16(2) (2022-05-18)
Library version: 1.02.185 (2022-05-18)
Driver version: 4.48.0
- Operating System: Ubuntu 23.10
Unaffected:
- LVM versions:
LVM version: 2.03.11(2) (2021-01-08)
Library version: 1.02.175 (2021-01-08)
Driver version: 4.48.0
- Operating System: Ubuntu 22.04
Script to Reproduce:
```
#!/bin/bash
IFS=$'\n\t'
set -euox pipefail
echo ==== Setup
cd $(mktemp -d)
dd if=/dev/zero of=bug.img bs=1G count=1
loop=$(losetup -fP bug.img --show)
pvcreate $loop
vgcreate bug_vg $loop
lvcreate -L 4M -n p1 bug_vg
lvcreate -L 4M -n p2 bug_vg
lvcreate -L 4M -n p3 bug_vg
mkfs.fat /dev/mapper/bug_vg-p2
mkdir x
mount /dev/mapper/bug_vg-p2 x
echo ==== Setup done, bug_vg p2 is now in use
lsblk $loop
set +e
# this command exits with exit code 5
lvremove -y /dev/bug_vg/*
echo $?
set -e
lsblk $loop
echo ==== Activate the vg again
vgchange -aay bug_vg
echo ==== Observe removed LVs are back
lsblk $loop
umount x
rmdir x
echo ==== bug_vg p2 is no longer in use, remove again
lvremove -y /dev/bug_vg/*
lsblk $loop
echo ==== Activate the vg again
vgchange -aay bug_vg
echo ==== Observe removed LVs stay gone this time
lsblk $loop
echo cleanup
vgremove bug_vg
pvremove $loop
losetup -d $loop
rm bug.img
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lvm2/+bug/2054131/+subscriptions
More information about the foundations-bugs
mailing list