Visit Jeremy's Blog.
Go Back > Blogs > hydrurga
User Name


Rate this Entry

Manage your software sources in Debian, Ubuntu and Mint

Posted 05-23-2019 at 07:36 AM by hydrurga
Updated 05-23-2019 at 11:15 AM by hydrurga

The following information concentrates on the latest long-term versions of Debian, Ubuntu and Mint, namely Debian 9 (Stretch), Ubuntu 18.04 (Bionic) and Mint 19.x (Tara, Tessa, Tina, ...), but should be applicable, with modifications, to any Debian-derived distro.

Note that the instructions don't cover the addition or deletion of repositories to/from your software sources. It is intended rather as a diagnostic tool when apt update is generating errors that appear to relate to an incorrect software source setup.

A distro's software sources consist of files that specify the location of the repositories that it will use to obtain its packages. The distro usually keeps its main software sources in /etc/apt/sources.list while other software sources (third-party software etc.) are kept in .list files in the /etc/apt/sources.list.d directory. Mint differs in that its main software sources are kept in /etc/apt/sources.list.d/official-package-repositories.list.

One practice that is important is to not mix distro versions in your software sources. This can lead to what Debian users, for example, call a FrankenDebian. This can cause significant problems in your system and may even necessitate a re-install if the situation is too far advanced. So, for example, if you're a Debian user, don't mix Stretch and Jessie or Sid; if you're an Ubuntu user, don't mix Bionic and Xenial; if you're a Mint user, don't mix tessa and Xenial.

Listing your software sources
You can obtain a list of your software sources by running

inxi -r
If you don't have the system info tool inxi installed, then it can be installed from the repositories or downloaded from here.

As an alternative, if for some reason you can't install or run inxi, use the following command:

for i in /etc/apt/sources.list{,.d/*}; do echo file: $i; cat $i; echo ====; done
Note that some lines start with deb-src rather than deb - these lines indicate where your distro will obtain the source code for packages, rather than the usual binaries. Also, any line can be commented out by placing a # at the start of the line. For example, if you don't want to download any source code at all then you can comment out all the deb-src lines. Duplicate lines will be ignored, but it best to delete these where possible.

Editing your software sources
You can modify your software sources by either editing them directly (as root) or using a GUI program available in your distro.

For example (assuming you use sudo to gain root privileges; replace gedit or xed with your favourite test editor),

(Debian/Ubuntu) sudo gedit /etc/apt/sources.list

(Mint) sudo xed /etc/apt/sources.list.d/official-package-repositories.list
In Ubuntu, you can use the Software & Updates program to edit your repositories. In Mint, you can use Software Sources. In all three distros, you can use Synaptic.

Main software sources - Debian (reference)

For Debian Stretch, /etc/apt/sources.list should look like this (miss out the contrib and non-free keywords if you don't want those repositories):

deb stretch main contrib non-free
deb-src stretch main contrib non-free

deb stretch/updates main contrib non-free
deb-src stretch/updates main contrib non-free

deb stretch-updates main contrib non-free
deb-src stretch-updates main contrib non-free
In addition, if you need to use the backports repository, add:

deb stretch-backports main contrib non-free
deb-src stretch-backports main contrib non-free
Main software sources - Ubuntu

In Ubuntu, /etc/apt/sources.list comes in a more cluttered form than the Debian equivalent. However, for Ubuntu 18.04 (Bionic), the key elements it contains should be the following (miss out the universe and multiverse keywords if you don't want those repositories):

deb bionic main restricted universe multiverse
deb-src bionic main restricted universe multiverse

deb bionic-updates main restricted universe multiverse
deb-src bionic-updates main restricted universe multiverse

deb bionic-backports main restricted universe multiverse
deb-src bionic-backports main restricted universe multiverse

deb bionic-security main restricted universe multiverse
deb-src bionic-security main restricted universe multiverse

deb bionic partner
deb-src bionic partner
Main software sources - Mint

For Mint, /etc/apt/sources.list.d/official-package-repositories.list should be as follows (deb-src lines have been left out for simplicity; replace tessa (Mint 19.1) with the codename of your version of Mint 19.x):

deb tessa main upstream import backport 
deb bionic main restricted universe multiverse
deb bionic-updates main restricted universe multiverse
deb bionic-backports main restricted universe multiverse
deb bionic-security main restricted universe multiverse
deb bionic partner
Other software sources

Additional third-party repositories (including Ubuntu's Personal Package Archives (PPAs)) can be added to your software sources by different means. It is important to remember only to add such repositories if they apply to the version of your distro (for Mint 19.x users, you can also include Ubuntu Bionic repositories). Do not mix Debian and Ubuntu repositories. Ubuntu PPAs can cause problems if installed in Debian and doing so is not advised.

Following are some examples of third-party repositories (deb-src lines have been missed out to keep things simple):

Chrome (/etc/apt/sources.list.d/google-chrome.list)
deb [arch=amd64] stable main
Etcher (/etc/apt/sources.list.d/balena-etcher.list)
deb stable etcher
Git (/etc/apt/sources.list.d/git-core-ppa-bionic.list)
deb bionic main
Skype (/etc/apt/sources.list.d/skype-stable.list)
deb [arch=amd64] stable main
VirtualBox (/etc/apt/sources.list.d/
deb [arch=amd64] bionic contrib
Wine (/etc/apt/sources.list.d/additional-repositories.list )
deb bionic main
Please provide any feedback on these instructions in the comments so that they can be improved if necessary.
Posted in Uncategorized
Views 2762 Comments 4
« Prev     Main     Next »
Total Comments 4


  1. Old Comment
    Nice work hydrurga!

    Not that I use either of those distros myself, but some very useful info there!

    I was actually thinking of creating a post (not a blog) about common yum problems, people mixing different versions of repo's for CentOS. Like having repo's for CentOS 6 in yum's repolist on CentOS 7 and similar.

    I was going to post a question in LQ S&F forum about if it would be a good idea to create a sticky advising people about yum's repolist, along with some common problems (chief among them mixing the wrong repo's and alike), and how to check to see what the problem could be, then how to fix it. As at least some of what you've said here could also apply to yum and such too. But I've been too lazy to ask...

    Nice work again tho!
    Posted 05-23-2019 at 08:51 AM by jsbjsb001 jsbjsb001 is offline
  2. Old Comment
    Thanks, jsbjsb001! I'd been meaning to create a couple of extra blog posts for a while but hadn't got around to it. I'm glad I did now.

    You should create that post - it could prove very useful for users of CentOS. A sticky in the CentOS distribution sub-forum sounds like a good plan!
    Posted 05-23-2019 at 11:18 AM by hydrurga hydrurga is offline
  3. Old Comment
    I wish this had been around when I was learning Debian.
    Posted 05-23-2019 at 01:05 PM by Lysander666 Lysander666 is offline
  4. Old Comment
    Better late than never.
    Posted 05-23-2019 at 06:27 PM by hydrurga hydrurga is offline


All times are GMT -5. The time now is 10:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration