Here we provide a reference repository source list for Debian, together with a preference file to set priorities. An excellent reference in the Debian Administrator's Handbook.
Contents
It is convenient to list all the repositories from the Stable, Testing and Unstable release of Debian. This allows downgrading packages in the case a new version contains bugs or, on the other hand, upgrading to a newer version available only in a less stable release.
This is the content of /etc/apt/sources.list:
# Unstable deb http://ftp.debian.org/debian/ unstable main deb-src http://ftp.debian.org/debian/ unstable main # Stretch (Testing) # Priority is given to Stretch in /etc/apt/preferences deb http://ftp.debian.org/debian/ stretch main deb-src http://ftp.debian.org/debian/ stretch main # Jessie (Stable) deb http://ftp.debian.org/debian/ jessie main deb-src http://ftp.debian.org/debian/ jessie main # Security deb http://security.debian.org/ stretch/updates main deb http://security.debian.org/ jessie/updates main deb-src http://security.debian.org/ stretch/updates main deb-src http://security.debian.org/ jessie/updates main
Below we will set Stretch (Testing) as the main source. As indicated, the present Testing release code name is Stretch, and the present Stable release is Jessie. It is possible in principle to replace all the stretch entries by testing (similarly for stable). In that case, we would fetch the packages always from Testing. In fact, after the next major release Stretch will become the Stable release, and a new one will become Testing. During a new release, the Testing distribution may initially be still relatively unstable. Hence, by passing the specific code name we ensure that we will always fetch repositories from Stretch. The upgrade to the next release will be performed only adapting by hand the entries in /etc/apt/sources.list.
The Debian project also hosts contrib and non-free repositories, even though these are not officially part of Debian. The non-free repositories violate fundamental users' freedoms and are incompatible with a libre operating system. The contrib repositories are themselves libre software, but depend on non-libre programs. Unfortunately, some hardware (especially wi-fi and GPU cards) do not provide libre firmwares. Inverse engineering can be applied to provide libre alternatives, but it is a difficult process. In the lack of such alternative, free-hardware adapters (such as usb wi-fi adapters) are available.
These considerations does not apply to all the packages from the contrib and non-free sources, which creates confusion. For example, the GNU Emacs manual does not satisfies Debian requirements for free documentation and it is available under the non-free repositories. While works for practical purposes should be free, it seems reasonable to limit derivative works based on points of view, such as the GNU Manifesto included as invariant section (allowed by the Gnu Free Documentation License) into the otherwise free Emacs manual. Hence, care should be taken when dealing with repositories other than main.
Here we set the preferences such that only the Stretch (Testing) repositories will be automatically installed. This can be done by modifying /etc/apt/preferences:
Explanation: set stretch as primary repository Package: * Pin: release n=stretch Pin-Priority: 900 Explanation: limit the scope of previous setting only to packages from debian Package: * Pin: release o=Debian Pin-Priority: -10
For information about the priority levels see man 5 apt_preferences (section How APT Interprets Priorities), where other pin options are also specified. With this configuration, packages from Stretch (Testing) have priority over other Debian releases. To install a package from a different release, it is necessary to specify it manually, for example:
$ apt-get install -t unstable some-package
As an alternative, the package can also be pinned in /etc/apt/preferences. For example
Package: emacs24* Pin: version 24.5+1-6 Pin-Priority: -10
prevents the installation of the version 24.5+1-6 of the emacs24* packages. The priority passes to the next emacs24* most relevant version (e.g., downgrading to Stable or upgrading to Unstable).