get kernel source code

I need a specific kernel version to compile it with some additional modules.

When I typing:

uname -r

I get


I need this one.

 uname -a
 Linux "..." 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Where can I find this version? Here seems that there isn’t..

Asked By: Luca Davanzo


You could just use apt to get the source,
check that the file /etc/apt/sources.list contains a line starting with


and then use the command:

apt-get update
#if you want to download the source into the current directory use:
apt-get source linux-image-$(uname -r)
#if you want the source to be installed in the system directory use:
apt-get install linux-source-$(uname -r)

It will download the source in the folder:

/usr/src or /usr/sources
Answered By: Kiwy
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.