Bug#801313: grub-pc: grub-install doesn't see /dev/mapper/loop0p1 as child partition of /dev/loop0; fixed in stretch

Jeremy Davis jeremy at turnkeylinux.org
Thu Oct 8 14:09:08 UTC 2015


Package: grub-pc
Version: 2.02~beta2-22
Severity: important

Dear Maintainer,

I was trying to install grub to a raw image (i.e. a flat file that will
be used to house a VM). Host & guest image both Debian Jessie

I have partitioned the file:
part 1 : ext2 (for boot)
part 2 : LVM (for root & swap)

I have the raw mounted to /dev/loop0 with kpartx so these partitions map to:

part 1 : /dev/mapper/loop0p1
part 2 : /dev/mapper/loop0p2

The LVM setup (vg labelled "lv") on part 2 provides:
/dev/mapper/lv-root
/dev/mapper/lv-swap_1

I then have it mounted like this:

/dev/mapper/lv-root -> /mnt
/dev/mapper/loop0p1 -> /mnt/boot

I then install grub like this:

chroot /mnt grub-mkdevicemap
chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
grub-install --force --root-directory=/mnt /dev/loop0

Which appears to install as it should:

# chroot /mnt grub-mkdevicemap
# chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
done
# grub-install --force --root-directory=/mnt /dev/loop0
Installing for i386-pc platform.
Installation finished. No error reported.

So this appears to all complete fine...

But when I boot the raw image I get an error about a device not found (a
UUID that I have no idea where it comes from. It does not appear to
match any of the UUIDs that I see in the grub.cfg so I assume that this
is coming from the grub installation in the MBR?)

I can fix grub easy enough from the vm:
-boot with live iso
-mount /dev/mapper/lv-root as /mnt & /dev/sda1 as /mnt/boot
# grub-install --root-directory=/mnt /dev/sda

Once grub is repaired than all works as it should, however I want it to
just work from the start...

I posted this on the gnu-grub mailing list and a kind soul reproduced it
on a similar version of grub-pc (on OpenSUSE) but noted that it could
not be reproduced in the current upstream version.

I tried my luck on the Stretch version (2.02~beta2-28) and it's fixed
there already.

I was hoping that we may be able to work out where the issue lays and
have the fix backported to Jessie?

Any more info you need and/or anything further you would like me to do
please let me know.

Regards,
Jeremy Davis


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20151009/3d06fbf0/attachment-0003.sig>


More information about the Pkg-grub-devel mailing list