Ubuntu – Linux kernel header files to match the current kernel

kernel

I've seen a few questions about linux-headers packages but couldn't find anything to address my specific issue.

I'm on Kubuntu 16.04, and I got the following error (from VirtualBox):

Please install the Linux kernel "header" files matching the current kernel for adding new hardware support to the system. The distribution packages containing the headers are probably:

linux-headers-generic linux-headers-4.13.0-43-generic

I was surprised to see that linux-headers-generic was not installed, although I'm not really sure if it's supposed to be there by default.

In any case, while the kernel is 4.13.0-43-generic, the corresponding headers are, indeed, not installed:

$ uname -r
4.13.0-43-generic

$ aptitude search  linux-headers | grep  ^i
id  linux-headers-4.13.0-32         - Header files related to Linux kernel versi
id  linux-headers-4.13.0-32-generic - Linux kernel headers for version 4.13.0 on
i A linux-headers-4.13.0-37         - Header files related to Linux kernel versi
i A linux-headers-4.13.0-37-generic - Linux kernel headers for version 4.13.0 on
i A linux-headers-4.13.0-38         - Header files related to Linux kernel versi
i A linux-headers-4.13.0-38-generic - Linux kernel headers for version 4.13.0 on
i A linux-headers-4.13.0-39         - Header files related to Linux kernel versi
i A linux-headers-4.13.0-39-generic - Linux kernel headers for version 4.13.0 on

The linux-headers-generic "will always depend on the latest generic kernel headers available", so I thought that installing it would install the latest packages (in this case, linux-headers-4.13.0-43-generic as required by VirtualBox) and keep them up to date.

However, if I try that, I'm asked to install what appear to be really old packages:

$ sudo aptitude install linux-headers-generic
The following NEW packages will be installed:
linux-headers-4.4.0-127{a} linux-headers-4.4.0-127-generic{a} linux-headers-generic 
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.8 MB of archives. After unpacking 78.4 MB will be used.

There's also a package called linux-headers-generic-lts-xenial, but it does, more or less, the same thing.

So, my questions:

  • Should either of the linux-headers-generic packages have been there by default? Which one?
  • Do I need to install either of them in my case?
  • If I install the necessary linux-headers-4.13.0-43-generic package directly, what happens when the kernel is upgraded?

Best Answer

Should either of the linux-headers-generic packages have been there by default? Which one?

No. Neither.

Do I need to install either of them in my case?

From the kernel versions, it looks like you are using the (HWE) kernel. So you should install the headers for those: linux-headers-generic-hwe-16.04, the meta-package that should depend on the correct header package for your HWE kernel (4.13).

If I install the necessary linux-headers-4.13.0-43-generic package directly, what happens when the kernel is upgraded?

You'd have to again manually install the relevant headers. It's better to use linux-headers-generic-hwe-16.04.

Related Question