How do I install kernel header files?
You should be able to install the kernel header files for the currently running kernel by running the following in a terminal:
sudo apt-get install linux-headers-$(uname -r)
In general, the kernel header packages are named linux-header-* where "*" indicates the version & variant (generic, server, etc.).
You can just type:
sudo apt-get install linux-headers-generic
if you are on a Desktop installation. The apt-get will solve the dependencies and install the correct version of kernel headers.
This should cover another problem when: the running kernel is obsolete, meaning it's not in the repository anymore neither its headers. So the best thing to do is to update the kernel to last version in the repository.
linux-generic
is a meta package to keep current version of the kernel & its headers:
sudo apt-get update
sudo apt-get install linux-generic
Note: Depending on your Ubuntu edition, See if you need linux-lowlatency
(Ubuntu Studio), linux-signed-generic
or linux-virtual
.