Search notes:

/etc/apt/sources.list

sources.list specifies the locations which are used to resynchronize the package index files with apt-get update, i. e. it contains the locations of apt repositories to fetch packages from.

Format

There are two formats for /etc/apt/sources.list and /etc/apt/sources.list.d/:

One-line format

Each line defines one data source and contains at least 4 fields:
  • Package format: The pacakge format is either deb (binary package) or deb-src (source package)
  • Root URL of the archive
  • Distribution name (either the suite name (stable, testing …) or code name bullseye, bookworm …j)
  • The 4th and remaining fields is a list of valid archive area names in the archive
Thus, the one-line format for sources.list looks like
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://security.debian.org/debian-security bullseye-security main
deb http://ftp.debian.org/debian bullseye-backports main
The extentsion for files in this format must be .list.

Deb822 format

In the Deb822 format, data sources are specified in blocks which are separated by a blank line. The first line of the one-line format above would be represented in the following four lines in the Deb822 format:
Types: deb
URIs: http://deb.debian.org/debian
Suites: bullseye
Components: main
The # character at the start of a line comments it out.
An entire entry can be disable by adding adding Enabled: no.
The extentsion for files in this format must be .sources.
Additionally, only the following characters are allowed in the filename:
  • Letters (a - z, A - Z)
  • Digits (0 - 9)
  • Period (.)
  • Underscore (_)
  • Hyphen (-)
More information is in the deb822 man page.

Editing /etc/apt/sources.list

In order to add or remove repostiories, /etc/apt/sources.list or files in the directory /etc/apt/sources.list.d need to be edited.

apt edit-sources

apt edit-sources edits /etc/apt/sources.list in the preferred editor.

APT package software-properties-common

The apt package software-properties-common installs Python scripts for adding and removing PPAs:
$  apt-file show software-properties-common | grep -P -o '\S+/bin/\S+'
/usr/bin/add-apt-repository
/usr/bin/apt-add-repository
These scripts can be installed with
$ sudo apt install -y software-properties-common

See also

The /etc/apt directory
apt upgrade
man 5 sources.list
/var/lib/apt/lists is the storage area for state information for each package resource specified in sources.list
apt-config dump | grep Dir::Etc::source

Index