centos: work around 9-stream BLS issues
Per the bug mentioned upstream, grub2-mkconfig will currently not set the kernel options for BLS entries prefixed with a machine-id different to the running system. This affects the centos element, as the upstream .qcow2 comes with a pre-existing BLS entry but a blank machine-id. This only affects 9-stream -- prior releases either don't use BLS or have entries configured to use a common variable from grubenv which is updated correctly. We currently can not end-to-end test this in OpenDev because we run our functional tests on Ubuntu Focal (they use devstack), whose kernel can not read the XFS format on the 9-stream .qcow2. This expands the functional tests (that run on Debian Buster, with a later kernel) to add the vm element, so the bootloader path is exercised (this requires a block-device too). This at least runs the bootloader install, we can confirm the kernel options look right from the dumping provided the logs. Change-Id: I327f5e7a95e47905c01138c8c4483f3f03e8efff
This commit is contained in:
parent
0bf80735a7
commit
53d04d27c6
46
diskimage_builder/elements/centos/pre-install.d/03-reset-bls-entries
Executable file
46
diskimage_builder/elements/centos/pre-install.d/03-reset-bls-entries
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
if [[ ! '9-stream' =~ ${DIB_RELEASE} ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is a workaround for the grub issue reported upstream with
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2032680
|
||||||
|
|
||||||
|
# This clears out and recreates the BLS entries from the upstream
|
||||||
|
# .qcow2 image in /boot/loader/entries with the current machine-id.
|
||||||
|
# This means that in the bootloader setup, grub2-mkconfig will update
|
||||||
|
# config options as required.
|
||||||
|
|
||||||
|
# All grub2-switch-to-blscfg really does is call "kernel-install" with
|
||||||
|
# the kernels installed in /lib/modules -- this is another option for
|
||||||
|
# recreating the BLS entries. You can also re-install the kernel
|
||||||
|
# packages to do this. Another option again would be just to rename
|
||||||
|
# the exsiting .conf files.
|
||||||
|
|
||||||
|
# If this is already set, grub2-switch-to-blscfg will abort
|
||||||
|
sed -i 's/GRUB_ENABLE_BLSCFG=true//' /etc/default/grub
|
||||||
|
echo "--- /etc/default/grub dump ---"
|
||||||
|
cat /etc/default/grub
|
||||||
|
|
||||||
|
# Clear out the entries that came with the qcow2 image
|
||||||
|
echo "--- Clearing BLS entries ---"
|
||||||
|
ls /boot/loader/entries/*.conf
|
||||||
|
rm /boot/loader/entries/*.conf
|
||||||
|
|
||||||
|
# This will regenerate /boot/loader/entries for the current
|
||||||
|
# machine-id. After this, grub2-mkconfig works as usual.
|
||||||
|
#
|
||||||
|
grub2-switch-to-blscfg
|
||||||
|
echo "--- Show kernels ---"
|
||||||
|
grubby --info=ALL
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# mode: sh
|
||||||
|
# End:
|
@ -1,3 +1,5 @@
|
|||||||
base
|
base
|
||||||
|
block-device-mbr
|
||||||
epel
|
epel
|
||||||
openstack-ci-mirrors
|
openstack-ci-mirrors
|
||||||
|
vm
|
||||||
|
Loading…
Reference in New Issue
Block a user