2

My /etc/apt/sources.list was growing over time and now contains 100 lines (including /etc/apt/sources.list.d). I clearly have duplicate entries, which apt doesn't recognise. To give an obvious, but fictitious example:

deb http://ftp.am.debian.org/debian buster main contrib
deb http://ftp.au.debian.org/debian buster main contrib

I'd like to include all the reliable packages available for Debian (ignoring inofficial packages, the mess in my sources.list would just increase with these…) while keeping my sources.list as short as possible.

I also don't want to start all over again (e. g. with an example sources.list) because I already put too much effort in. Sorting them out by hand (e. g. commenting out one-by-one and removing the entries without a change in the number of available packages) is really not favourable because of the amount of entries.

As a next step, including "semi-official" or inofficial packages to /etc/apt/sources.list.d would be favourable.

Needless to say, I'd like to choose a stable, officially listed mirror nearby including all packages for my pc's architecture.

If possible, I'd also like to have as little different domains as possible for increasing clarity in my sources.list files.

1
  • It may be a tool or some guideline with which I don't have to uncomment every entry, apt[itude] update, compare the number of available packages and then leave or remove the watched entry. There's also the confusion that deb http://security.debian.org buster/updates main contrib and deb http://deb.debian.org/debian-security buster/updates main contrib give the feeling being the same… How to be sure I haven't included packages multiple times (from different mirrors)?
    – Nepumuk
    Aug 22, 2019 at 15:02

1 Answer 1

2

The simplest way to weed out duplicates, without resorting to trial-and-error, is to look at the output of apt policy. For each accessible repository (and suite, and architecture), apt policy will show the repository descriptor; you should try to end up with only one of each.

For example, with the repositories you list in your question, apt policy will show something like

 500 http://ftp.am.debian.org/debian buster/main amd64 Packages
     release v=10.0,o=Debian,a=stable,n=buster,l=Debian,c=main,b=amd64
     origin ftp.am.debian.org
 500 http://ftp.au.debian.org/debian buster/main amd64 Packages
     release v=10.0,o=Debian,a=stable,n=buster,l=Debian,c=main,b=amd64
     origin ftp.au.debian.org
 500 http://ftp.am.debian.org/debian buster/contrib amd64 Packages
     release v=10.0,o=Debian,a=stable,n=buster,l=Debian,c=contrib,b=amd64
     origin ftp.am.debian.org
 500 http://ftp.au.debian.org/debian buster/contrib amd64 Packages
     release v=10.0,o=Debian,a=stable,n=buster,l=Debian,c=contrib,b=amd64
     origin ftp.au.debian.org

The second line of each entry is the one which needs to be de-duplicated; in the example above

     release v=10.0,o=Debian,a=stable,n=buster,l=Debian,c=main,b=amd64

and

     release v=10.0,o=Debian,a=stable,n=buster,l=Debian,c=contrib,b=amd64

The simplest option when choosing which entry to keep is to have one deb.debian.org entry (that will use a redirection to give you a close mirror every time).

1
  • It seems to have worked.
    – Nepumuk
    Aug 22, 2019 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .