diskimage-builder/diskimage_builder/elements
Ian Wienand 2d47d4157c Fix BLS based bootloader installation
This reverts I2701260d54cf6bc79f1ac765b512d99d799e8c43,
Idf2a471453c5490d927979fb97aa916418172153 and part of
Iecf7f7e4c992bb23437b6461cdd04cdca96aafa6 which added special flags to
update kernels via grubby.

These changes actually ended up reverting the behaviour on Fedora 35,
which is what led me to investigate what was going on more fully.

All distros still support setting GRUB_DEVICE in /etc/default/grub;
even the BLS based ones (i.e. everything !centos7).

The implementation *is* confusing -- in earlier distros each BLS entry
would refer to the variable $kernelopts; which grub2-mkconfig would
write into /boot/grub2/grubenv.  After commit [1] this was reverted,
and the kernel options are directly written into the BLS entry.

But the real problem is this bit from [2]

 get_sorted_bls()
 {
     if ! [ -d "${blsdir}" ] || ! [ -e /etc/machine-id ]; then
        return
     fi
     ...
     files=($(for bls in ${blsdir}/${machine_id}-*.conf; do
     ...
 }

i.e., to avoid overwriting BLS entries for other OS-boots (?),
grub2-mkconfig will only update those BLS entries that match the
current machine-id.

The problem for DIB is that we are clearing the machine-id early in
finalise.d/01-clear-machine-id, but then running the bootloader update
later in finalise.d/50-bootloader.

The result is that the bootloader entry generated when we installed
the kernel (which guessed at the root= device, etc.) is *not* updated.
Even more annoyingly, the gate doesn't pick this up -- because the
gate tests run on a DIB image that was booted with
"root=LABEL=cloudimg-rootfs" the kernel initially installed with
"install-kernel" (that we never updated) is actually correct.  But
this fails when built on a production host.

Thus we don't need any of the explicit grubby updates; these are
reverted here.  This moves the machine-id clearing to after the
bootloader setup, which allows grub2-mkconfig to setup the BLS entries
correctly.

[1] 4a742183a3
[2] https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/0062-Add-BLS-support-to-grub-mkconfig.patch

Depends-On: https://review.opendev.org/c/zuul/nodepool/+/818705
Change-Id: Ia0e49980eb50eae29a5377d24ef0b31e4d78d346
2021-11-25 14:26:23 +11:00
..
apt-conf Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
apt-preferences Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
apt-sources Use local mirror for ubuntu-minimal jobs 2017-06-21 12:01:31 +10:00
baremetal Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
base Debuntu: add apt-transport-https 2020-04-02 10:11:35 +11:00
block-device-efi Add element block-device-efi-lvm 2021-06-01 17:27:28 +12:00
block-device-efi-lvm Add element block-device-efi-lvm 2021-06-01 17:27:28 +12:00
block-device-gpt Choose appropriate bootloader for block-device 2018-02-23 10:04:44 +11:00
block-device-mbr Choose appropriate bootloader for block-device 2018-02-23 10:04:44 +11:00
bootloader Fix BLS based bootloader installation 2021-11-25 14:26:23 +11:00
cache-url cache-url : turn down verbose curl 2021-06-24 10:09:00 +10:00
centos Update centos element for 9-stream 2021-10-20 09:39:27 +11:00
centos7 Support secure-boot bootloader where possible 2021-03-11 10:27:59 +13:00
centos-minimal Add support for CentOS Stream 9 in DIB 2021-10-27 13:38:14 +02:00
cleanup-kernel-initrd Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
cloud-init update various gentoo bits 2020-08-24 10:21:35 -05:00
cloud-init-datasources Drop support for Ubuntu precise 2017-05-31 14:36:30 +02:00
cloud-init-disable-resizefs Disable growpart in cloud-init-disable-resizefs 2020-10-06 14:03:57 +02:00
cloud-init-nocloud Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
containerfile containerfile: handle errors better 2021-11-10 11:42:49 +11:00
debian Fix cron not installed in debian 2021-09-01 23:49:27 +02:00
debian-minimal Fix debian-minimal security repos 2021-09-10 11:40:48 +02:00
debian-systemd Install systemd earlier for Stretch 2017-06-19 13:27:33 +10:00
debian-upstart Install systemd earlier for Stretch 2017-06-19 13:27:33 +10:00
debootstrap debian-minimal: Set bullseye version 2021-04-28 09:48:22 -07:00
deploy-baremetal Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
deploy-kexec Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
deploy-targetcli Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
deploy-tgtadm Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
devuser install sudo in the devuser element 2018-03-22 00:16:09 -05:00
dhcp-all-interfaces Check and remove existing image interface configurations 2021-02-16 08:46:32 +00:00
dib-init-system Introduce manual setting of DIB_INIT_SYSTEM 2019-11-21 12:38:15 +11:00
dib-python Convert multi line if statement to case 2021-04-07 07:17:19 +00:00
dib-run-parts Revert "dib-lint: use yamllint to parse YAML files" 2020-05-28 16:44:49 +10:00
disable-nouveau Ensure nouveau is blacklisted in initramfs too 2019-10-23 10:16:00 +11:00
disable-selinux dib-lint: test elements have README.rst file 2020-01-20 11:43:43 +01:00
dkms Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
docker Run dib-run-parts out of /tmp 2017-04-05 13:11:22 +10:00
dpkg Rename duplicating 10-debian-minimal.bash 2020-09-18 14:52:56 +10:00
dracut-network Remove dracut-network element 2017-05-31 08:36:56 +10:00
dracut-ramdisk Merge "Remove use of 'which'." 2017-06-11 09:30:34 +00:00
dracut-regenerate dracut-regenerate: drop Python 2 packages 2021-10-27 11:11:50 +11:00
dynamic-login Fix dynamic-login with grub2 2020-11-20 15:00:54 +01:00
element-manifest Release 1.24.0 2017-01-31 14:14:19 +11:00
enable-serial-console update various gentoo bits 2020-08-24 10:21:35 -05:00
ensure-venv Add ensure-venv element, install glean with it 2020-03-10 11:57:43 +11:00
epel Update centos element for 9-stream 2021-10-20 09:39:27 +11:00
fedora Use non-greedy modifier for SUBRELEASE grep 2021-08-23 14:12:17 +12:00
fedora-container fedora-container: update to Fedora 35 2021-11-03 06:26:56 +11:00
fedora-minimal Fix DISTRO_NAME in Fedora elements 2021-05-17 10:02:09 +10:00
gentoo update gentoo source suffix (where it finds the file to download) 2021-11-20 20:18:55 -06:00
growroot Revert "dib-lint: use yamllint to parse YAML files" 2020-05-28 16:44:49 +10:00
growvols Replace deprecated assertEquals 2021-11-12 09:46:14 +08:00
grub2 Update centos element for 9-stream 2021-10-20 09:39:27 +11:00
hpdsa replace the link which is in the 06-hpdsa file 2021-03-12 19:16:50 +08:00
hwburnin Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
hwdiscovery Remove use of 'which'. 2017-05-19 12:43:36 -07:00
ibft-interfaces Add an element to configure iBFT network interfaces 2018-11-20 14:11:11 +01:00
ilo Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
install-bin pip-and-virtualenv: drop f31 & tumbleweed, rework suse 15 install 2020-04-23 08:10:26 +10:00
install-static Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
install-types Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
iscsi-boot Fix centos 8.3 partition image building error with element iscsi-boot 2021-01-14 02:05:20 +00:00
iso Merge "Change paths for bootloader files in iso element" 2021-03-16 09:56:07 +00:00
journal-to-console journal-to-console: element to send systemd journal to console 2019-07-25 11:24:49 +10:00
keylime-agent Add a keylime-agent element and a tpm-emulator element 2021-07-20 10:05:41 -04:00
local-config Merge remote-tracking branch 'origin/master' into merge-branch 2016-11-29 07:43:46 +11:00
lvm Allow processing 'focal' ubuntu release in lvm 2020-10-28 16:55:49 +02:00
manifests Set manifest permissions in the image 2017-05-24 15:20:55 +10:00
mellanox Mellanox element: removed ibutils,libibcm,libmlx4-dev 2020-03-23 00:06:53 +02:00
modprobe modprobe.d: use $TMP_MOUNT_PATH 2019-12-18 11:42:02 -05:00
modprobe-blacklist Add new modprobe element 2018-06-28 13:55:53 +02:00
no-final-image Remove the deprecated ironic-agent element 2021-01-21 14:06:08 +01:00
oat-client Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
openeuler-minimal Introduce openEuler distro 2021-08-04 03:06:55 +00:00
openssh-server openssh-server: harden sshd config 2019-05-01 11:42:21 -04:00
openstack-ci-mirrors Update centos element for 9-stream 2021-10-20 09:39:27 +11:00
opensuse Update IRC networks 2021-07-22 19:17:51 +09:00
opensuse-minimal Support secure-boot bootloader where possible 2021-03-11 10:27:59 +13:00
package-installs Deprecate dib-python; remove from in-tree elements 2020-08-07 10:38:16 +10:00
pip-and-virtualenv Change get-pip url 2021-03-08 09:19:28 +01:00
pip-cache Fix DIB ubuntu-minimal running on bionic (18.04) 2018-10-01 19:59:30 -07:00
pkg-map Introduce openEuler distro 2021-08-04 03:06:55 +00:00
posix Merge remote-tracking branch 'origin/master' into merge-branch 2016-11-29 07:43:46 +11:00
proliant-tools Fix installation of proliant tools 2021-03-03 19:04:50 +01:00
pypi Deprecate dib-python; remove from in-tree elements 2020-08-07 10:38:16 +10:00
python-brickclient Merge branch 'master' into merge-branch 2017-02-09 13:35:53 +11:00
python-stow-versions Fix python-stow-versions 2020-11-17 09:23:32 +00:00
ramdisk Mount /sys RO 2021-07-05 11:45:02 +10:00
ramdisk-base Remove use of 'which'. 2017-05-19 12:43:36 -07:00
rax-nova-agent Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
redhat-common Add policycoreutils package mappings for RHEL/Centos 9 2021-09-13 09:32:53 +12:00
rhel Add DIB_YUM_REPO_PACKAGE as an alternative to DIB_YUM_REPO_CONF 2021-09-13 09:32:53 +12:00
rhel7 Deprecate rhel7 in favor of rhel 2019-05-29 12:07:44 +00:00
rhel-common Fix doc typo 2021-09-01 19:58:52 +02:00
rpm-distro dib-lint: test elements have README.rst file 2020-01-20 11:43:43 +01:00
runtime-ssh-host-keys Release 1.21.1 2017-02-02 20:36:23 +11:00
select-boot-kernel-initrd Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
selinux-permissive move selinux-permissive configure to pre-install phase 2018-11-19 13:13:57 +11:00
simple-init Merge "simple-init: allow disabling DHCP fallback" 2021-09-10 14:54:03 +00:00
source-repositories source-repositories: don't use --git-dir 2021-11-16 19:16:03 +11:00
stable-interface-names Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
svc-map update various gentoo bits 2020-08-24 10:21:35 -05:00
sysctl Release 1.25.2 2017-02-02 11:20:00 +11:00
sysprep Fix BLS based bootloader installation 2021-11-25 14:26:23 +11:00
tpm-emulator Add a keylime-agent element and a tpm-emulator element 2021-07-20 10:05:41 -04:00
uboot Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
ubuntu Trivial: fix whitespace in ubuntu element rst 2021-11-23 07:01:36 -08:00
ubuntu-common Support secure-boot bootloader where possible 2021-03-11 10:27:59 +13:00
ubuntu-minimal Mount /sys RO 2021-07-05 11:45:02 +10:00
ubuntu-signed Use sphinx warning-is-error 2017-03-14 14:49:49 +11:00
ubuntu-systemd-container ubuntu-systemd-container: deprecate and remove jobs 2021-10-20 09:39:27 +11:00
vm Add block-device defaults 2018-02-23 10:04:40 +11:00
yum Add DIB_YUM_REPO_PACKAGE as an alternative to DIB_YUM_REPO_CONF 2021-09-13 09:32:53 +12:00
yum-minimal Add support for CentOS Stream 9 in DIB 2021-10-27 13:38:14 +02:00
zipl Delete the duplicate words in 50-zipl 2019-01-07 10:02:35 +08:00
zypper Fix login.defs config for tumbleweed 2019-12-02 16:21:45 -08:00
zypper-minimal Mount /sys RO 2021-07-05 11:45:02 +10:00
__init__.py Fix unit tests for elements 2018-11-28 11:04:50 +11:00