Ask Your Question
1

Grub wont pick up new kernels (was: Can't update kernel)

asked 2016-05-10 09:51:30 -0500

djcf gravatar image

updated 2016-05-10 14:07:34 -0500

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 ...
(more)
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2016-05-10 12:04:23 -0500

alick gravatar image

updated 2016-05-10 12:06:24 -0500

Seems like the problem is that new kernels are not added to grub menu correctly.

First, check if you have up to date kernel (4.4.8) installed correctly.

ls /boot/

And look for vmlinuz and initramfs with 4.4.8 version tag.

If they are indeed there, let grub2 update its configuration file (menu items set there)

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

(It is a good idea to backup /boot/grub2/grub.cfg first.)

(Root privilege required. If you do not use sudo, substitute with su -c 'your_command' and input root password)

You can optionally inspect the file for 4.4.8 kernel

sudo less /boot/grub2/grub.cfg

(Use q to exit the viewer interface.)


But it seems to me Vagrant (new versions) do not require VirtualBox anymore, and it is available in Fedora's official software repo. So all you have to do is:

sudo dnf install vagrant
edit flag offensive delete link more

Comments

You're right about grub, but I'm still not able to update the grub config. I've updated my answer accordingly.

djcf gravatar imagedjcf ( 2016-05-11 05:23:09 -0500 )edit

@djcf Are you using UEFI or BIOS? Secure Boot or not? I searched the web and it seems like the no modinfo.sh error is related to UEFI boot, and you need sudo dnf install grub2-efi-modules for that. If you're using UEFI boot, the correct grub.cfg should be somewhere under /boot/efi.

alick gravatar imagealick ( 2016-05-11 15:26:41 -0500 )edit
1

answered 2016-05-10 13:49:41 -0500

sergiomb gravatar image

updated 2016-05-21 17:46:04 -0500

since they split kernel in a bunch of sub-packages is advised use "kernel*" with quotes for example:

dnf --enablerepo=updates-testing update "kernel*"

usually the problem , is grub that always update to the new kernel , look at https://fedoraproject.org/wiki/GRUB_2... , I try to see if you got some variables that make it use always the same entry ...

Please check /etc/sysconfig/kernel I got:

# UPDATEDEFAULT specifies if new-kernel-pkg should make
# new kernels the default
UPDATEDEFAULT=yes

# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL=kernel
edit flag offensive delete link more

Comments

As grub isn't picking up the new kernels, this doesn't fix the problem for me I'm afraid...

djcf gravatar imagedjcf ( 2016-05-11 05:21:51 -0500 )edit
0

answered 2016-05-13 13:48:43 -0500

Can you post a screenshot of your grub boot screen. I have seen this happen when the grub.cfg file as all the kernels listed but they may be out of order and booting off of an older kernel instead of the latest one. So if possible post a screenshot of your grub boot screen.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-05-10 09:51:30 -0500

Seen: 2,093 times

Last updated: May 21 '16