GRUB 2 and extending a LVM volume group

While installing security updates in a seldomly used virtual machine, the latest kernel package was ready to be configured when I got the following error:

Setting up linux-image-2.6.32-5-amd64 (2.6.32-31) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
Generating grub.cfg ...
/usr/sbin/grub-probe: error: Couldn't find PV pv1. Check your
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-5-amd64.postinst line 799.
dpkg: error processing linux-image-2.6.32-5-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:

First I didn't quite get the line about "Couldn't find PV pv1. Check your", but after some time it dawned on me that "PV" might mean "physical volume", a term used by LVM. I also remembered that I extended the LVM volume group with an additional block device that I attached to the virtual machine.

Now, while grub-legacy (the original GRUB boot loader) didn't care much about LVM, GRUB 2 actually tries to access stuff on it even when /boot is not on LVM. My /boot/grub/grub.cfg for example contains the following lines:

set root='(squeeze01-usr)'
search --no-floppy --fs-uuid --set df791db4-02c9-460e-8cfc-6b0995833da4
if loadfont /share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm

This snippet tries to load a font file from /usr/share/grub, /usr being on the logical volume /dev/squeeze01/usr.

Once I figured this out, the thing missing was clear. As hinted in the error message, I needed to add the new block device (in my case /dev/sdb) to the file in /boot/grub and voila, the configuration of the kernel image worked just as usual.

So remember to update your boot loader configuration when adding new block devices to your LVM volume groups.



Whit's picture

It looks like also just deleting fixes the situation.

d3v1ous's picture

@Whit Thanks for hint.

Koen Calliauw's picture

Had to do this as well, thanks for the info.
Here's what I had on a KVM vm:

(hd0) /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001

Had to add this line:

(hd1) /dev/disk/by-id/ata-QEMU_HARDDISK_QM00002

Thx again.

Mansor's picture

Confirmed! Just deleting it's fixed, that because I have two disks and the there's only one, then I run apt-get -f install and grub creates another with the two disks.


Frode Tviberg's picture

Deleting the file and running the update-grub command saved my evening Smile


charliecron's picture

Thanks for taking the time to post this.