Linux - How do I tell if I have my kernel sources installed?

Answer ID 171
Published 11/30/2004 08:03 AM
Updated 02/25/2008 10:48 AM

How do I tell if I have my kernel sources installed?

If you are running on a distro that uses RPM (Red Hat, Mandrake, SuSE,
etc), then you can use RPM to tell you.  At a shell prompt, type:

 `rpm -qa | grep kernel`

and look at the output.  You should see a package that corresponds
to your kernel (often named something like kernel-2.4.18-3)
and a kernel source package with the same version (often named
something like kernel-source-2.4.18-3).  If none of the lines seem
to correspond to a source package, then you will probably need to
install it.  If the versions listed mismatch (ex: kernel-2.4.18-10 vs.
kernel-source-2.4.18-3), then you will need to update the kernel-source
package to match the installed kernel.  If you have multiple kernels
installed, you need to install the kernel-source package that
corresponds to your *running* kernel (or make sure your installed
source package matches the running kernel).  You can do this by
looking at the output of 'uname -r' and matching versions.

Was this answer helpful?
Your rating has been submitted, please tell us how we can make this answer more useful.


Chat online with one of our support agents



Contact Support for assistance