Grub wont pick up new kernels (was: Can't update kernel)
In a seemingly endless quest to get Vagrant working I am trying to update Fedora. Vagrant needs VirtualBox, VirtualBox needs kernel sources, and kernel sources are only available for the latest kernel version.
$ uname -r
4.3.5-300.fc23.x86_64
I tried updating the system.
$ sudo dnf update
Last metadata expiration check: 2:03:57 ago on Tue May 10 11:20:17 2016.
Dependencies resolved.
Nothing to do.
Complete!
Clearly the system is already updated.
$ sudo dnf install kernel
Last metadata expiration check: 2:05:00 ago on Tue May 10 11:20:17 2016.
Package kernel-4.4.8-300.fc23.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
I tried removing the current kernel:
$ sudo dnf remove kernel-(uname -r)
Complete. Let's see what's installed:
$ rpm -qva "kernel-*"
kernel-core-4.4.8-300.fc23.x86_64
kernel-core-4.4.4-301.fc23.x86_64
kernel-headers-4.4.8-300.fc23.x86_64
kernel-modules-4.4.8-300.fc23.x86_64
kernel-devel-4.4.8-300.fc23.x86_64
kernel-modules-4.4.4-301.fc23.x86_64
All good so far.
So I rebooted....
Only to find that three kernels were listed in Grub: 4.3.5-300.fc23.x86_64, and two much older ones from the 4.2 branch.
$ rpm -qva "kernel-*"
kernel-modules-4.3.5-300.fc23.x86_64
kernel-core-4.4.8-300.fc23.x86_64
kernel-core-4.4.4-301.fc23.x86_64
kernel-core-4.3.5-300.fc23.x86_64
kernel-headers-4.4.8-300.fc23.x86_64
kernel-modules-4.4.8-300.fc23.x86_64
kernel-devel-4.4.8-300.fc23.x86_64
kernel-modules-4.4.4-301.fc23.x86_64
What on earth is going on here?
Edit: I later attempted to update grub to pick up the new kernel.
$ cd /boot/grub2
$ mv grub.cfg grub.cfg.old
$ sudo grub2-mkconfig -o grub.cfg.new
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.8-300.fc23.x86_64
Found initrd image: /boot/initramfs-4.4.8-300.fc23.x86_64.img
Found linux image: /boot/vmlinuz-4.4.4-301.fc23.x86_64
Found initrd image: /boot/initramfs-4.4.4-301.fc23.x86_64.img
Found linux image: /boot/vmlinuz-4.3.5-300.fc23.x86_64
Found initrd image: /boot/initramfs-4.3.5-300.fc23.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-0468365313db460f867aa0a7c6284ace
Found initrd image: /boot/initramfs-0-rescue-0468365313db460f867aa0a7c6284ace.img
I can confirm that the new config file has the correct entries:
$ grep 4.4 grub.cfg
menuentry 'Fedora (4.4.8-300.fc23.x86_64) 23 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.3.5-300.fc23.x86_64-advanced-29e2d74b-255e-44fa-b8e7-edb54b33f225' {
linux16 /vmlinuz-4.4.8-300.fc23.x86_64 root=/dev/mapper/fedora_deepwinter-root ro rd.lvm.lv=fedora_deepwinter/root rd.luks.uuid=luks-b09d62d7-9782-42d5-890d-f117ccb8a1cc rd.lvm.lv=fedora_deepwinter/swap rhgb quiet splash acpi_backlight=vendor acpi_osi='!Windows 2013' acpi_osi='!Windows 2012' LANG=en_GB.UTF-8
initrd16 /initramfs-4.4.8-300.fc23.x86_64.img
menuentry 'Fedora (4.4.4-301.fc23.x86_64) 23 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.3.5-300.fc23.x86_64-advanced-29e2d74b-255e-44fa-b8e7-edb54b33f225' {
linux16 /vmlinuz-4.4.4-301.fc23.x86_64 root=/dev/mapper/fedora_deepwinter-root ro rd.lvm.lv=fedora_deepwinter/root rd.luks.uuid=luks-b09d62d7-9782-42d5-890d-f117ccb8a1cc rd.lvm.lv=fedora_deepwinter/swap rhgb quiet splash acpi_backlight=vendor acpi_osi='!Windows 2013' acpi_osi='!Windows 2012' LANG=en_GB.UTF-8
initrd16 /initramfs-4 ...