Boot latest kernel in Fedora 23

For some reason my Fedora 23 Workstation laptop isn’t automatically booting the latest available kernel when kernel updates have been installed. Ofcourse, booting the latest kernel is highly desireable as it increases security by replacing old bugs with new ones :-). In this post I describe the manual method of changing the default boot entry in grub as well as the proper fix for what turns out to be a bug.

Manual

First, find all installed kernel versions:

[root@mainframe grub.d]$ egrep "submenu|^menuentry" /boot/grub2/grub.cfg | awk -F\' '{print $2}'

First, find the installed kernel versions:

[root@mainframe:~]# egrep "submenu|^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
Fedora (4.4.9-300.fc23.x86_64) 23 (Workstation Edition)
Fedora (4.4.8-300.fc23.x86_64) 23 (Workstation Edition)
Fedora (4.4.7-300.fc23.x86_64) 23 (Workstation Edition)
Fedora (0-rescue-173a212f2ad14d9796fcb789d2440fac) 23 (Workstation Edition)

Then tell grub to boot the latest kernel available:

[root@mainframe grub.d]$ grub2-set-default "Fedora (4.4.9-300.fc23.x86_64) 23 (Workstation Edition)"

Now verify the default entry:

[root@mainframe grub.d]$ grub2-editenv list
saved_entry=Fedora (4.4.9-300.fc23.x86_64) 23 (Workstation Edition)

Reboot.

Fixing it proper

If you are like me you really want to automatically boot the new kernel after every update. Eventually I tracked the problem down to a bug in Anaconda (the installer) that created an invalid configuration file.

TLDR; you can find more information about this issue in this Bugzilla entry.

Short version; check if your /etc/sysconfig/kernel file suffers from this issue, look for the DEFAULTKERNEL keyword. If this keyword has a value like b'kernel-core' you just found the problem ;). It’s just some more fallout of the python2 to python3 migration in Anaconda, in this case the way how python handles strings.

Adjust your file to something like below and be done with it.

[root@mainframe /]# cat /etc/sysconfig/kernel
# UPDATEDEFAULT specifies if new-kernel-pkg should make
# new kernels the default
UPDATEDEFAULT=yes

# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL='kernel-core'

See also

comments powered by Disqus