How to fix apt-get source You must put some 'source' URIs in your sources.list
Problem:
You want to download an apt source package using
apt-get source <package name>
but instead you see this error message:
E: You must put some 'source' URIs in your sources.list
Solution
In most cases, you can fix this easily using
sudo apt-get update
If this does not fix the issue, edit /etc/apt/sources.list
, e.g. using
sudo nano /etc/apt/sources.list
and ensure that the deb-src
lines are not commented out.
Example: You need to change
deb http://archive.ubuntu.com/ubuntu artful main restricted
# deb-src http://archive.ubuntu.com/ubuntu artful main restricted
to
deb http://archive.ubuntu.com/ubuntu artful main restricted
deb-src http://archive.ubuntu.com/ubuntu artful main restricted
and run sudo apt update
after changing the file.
If there are repositories without a deb-src
line, you can often try to copy the deb
line - for example, from
deb http://myserver.com/deb focal main
you can create an additional line
deb-src http://myserver.com/deb focal main
by changing deb
to deb-src
and running sudo apt update
afterwards. This often works, but it depends on the repository.