How to install Linux Kernel Headers?

Viewed 1290

I have a fresh install of Ubuntu 18. I'm trying to install third party software that requires the Linux Kernel Headers. I did so with "apt -y install linux-headers-generic" and there were no error messages. However, when I try to install the third party software, it complains:

Error! Your kernel headers for kernel 4.4.0-210-generic cannot be found.
Please install the linux-headers-4.4.0-210-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located

"4.4.0-210-generic" does appear to be the kernel version (that's what "uname -a" shows). But "apt list" does not show anything with "4.4.0-210" in it. How can I install the correct headers?

1 Answers

The linux-headers-generic will install the linux-headers-4.15.0-162-generic as dependency but not the 4.4.0-210-generic.

Use;

sudo apt install linux-headers-4.4.0-210-generic

or

sudo apt install linux-headers-$(uname -r)
Related