On Tue, Dec 17, 2024 at 11:21:26AM +0100, Zdenek Kabelac wrote: > Dne 17. 12. 24 v 10:13 Glass Su napsal(a): > > > > > On Dec 17, 2024, at 16:34, Heming Zhao <heming.z...@suse.com> wrote: > > > > > > Hi LVM2 maintainers, > > > > > > One of SUSE's customers encountered an issue with LVM2. The user created > > > several partitions, one of which was marked as "BIOS boot" (4) instead of > > > "LINUX LVM" (8E). Subsequently, the user ran pvcreate/vgcreate/lvcreate > > > on this partition. During a system update, grub2-install installed GRUB2 > > > in the "BIOS boot" partition, resulting in LVM2 metadata corruption. > > > > > > The root cause of this issue is that grub2-install targets the "BIOS > > > boot" partition when this lvm2 device is specified for installation. If > > > the user had initially marked the partition as "LINUX LVM", grub2-install > > > would not have chosen this partition. > > > > > > On the other hand, it would be beneficial if LVM2 could implement a new > > > filter or a filter function to detect and exclude the "BIOS boot" > > > partition from being considered a valid target for LVM2 device creation. > > > This could involve issuing a warning or error message to alert the user > > > of the potential conflict. This may also help user to notice the issue > > > more easily. > > Hi > > lvm2 is using blkid to detect 'present' signature on a block device - and > normally prompt to confirm wiping such signature. > > We may possibly add similar logic for 'partition signatures'. > > However there is still the plain fact that lvm2 with --force or even just > '--yes' option is assumed to simply proceed and clean&clear such > conflicting signatures and simply makes the block device to be a PV. > > All that said IMHO primary bug here is within 'grub2-install' which simply > should not be blindingly overwriting block device which is in use - this > should be fixed ASAP as there is the biggest risk of data loss, although I > guess everyone is using 'grub2-install --force' - as without this option > (even in my personal experience) is typically refusing to do any work.... > > And same applies to most UI tools I've seen that use lvm2 - all seem to be > pushing '--force & --yes' with each it emitted lvm2 command...
If prompts were in a machine-parsable format, tools that used lvm2 could differentiate between ones that should automatically be responded to with "yes" and ones that should not. -- Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab
signature.asc
Description: PGP signature