Bug#977544: grub-pc: lack of lvm2/vgs might end up with empty /boot/grub/i386-pc/

Michael Prokop mika at debian.org
Wed Dec 16 14:36:24 GMT 2020


Package: grub-pc
Version: 2.04-11
Severity: important

Hi,

this looks like a bug to me that was introduced with
debian/patches/grub-install-backup-and-restore.patch.

The system is a fresh Debian/bullseye environment, installed on a
LVM device.

With grub-pc <=2.04-9 we had the following behavior:

| root at demo-system:/# rm -rf /boot/grub/i386-pc/
| root at demo-system:/# grub-install /dev/sda
| Installing for i386-pc platform.
| Installation finished. No error reported.
| root at demo-system:/# ls -la /boot/grub/i386-pc/normal.mod   # + all the other files are also there
| -rw-r--r-- 1 root root 116032 Dec 16 14:54 /boot/grub/i386-pc/normal.mod

But starting with grub-pc 2.04-11 that's what we got:

| root at demo-system:/# rm -rf /boot/grub/i386-pc/
| root at demo-system:/# grub-install /dev/sda
| Installing for i386-pc platform.
| Installation finished. No error reported.
| root at demo-system:/# ls /boot/grub/i386-pc/
| root at demo-system:/#

So /boot/grub/i386-pc/ is left behind empty, and therefore
failing to boot, while grub-install didn't complain at all.

Even when running grub-install with --verbose, there's no difference
visible between the working and the broken runs, it even says (in
both cases):

| grub-install: info: copying `/usr/lib/grub/i386-pc/normal.mod' -> `/boot/grub/i386-pc/normal.mod'.

Only when strace-ing grub-install and comparing it to the working
version, I then noticed this:

| execve("/root/bin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| execve("/usr/local/sbin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| execve("/usr/local/bin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| execve("/sbin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| execve("/bin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| execve("/usr/sbin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| execve("/usr/bin/vgs", ["vgs", "--options", "vg_uuid,pv_name", "--noheadings", "--separator", ":"], 0x557b5b895d10 /* 39 vars */) = -1 ENOENT (No such file or directory)
| openat(AT_FDCWD, "/boot/grub/i386-pc", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
| fstat(3, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
| getdents64(3, /* 284 entries */, 32768) = 9728
| unlink("/boot/grub/i386-pc/mul_test.mod") = 0
| unlink("/boot/grub/i386-pc/cmosdump.mod") = 0
| unlink("/boot/grub/i386-pc/relocator.mod") = 0
| unlink("/boot/grub/i386-pc/search_label.mod") = 0
| unlink("/boot/grub/i386-pc/tga.mod") = 0
| unlink("/boot/grub/i386-pc/usbms.mod") = 0
| unlink("/boot/grub/i386-pc/memdisk.mod") = 0
| [...]

So the underlying issue is that lvm2's vgs binary was missing during
execution of grub-install, though this ended up with the removal of
/boot/grub/i386-pc.

regards
-mika-



More information about the Pkg-grub-devel mailing list