5

After upgrading to 15.04, I need to have kernel headers matching the running kernel (for another package).

The upgrade installed kernel 3.19.0-17. Just in case, I also installed linux-headers-generic. Then, I ran sudo update-grub and rebooted. Yet, the system booted into kernel 3.16.0-31 (as confirmed by uname -r).

After much digging, I found that GrUB recognizes the 3.19 kernel in update-grub and even populates it into /boot/grub/menu.lst. However, on startup, GrUB only recognizes up to the 3.16 kernel in the boot menu. How do I fix this, so that GrUB can boot into 3.19?


Here are some outputs from my current system.

sudo update-grub always produces the following output:

$ sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-3.19.0-17-generic
Found kernel: /boot/vmlinuz-3.16.0-31-generic
Found kernel: /boot/vmlinuz-3.13.0-40-generic
Found kernel: /boot/vmlinuz-3.11.0-19-generic
Found kernel: /boot/vmlinuz-3.8.0-35-generic
Found kernel: /boot/memtest86+.bin
Found kernel: /boot/vmlinuz-3.19.0-17-generic
Found kernel: /boot/vmlinuz-3.16.0-31-generic
Found kernel: /boot/vmlinuz-3.13.0-40-generic
Found kernel: /boot/vmlinuz-3.11.0-19-generic
Found kernel: /boot/vmlinuz-3.8.0-35-generic
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

Opening /boot/grub/menu.lst after running update-grub, the very first option is:

title        Ubuntu 15.04, kernel 3.19.0-17-generic
uuid        ac9d0eaf-e090-4c29-8e7b-30e98ed07d29
kernel        /boot/vmlinuz-3.19.0-17-generic root=UUID=ac9d0eaf-e090-4c29-8e7b-30e98ed07d29 ro quiet splash
initrd        /boot/initrd.img-3.19.0-17-generic

But, holding Shift during boot, there is no option to choose 3.19 (although I can choose any of the others). After startup, uname -r confirms it booted into 3.16:

$ uname -r
3.16.0-31-generic

Output cropped from a dpkg -l, showing that the 3.19 kernel is indeed installed:

ii  linux-headers-3.19.0-17                              3.19.0-17.17                               all          Header files related to Linux kernel version 3.19.0
ii  linux-headers-3.19.0-17-generic                      3.19.0-17.17                               amd64        Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii  linux-headers-generic                                3.19.0.17.16                               amd64        Generic Linux kernel headers

I have also tried purge/reinstalling grub and the headers, and some other things that amounted to no consequence.

muru
  • 193,181
  • 53
  • 473
  • 722
geometrian
  • 225
  • 3
  • 9
  • For grub, the `linux-image-*` packages are more important than the `linux-headers-*` packages. – saiarcot895 May 15 '15 at 11:41
  • On my system, I don't have a `/boot/grub/menu.lst`, but instead have a `/boot/grub/grub.cfg`, which seems to get updated instead. The man page for `update-grub` suggests that it calls `grub-mkconfig`, telling it to output the data to `/boot/grub/grub.cfg`. Do you have a file named `/boot/grub/grub.cfg`, and does it not have the newer kernel? – saiarcot895 May 15 '15 at 11:47
  • @saiarcot895 `linux-image-3.19.0-17-generic` is also present in the `dpkg` listing. I do have a `grub.cfg` file, and it indeed lacks the 3.19 record. – geometrian May 15 '15 at 14:26
  • Try removing (make sure you have a back-up) `/boot/grub/menu.lst` and `/boot/grub/default` (if the latter exists) and run `update-grub` again. Check to see if `/boot/grub/grub.cfg` now contains the 3.19 record. – saiarcot895 May 15 '15 at 14:57
  • @saiarcot895 [done](http://pastebin.com/iLCheYCn). It does not. – geometrian May 15 '15 at 20:55
  • Can you verify that you have `grub2-common` installed? (Run `sudo apt-get install grub2-common` if you're not sure.) – saiarcot895 May 15 '15 at 21:06
  • @saiarcot895 I do not have it installed. As tagged above, the GrUB version is 0.97. Do you think should upgrade to GrUB 2? – geometrian May 15 '15 at 21:10
  • Yes. That's probably why you're having that problem. – saiarcot895 May 15 '15 at 21:11
  • @saiarcot895 after installing GrUB 2, redoing your (n-2)nd comment, and then rebooting, it boots into 3.19. If you repost the above and also explain what 0.97's problem was, that sounds like an answer! – geometrian May 15 '15 at 21:17

1 Answers1

4

The older version of GRUB (0.9.7) likely used menu.lst to determine what to display, while the newer version of GRUB (GRUB 2) uses grub.cfg instead. It looks like you have some mix of GRUB and GRUB 2 installed.

Using update-grub from the grub package will update the menu.lst file, which will effectively do nothing if the bootloader is GRUB 2, which is what is happening here. Instead, you should install grub2-common (which should uninstall the grub package). Then, when running update-grub (or update-grub2; both do the same thing), the grub.cfg file gets updated instead.

Answer based on this answer.

saiarcot895
  • 10,727
  • 2
  • 35
  • 39