5

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?
Ratler
  • 578

3 Answers3

4

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.

muru
  • 207,228
0

The easiest solution is to install the missing packages:

$ sudo apt install linux-headers-generic linux-headers-4.13.0-43-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-4.13.0-43-generic is already the newest version (4.13.0-43.48~16.04.1).
linux-headers-generic is already the newest version (4.4.0.127.133).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

My system already has installed what yours is missing. Why they're missing I can't say.

Notice for linux-headers-generic the most current version is indeed 4.4.0.127.133. Although Linux Kernel 4.4 came out in 2015 it is an LTS (Long Term Support) kernel for 5 or 6 years (can't remember exactly) and it is currently on update number 127. So the update number will eventually grow to 300 or so.

No matter how you look at it, you need to just bite the bullet and install the missing headers using:

sudo apt install linux-headers-generic linux-headers-4.13.0-43-generic

June 11, 2018 update.

4.4.0.127.133 is no longer the latest header version. I ran sudo apt upgrade and then later ran sudo apt autoremove. I received some error messages as schizophrenic software removed 127 and told me to add 127 headers to fix the problem:

Removing linux-image-extra-4.4.0-127-generic (4.4.0-127.153) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
dkms: WARNING: Linux headers are missing, which may explain the above failures.
      please install the linux-headers-4.4.0-127-generic package to fix this.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-127-generic
Adding /lib/firmware/i915/skl_guc_ver9_33.bin
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic

There is no real problem though and as of June 11, 2018 the latest linux-headers-generic version is: 4.4.0.128.134.

0

My colleague was using 18.10 and 4.18.0.17 kernel. sudo apt-get install the corresponding linux-headers from official says package not found.

I finally found and downloaded the specific files from packages.ubuntu.com:

http://mirrors.kernel.org/ubuntu/pool/main/l/linux-hwe/linux-headers-4.18.0-17_4.18.0-17.18~18.04.1_all.deb
http://mirrors.kernel.org/ubuntu/pool/main/l/linux-hwe/linux-headers-4.18.0-17-generic_4.18.0-17.18~18.04.1_amd64.deb

Once you have the header files installed. apt-get purge then apt-get install the virtualbox package should work.

clarkttfu
  • 101