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

14,223

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

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

Solution 3

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.

Share:
14,223

Related videos on Youtube

nutty about natty
Author by

nutty about natty

Updated on September 18, 2022

Comments

  • nutty about natty
    nutty about natty over 1 year
    • Are Linux Headers installed by default?
    • How to check - via command line - if they're installed?

    (in Ubuntu and Lubuntu 14.xx)

    • askb
      askb almost 10 years
      IMO - Kernel headers are not required by default, unless its required to rebuild the kernel module or the kernel or for debugging.
  • nutty about natty
    nutty about natty almost 10 years
    don't like for two reasons: 1) using a sudo command when most probably can be avoided (after all, don't actually want to install anything) 2) "installing" only to check if installed may be effective but not elegant.