-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
Normal
-
sst_desktop_firmware_bootloaders
-
ssg_desktop
-
False
-
-
If docs needed, set a value
-
-
Unspecified
If you take a current image, say [1] and boot it, you will have a BLS entry like
$ /boot/loader/entries/<machine-id>-<kernel>.conf
The <machine-id> will not actually match what you have in /etc/machine-id, as this will have been uniquely updated at boot.
If you do something like add "GRUB_DEVICE=/dev/foo" to /etc/default/grub and run "grub2-mkconfig -o /boot/grub/grub.cfg" this will have no effect, because 10_linux only looks at BLS entries with the current machine-id to update. This happens in [2].
I believe this used to work because all the kernel options were put into the common grubenv file that each BLS entry would refer to. Thus grub2-mkconfig would update grubenv and, even though it wasn't touching any BLS entries, they would all effectively get the new kernel options.
However, this changed with [3] to that kernel options are kept directly in each BLS entry (I can not quite follow the history of that patch, it appears to have been squashed in [4] to "fix a bunch of CVE's", but the behaviour still seems to apply)
This creates for very confusing behaviour.
- If you boot fresh, "grub2-mkconfig" will not alter the kernel command-line options, as the machine-id doesn't match
- If you have installed a new kernel after booting (or, re-installed your existing one for some reason), "grub2-mkconfig" WILL update the kernel options for one BLS entry that matches the machine-id, but the old one will be left alone.
Since I imagine we do not want to revert to setting kernel options in grubenv, I think the solution here is to just match and update ALL BLS entries when grub2-mkconfig runs. This restores the prior behaviour of all kernels being populated with updates to the /etc/default/grub by grub2-mkconfig.
I have attached a small patch, with I have tested locally on [1]. With it, updating /etc/default/grub and running "grub2-mkconfig -o /boot/grub/grub.cfg" correctly updates the BLS entry with the new kernel settings.
[1] https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20211214.3.x86_64.qcow2
[2] https://gitlab.com/redhat/centos-stream/rpms/grub2/-/blob/c9s/0074-Add-BLS-support-to-grub-mkconfig.patch#L230
[3] https://src.fedoraproject.org/rpms/grub2/c/4a742183a39f344a7685bccdc76d5e64dea3766a?branch=master
[4] https://src.fedoraproject.org/rpms/grub2/c/46968b6e6323925be6f29c2770a04a8a1a858082?branch=rawhide
- external trackers