Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#987008: Grub fails to find LVM volume after previous LV rename

78 views
Skip to first unread message

Rogier

unread,
Aug 27, 2021, 7:40:04 PM8/27/21
to
Dear maintainer,

I have also run into this bug, in the same version of grub (2.02+dfsg1-20+deb10u4).

As *any* change to the LVM configuration can trigger the bug, rendering the system unbootable, this is a ticking bomb for users of LVM. IMO the severity of this bug should be increased to critical.

I did some investigation, and the cause is an incorrect computation of mda_end when the metadata area wraps around.

The following patch fixes the problem:
---------------------------------------------------
Index: grub2-2.02+dfsg1/grub-core/disk/lvm.c
===================================================================
--- grub2-2.02+dfsg1.orig/grub-core/disk/lvm.c
+++ grub2-2.02+dfsg1/grub-core/disk/lvm.c
@@ -253,7 +253,7 @@ error_parsing_metadata:

p = q = (char *)ptr;

- if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr))
+ if (grub_add (ptr, (grub_size_t)grub_le_to_cpu64 (rlocn->size), &ptr))
goto error_parsing_metadata;

mda_end = (char *)ptr;
----------------------------------------------------

I checked the sources of grub2-2.04 in bullseye, and the code in question looks exactly the same, so this same bug is also present in bullseye and testing.

Kind regards,

Rogier.

Rogier

unread,
Aug 28, 2021, 4:10:03 AM8/28/21
to
Additional information for the benefit of anybody who uses LVM and
grub, and is unsure if or when this problem will affect them:

Besides the system being rendered unbootable, another symptom of this
problem being acute is that, at that time, update-grub will most
probably(*) print messages of the following kind, one for each LVM
filesystem affected:

grub-probe: error: disk `lvmid/******-****-****-****-****-****-
******/******-****-****-****-****-****-******' not found.

The immediate workaround, if this problem occurs, would be to make
another modification to the LVM configuration. Then run update-grub
again. For verification, the following command can also be used:

grub-probe -d /dev/mapper/<device corresponding to one of the LVs> -t
fs

If the problem is acute, the error message should be printed, if it is
not acute, then there should be no error message (no warranties :-).

Kind regards,

Rogier.


(*) but not if os-prober is disabled for update-grub.

Ronny Adsetts

unread,
Jan 20, 2023, 5:40:04 AM1/20/23
to
Source: grub2
Followup-For: Bug #987008

Dear Maintainer,

Is there a chance that the patch in comment #10 could be applied to the Debian
package? Judging by the unstream ticket, there's little interest in applying
the patch there - I've just commented on the ticket asking if it couild be
applied upstream which might remind people it's there.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=987008#10

I was bitten by this bug a couple of days ago when one of our servers failed to
boot following a power outage.

Thanks for your time.

Ronny


-- System Information:
Debian Release: 10.12
APT prefers oldstable-updates
APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-20-amd64 (SMP w/20 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

vmxev...@gmail.com

unread,
Jan 20, 2023, 5:50:04 AM1/20/23
to
+1  I largely use lvm in prod, sometimes it happens that I need to move things around, rename volumes... etc I'd like the fix to be applied
Thanks Ronny

On Fri, 2023-01-20 at 09:58 +0000, Ronny Adsetts wrote:
Bug#987008: Grub fails to find LVM volume after previous LV renam

0 new messages