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

2023-01-20 Thread vmxevilstar
+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 +, Ronny Adsetts wrote:
> Bug#987008: Grub fails to find LVM volume after previous LV renam



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

2023-01-20 Thread Ronny Adsetts
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



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

2021-09-24 Thread Hoyer, David
On Sat, 28 Aug 2021 09:57:35 +0200 Rogier  wrote: 
> 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/ -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. 
> 
> 
> 
I have tested the patch and it fixes the issue we were seeing.



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

2021-08-28 Thread Rogier
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/ -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.



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

2021-08-27 Thread Rogier
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, ))
+  if (grub_add (ptr, (grub_size_t)grub_le_to_cpu64 (rlocn->size), ))
 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.



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

2021-04-15 Thread Hoyer, David
Package: grub2
Version: 2.02+dfsg1-20+deb10u4

-- System Information:
Debian Release: 10.8
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-14-clp-eseries-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

lvm2 version: 2.03.02-3
libc6 version: 2.28-10

Dear Maintainer,

We are seeing a problem with the latest buster version of grub2 with finding 
our LVM volume to boot from.
Our host has a single VG (named 'system'), with around 10 LVs.   One of the LVs 
is system-root.active which 
is what we boot from.   It contains both the /boot volume as well as the rest 
of the OS.   Also we are
using legacy boot on this host.

We are finding that if you rename an LV (not the LV we boot from), that on a 
reboot, we sometimes cannot
find the boot LV and end up at grub rescue prompt:

error: disk `lvm/system-root.active' not found. 

Entering rescue mode... 

grub rescue>

For a test, we have a LV which is not in use and we rename it to something else 
and then reboot.   After about 220
iterations of this, we run into this problem.   We are able to boot these hosts 
through a PXE server so that we
can get access to the drive which contains this VG.  When we do this sort of 
boot, we are not actually using the VG.
When we do this and then simply rename that unused LV again and then reboot, 
suddenly it will boot up again.

We reverted back to grub version 2.02+dfsg1-20+deb10u3 and the problem went 
away.

As part of our investigation of this matter, I have been running 
grub-bios-setup command after PXE booting.  I chroot
into the LV system-root.active and run the grub-bios-setup command with 
appropriate parameters and verbose enabled
as we have seen this to also fail due to the same problem.   Below is the 
output from that command when we fail:


grub-bios-setup: info: adding `hd0' -> `/dev/sda' from device.map.
grub-bios-setup: info: /dev/sda is present.
grub-bios-setup: info: Looking for /dev/sda.
grub-bios-setup: info: /dev/sda is a parent of /dev/sda.
grub-bios-setup: info: /dev/sda is present.
grub-bios-setup: info: Looking for /dev/sda.
grub-bios-setup: info: /dev/sda is a parent of /dev/sda.
grub-bios-setup: info: transformed OS device `/dev/sda' into GRUB device `hd0'.
grub-bios-setup: info: reading /boot/grub/i386-pc/boot.img.
grub-bios-setup: info: reading /boot/grub/i386-pc/core.img.
grub-bios-setup: info: root is `(null)', dest is `hd0'.
grub-bios-setup: info: Opening dest.
grub-bios-setup: info: drive = 0.
grub-bios-setup: info: the size of hd0 is 62533296.
grub-bios-setup: info: changing current directory to /dev/mapper.
grub-bios-setup: info: /dev/mapper/system-root.active is not present.
grub-bios-setup: info: changing current directory to /dev.
grub-bios-setup: info: changing current directory to system.
grub-bios-setup: info: changing current directory to mapper.
grub-bios-setup: info: changing current directory to disk.
grub-bios-setup: info: changing current directory to by-label.
grub-bios-setup: info: changing current directory to by-uuid.
grub-bios-setup: info: changing current directory to by-partuuid.
grub-bios-setup: info: changing current directory to by-id.
grub-bios-setup: info: changing current directory to by-path.
grub-bios-setup: info: changing current directory to block.
grub-bios-setup: info: /dev/sda1 is present.
grub-bios-setup: info: Looking for /dev/sda1.
grub-bios-setup: info: /dev/sda is a parent of /dev/sda1.
grub-bios-setup: info: /dev/sda1 starts from 2048.
grub-bios-setup: info: opening the device hd0.
grub-bios-setup: info: drive = 0.
grub-bios-setup: info: the size of hd0 is 62533296.
grub-bios-setup: info: drive = 0.
grub-bios-setup: info: the size of hd0 is 62533296.
grub-bios-setup: info: Scanning for DISKFILTER devices on disk hd0.
grub-bios-setup: info: Scanning for mdraid1x devices on disk hd0.
grub-bios-setup: info: Scanning for mdraid09 devices on disk hd0.
grub-bios-setup: info: Scanning for mdraid09_be devices on disk hd0.
grub-bios-setup: info: Scanning for dmraid_nv devices on disk hd0.
grub-bios-setup: info: Scanning for ldm devices on disk hd0.
grub-bios-setup: info: scanning hd0 for LDM.
grub-bios-setup: info: no LDM signature found.
grub-bios-setup: info: Scanning for lvm devices on disk hd0.
grub-bios-setup: info: no LVM signature found.
grub-bios-setup: info: Scanning for DISKFILTER devices on disk hd0.
grub-bios-setup: info: Scanning for mdraid1x devices on disk hd0.
grub-bios-setup: info: Scanning for mdraid09 devices on disk hd0.
grub-bios-setup: info: Scanning for mdraid09_be devices on disk hd0.
grub-bios-setup: info: Scanning for dmraid_nv devices on disk hd0.
grub-bios-setup: info: Scanning for ldm devices on disk hd0.
grub-bios-setup: info: scanning hd0 for LDM.