Are Linux Headers installed by default? How to check if they're installed?

Solution 1:

The linux headers are installed by default (See the 14.04 manifest file for example)

The linux-headers-generic package will always depend on the latest generic kernel headers available.

To check the current version, open a Terminal and type:

$ dpkg-query -s linux-headers-generic
Package: linux-headers-generic
Status: install ok installed
Priority: optional
Section: kernel
Installed-Size: 33
Maintainer: Ubuntu Kernel Team <[email protected]>
Architecture: amd64
Source: linux-meta
Version: 3.11.0.20.21
Depends: linux-headers-3.11.0-20-generic
Description: Generic Linux kernel headers
 This package will always depend on the latest generic kernel headers
 available.

Solution 2:

You can just open up the Software Center or Synaptic and make sure the package "linux-headers-generic" is installed. That package is marked to depend on the headers for the latest available kernel version, so it will pull in another package or two for your particular kernel version.

Edit: You can also just open a command line and run:

sudo apt-get install linux-headers-generic

If it's already installed then it'll say so, and if not it'll ask you to verify you want to install the package.

Solution 3:

Kind of late, but I found this question with no interesting answer so here is the real way to do it so you know WITHOUT installing, which I think was what you wanted to begin with :

apt list linux-headers*

Output is going to be a linux-headers list with some with [installed] specified, such as this :

linux-headers-5.10.0-kali9-amd64/kali-rolling,now 5.10.46-4kali1 amd64 [installed]
linux-headers-5.10.0-kali9-cloud-amd64/kali-rolling 5.10.46-4kali1 amd64
linux-headers-5.10.0-kali9-common-rt/kali-rolling 5.10.46-4kali1 all
linux-headers-5.10.0-kali9-common/kali-rolling,now 5.10.46-4kali1 all [installed,automatic]
linux-headers-5.10.0-kali9-rt-amd64/kali-rolling 5.10.46-4kali1 amd64
linux-headers-amd64/kali-rolling,now 5.10.46-4kali1 amd64 [installed]
linux-headers-cloud-amd64/kali-rolling 5.10.46-4kali1 amd64
linux-headers-rt-amd64/kali-rolling 5.10.46-4kali1 amd64here