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?

3 Answers 3

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.

3
  • 1
    Based on things I've come across before, I'm sure you're right, but I'm curious: how can you tell I'm on an HWE kernel? Is it the "13" in 4.13? I was assuming 4.13 was simply what came after several versions of 4.4.
    – Ratler
    Jun 11, 2018 at 20:15
  • Btw, this worked! By re-installing linux-headers-generic-hwe-16.04, the latest version was installed and VirtualBox now works. What had happened was that, in the process of trying to fix a corrupted update, I removed the meta-package but never put it back (luckily, I keep good logs of what I'm doing).
    – Ratler
    Jun 11, 2018 at 20:40
  • 1
    @Ratler yes, it's the 13. There are two options with 16.04: stay on the 4.4 kernel with which 16.04 was released (will be supported throughout), or use the HWE kernels, which get upgraded as new Ubuntu releases are made (4.8, 4.10, 4.13, so far, IIRC). The linux-{header,image}-generic packages are for the 4.4 one, and the -hwe-16.04 are for the HWE kernels. See wiki.ubuntu.com/Kernel/RollingLTSEnablementStack, wiki.ubuntu.com/Kernel/LTSEnablementStack
    – muru
    Jun 12, 2018 at 1:34
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.

4
  • As it turns out (see muru's answer), the correct meta-package in my case is linux-headers-generic-hwe-16.04 (it was missing because I accidentally removed it). I believe the command you suggest would only solve the problem temporarily: if the kernel was updated (4.13.0-44 etc.) in the future, I'd probably have the same problem.
    – Ratler
    Jun 11, 2018 at 20:36
  • Except it didn't happen for 37, 38, & 39. Either way I'll delete my answer when I get on a computer tonight. Jun 11, 2018 at 20:38
  • I removed the meta-package when I was at version 4.13.0-39, which is why the header files got stuck to that version. Your answer is not correct, but in the context of the accepted answer and the comments, it might still contribute to a better understanding of the issue (it did for me), so I'd consider leaving it. Since it's been down-voted already, I'll give you an upvote in case you're worried about your reputation. But of course, it's up to you if you want to completely remove it.
    – Ratler
    Jun 11, 2018 at 20:50
  • Its your question and you're knowledgeable. I'll leave it be. Jun 11, 2018 at 21:41
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .