What in Fedora controls whether the latest installed kernel is booted on next boot?
It's a simple environment variable set in a simple file.
Fedora's script /usr/lib/kernel/install.d/20-grub.install
— which runs every time a new kernel is installed — sources file /etc/default/grub
(this file is part of the GRUB packages installed on a normal Fedora system) and file /etc/sysconfig/kernel
.
This install.d
script can, during the kernel installation process, automatically set the latest-installed kernel to be the default GRUB entry to boot, and therefore the system will boot that kernel upon next reboot. While I have no experience with other boot loaders, I suspect similar scripts should be available for other bootloaders your system may have opted into.
There are two options to ensure your system automatically boots to the latest kernel after an upgrade:
- Variable
UPDATEDEFAULT
is set toyes
in/etc/sysconfig/kernel
. Unless option 2 overrides it via its own variable, then this value is used. This is the more general option as it can be used by bootloaders other than GRUB. The default (unset) action from this variable is to do nothing. - Variable
GRUB_UPDATE_DEFAULT_KERNEL
is set totrue
in/etc/default/grub
, or is left unset if option 1 is in effect. If set tofalse
, it prohibits this behavior even if option 1 is in effect. If unset, and option 1 is also unset, then the kernel install process will not update the default kernel to boot.
In GRUB-enabled systems (most Fedora systems) this mechanism only has a practical effect if:
- GRUB has been told to use the saved default via the
/etc/default/grub
variableGRUB_DEFAULT=saved
, and - GRUB on the system is configured to use the Boot Loader Specification (BLS) via variable
GRUB_ENABLE_BLSCFG=true
(the default on modern Fedora systems).
That's all.