TT#105407 Ensure lvm2 is present before grub-install is executed

grub-pc >=2.04-11 has a new behavior regarding /boot/grub/i386-pc/
handling, where we end up with an empty /boot/grub/i386-pc/ after
*successful* grub-install execution:

| root@grml ~ # vgchange -ay
| 3 logical volume(s) in volume group "ngcp" now active
| root@grml ~ # mount /dev/mapper/ngcp-root /mnt
| root@grml ~ # grml-chroot /mnt /bin/bash
| Writing /etc/debian_chroot ...
| (spce)root@grml:/# cd
| (spce)root@grml:~# grub-install /dev/sda
| Installing for i386-pc platform.
| Installation finished. No error reported.
| (spce)root@grml:~# ls -la /boot/grub/i386-pc/
| total 16
| drwxr-xr-x 2 root root 12288 Dec 16 12:04 .
| drwxr-xr-x 4 root root  4096 Dec 16 12:07 ..

This causes the installed system to fail to boot with:

| GRUB loading..
| Welcome to GRUB!
|
| error: file `/boot/grub/i386-pc/normal.mod' not found.
| grub rescue> _

The underlying issue is that recent grub versions unlink the files
inside /boot/grub/i386-pc, though it doesn't report anything about it
(even under `--verbose` execution).

This is triggered in our situation, as lvm2's vgs binary isn't present
yet. In earlier versions of grub this wasn't causing any problems and
grub-install happily installed the files inside /boot/grub/i386-pc, even
though we installed lvm2 only afterwards via our metapackages.  To
ensure lvm2 is available during installation time within
grml-debootstrap, explicitly add to it list of packages to be installed.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977544 for further
details regarding the grub bug.

Change-Id: I27a1cd18777526eb26b838fae88d4d87b6e93467
(cherry picked from commit 91e047a486)
mr8.5.4
Michael Prokop 4 years ago committed by Mykola Malkov
parent e57dad6e34
commit 130b367bb0

@ -1778,15 +1778,17 @@ echo FSCK=no >>/etc/debootstrap/config
echo "Clean the default /etc/debootstrap/packages"
echo > /etc/debootstrap/packages
cat >> /etc/debootstrap/packages << EOF
# we want to have LVM support everywhere
lvm2
EOF
if ! "$NGCP_INSTALLER" ; then
echo "Install some packages to be able to login on the Debian plain system"
cat >> /etc/debootstrap/packages << EOF
# to be able to login on the Debian plain system via SSH
openssh-server
# deployment supports LVM only
lvm2
EOF
if [[ "${SWRAID}" = "true" ]] ; then

Loading…
Cancel
Save