By default apt-get install
does not download the source codes of packages. There is a specific apt-get
option to do that which is source
.
From man apt-get
:
source source causes apt-get to fetch source packages. APT will examine the available packages to decide which source package to fetch. It will then find and download into the current directory the newest available version of that source package while respecting the default release, set with the option APT::Default-Release, the -t option or per package with the pkg/release syntax, if possible.
Source packages are tracked separately from binary packages via deb-src lines in the sources.list(5) file. This means that you will need to add such a line for each repository you want to get sources from; otherwise you will probably get either the wrong (too old/too new) source versions or none at all.
So the syntax to download the source package of something to the current directory would be (no need to be root
):
apt-get source <package_name>
Also note that as the man
pages says you need to have the deb-src
repositories enabled for all the regular deb
repositories you want to keep track of source packages. The simplest way to do that would be to just add -src
to the original repo's initial deb
string:
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted
On a different note, you might have checked the /usr/src
directory which is the designated place for all kernel sources.