Tom Horsley writes:
On Sat, 07 Jan 2023 20:40:18 -0500
Sam Varshavchik wrote:
> But at boot the grub menu still highlights the most recently installed
> kernel, and that's what boots by default.
If you can stand looking through the scripts that are used to build
the grub.cfg (I think they may live in /etc/grub.d) you will find
massively unintelligible scripts implementing impossible to decode
logic to decide all kinds of things, including the default kernel.
--set-default does not update grub.cfg. The default kernel setting is …
somewhere.
I distinctly recall there was an entry in /etc/default/grub that specified
it. It's not there any more.
It is possible the actual default is determined by grub environment
file setting.
Well, yes. After some random poking:
grub2-editenv list
This shows the default kernel boot that grubby sets.
Except that it has absolutely no effect whatsoever. I see that grubby
updates this. But grub, when it boots, completely ignores the default entry
that's shown here.
I gave up trying to figure out how to get the scripts to do what
I wanted in an official fashion and just have a script that runs after
dnf to fix any stuff I don't want in the grub.cfg file.
This has all the telltale signs of grub's default boot kernel setting name's
getting renamed or changed, but grubby was not updated, accordingly, so it
thinks it's setting the default boot kernel, but grub doesn't read it. The
environment file, /boot/grub2/grubenv, is just a generic name=value store,
that you can toss any random names and values in there, from the looks of it.
While I was typing this out I remembered that the actual bootloader gets
installed by grub-install. Perhaps grub and grubby were updated, but grub-
install did not ran.
And after a "/sbin/grub-install /dev/sda", the default boot kernel setting,
made by grubby, started working. Another Scooby-Doo mystery solved…