Fix You must put some ‘deb-src’ URIs in your sources.list Error

When working with package management systems like apt or apt-get on Debian-based Linux distributions, you may encounter various errors.

One common error is the “E: You must put some ‘deb-src’ URIs in your sources.list” message, which occurs when attempting to use the source package repositories but missing the necessary configurations.

Understanding the Error

The “E: You must put some ‘deb-src’ URIs in your sources.list” error occurs when the apt-get command is unable to locate the source package repositories specified in the system’s sources.list file.

Source packages contain the source code used to build the binary packages available for installation. Enabling the source repositories allows users to fetch the source code of packages for inspection, modification, or recompilation.

E: You must put some 'deb-src' URIs in your sources.list"
E: You must put some ‘deb-src’ URIs in your sources.list”

Fixing E: You must put some ‘deb-src’ URIs in your sources.list

In this article, we will delve into the cause of this error and explore the steps to resolve it in the Ubuntu system via command line and desktop.

Using Ubuntu Command Line

To resolve the “E: You must put some ‘deb-src’ URIs in your sources.list” error, you can follow these steps:

1. First, open the sources.list file located in the /etc/apt/ directory using a nano text editor.

$ sudo nano /etc/apt/sources.list

Next, in the sources.list file, you will see lines that begin with "deb" and "deb-src" followed by a repository URL. The "deb" lines represent the binary package repositories, while the "deb-src" lines are used for source packages.

Ubuntu Sources List File
Ubuntu Sources List File

Locate the "deb-src" lines and ensure that they are not commented out (not preceded by a '#' symbol). If they are commented, remove the '#' symbol to uncomment them.

deb-src http://in.archive.ubuntu.com/ubuntu lunar main restricted
Enable deb-src Source
Enable deb-src Source

After adding or uncommenting the "deb-src" lines, save the changes to the sources.list file by pressing Ctrl + O, followed by Enter, and then exit the text editor by pressing Ctrl + X.

Now, update the package lists using the following command:

$ sudo apt-get update

This command will refresh the repository information, including the newly added source package repositories.

You can now retry the previous apt-get command that resulted in the error.

The “E: You must put some ‘deb-src’ URIs in your sources.list” error should no longer occur, and you can proceed with your desired package management task.

$ sudo apt-get source vsftpd
Downloading Package Source Code
Downloading Package Source Code

Using Ubuntu Desktop

To enable the Source Code repository in Ubuntu Desktop, you can follow these steps:

Open the “Software & Updates” application and navigate to the “Ubuntu Software” tab and enable the “Source code” option as shown.

Enable Source Code Repository in Ubuntu
Enable Source Code Repository in Ubuntu

When you close the “Software & Updates” window, Ubuntu will automatically refresh the package information to include the source code repositories.

Conclusion

The “E: You must put some ‘deb-src’ URIs in your sources.list” error can be resolved by adding or uncommenting the "deb-src" lines in the sources.list file and updating the package lists.

By enabling the source package repositories, you gain access to the source code of packages, enabling further exploration and customization. With the steps outlined in this article, you can overcome this error and continue effectively managing packages on your Debian-based Linux system.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.