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.
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-src" followed by a repository URL. The
"deb" lines represent the binary package repositories, while the
"deb-src" lines are used for source packages.
"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
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
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.
When you close the “Software & Updates” window, Ubuntu will automatically refresh the package information to include the source code repositories.
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.