Product SiteDocumentation Site

Kapitel 6. Wartung und Aktualisierung: Die APT-Tools

6.1. Befüllen der sources.list Datei
6.1.1. Syntax
6.1.2. Repositorien für Stable Benutzer
6.1.3. Repositories für Testing/Unstable Anwender
6.1.4. Using Alternate Mirrors
6.1.5. Inoffizielle Resourcen: mentors.debian.net
6.1.6. Caching Proxy (Zwischenspeicher) für Debian Pakete
6.2. aptitude, apt-get und apt Befehle
6.2.1. Initialisierung
6.2.2. Installieren und Entfernen
6.2.3. Das System aktualisieren
6.2.4. Konfigurationsoptionen
6.2.5. Paketprioritäten verwalten
6.2.6. Mit mehreren Distributionen arbeiten
6.2.7. Automatisch installierte Pakete nachverfolgen
6.3. Der Befehl apt-cache
6.4. The apt-file Command
6.5. Benutzeroberflächen: aptitude, synaptic
6.5.1. aptitude
6.5.2. synaptic
6.6. Die Echtheit eines Paketes prüfen
6.7. Von einer Stable Distribution auf die nächste aktualisieren
6.7.1. Empfohlene Vorgehensweise
6.7.2. Problembehandlung nach einer Aktualisierung
6.7.3. Cleaning Up after an Upgrade
6.8. Ein System aktuell halten
6.9. Automatische Aktualisierungen
6.9.1. dpkg konfigurieren
6.9.2. APT konfigurieren
6.9.3. debconf konfigurieren
6.9.4. Interaktiver Umgang mit der Kommandozeile
6.9.5. Die Wunderkombination
6.10. Pakete suchen
Dass Debian bei Administratoren so beliebt ist, liegt an der einfachen Installation von Software und daran, wie einfach es aktuell gehalten werden kann. Dieser einzigartige Vorteil rührt weitestgehend vom Programm APT, dessen Funktionen sich die Administratoren von Falcot Corp mit Begeisterung angeeignet haben.
APT ist die Abkürzung für Advanced Package Tool (fortschrittliches Paketierungshilfsprogramm). Den Begriff fortschrittlich verdient sich das Tool durch seinen Pakete-Ansatz. Es bewertet diese nicht einfach individuell, sondern betrachtet Pakete als Ganzes und erzeugt die bestmögliche Kombination von Paketen abhängig davon, welche verfügbar und den Abhängigkeiten nach kompatibel sind.
APT muss eine "Liste der Paketquellen (Repositorys)" erhalten: Die Datei /etc/apt/sources.list listet die verschiedenen Repositories auf, die Debian-Pakete veröffentlichen. APT importiert dann die Liste der Pakete, die von jeder dieser Quellen veröffentlicht werden. Dieser Vorgang wird erreicht, indem Packages.xz Dateien oder eine Variante wie Packages.gz oder .bz2 (mit einer anderen Kompressionsmethode) im Falle einer Quelle von Binärpaketen heruntergeladen und deren Inhalt analysiert wird. Im Falle einer Quelle von Quellpaketen lädt APT Sources.xz-Dateien oder eine Variante mit einer anderen Kompressionsmethode herunter. Wenn eine alte Kopie dieser Dateien bereits vorhanden ist, kann APT sie aktualisieren, indem sie nur die Unterschiede herunterlädt (siehe Seitenleiste TIP Incremental updates).

6.1. Befüllen der sources.list Datei

6.1.1. Syntax

Jede aktive Zeile in der Datei /etc/apt/sources.list stellt eine Paketquelle (Repository) dar und besteht aus mindestens drei durch Leerzeichen getrennten Teilen. Eine vollständige Beschreibung des Dateiformats und der akzeptierten Eintragszusammenstellungen finden Sie unter sources.list(5).

Beispiel 6.1. Beispiel-Eingabeformat in /etc/apt/sources.list

deb url distribution component1 component2 component3 [..] componentX
deb-src url distribution component1 component2 component3 [..] componentX
Das erste Feld bezeichnet die Art der Quelle:
deb
Paketquelle (Repository) von Binärpaketen
deb-src
Paketquelle (Repository) von Quellpaketen
The second field gives the base URL of the source. Combined with the filenames listed in the Packages.xz files, it must give a full and valid URL. This can consist in a Debian mirror or in any other package archive set up by a third party. The URL can start with file:// to indicate a local source installed in the system's file hierarchy, with http:// or https:// to indicate a source accessible from a web server server, or with ftp:// or ftps:// for a source available on an FTP server. The URL can also start with cdrom: for CD-ROM/DVD/Blu-ray disc based installations, although this is less frequent, since network-based installation methods are eventually more common.
The syntax of the last field depends on the structure of the repository. In the simplest case, you can simply indicate a subdirectory (with a required trailing slash) of the desired source. This is often a simple “./” which refers to the absence of a subdirectory. The packages are then directly at the specified URL. But in the most common case, the repositories will be structured like a Debian mirror, with multiple distributions, each having multiple components. In those cases, name the chosen distribution by its “codename” — see the list in sidebar GEMEINSCHAFT Bruce Perens, ein umstrittener Leiter — or by the corresponding “suite” oldstable, stable, testing, unstable) and then the components to enable. A typical Debian mirror provides the components main, contrib, and non-free.
Der Eintrag cdrom beschreibt die vorhandenen CDs/DVDs. Anders als die anderen Quellen, ist eine CD/DVD-ROM nicht immer zugreifbar, sie muss ja zuerst in das Laufwerk eingelegt werden und zudem kann immer nur eine Scheibe zu einer Zeit gelesen werden. Deshalb werden diese Quellen ein klein wenig anders gehandhabt und müssen mit dem Befehl apt-cdrom hinzugefügt werden, üblicherweise ausgeführt mit dem Parameter add. Letzterer fordert Sie dann auf, die CD-ROM in das Laufwerk einzulegen, um dann deren Inhalt nach Paket-Dateien zu durchsuchen. Das Programm nutzt diese Dateien, um die Datenbank verfügbarer Pakete zu aktualisieren (dies geschieht für gewöhnlich mit dem Befehl apt update). Von da an kann APT auffordern, die CD-ROM einzulegen, falls es eines der darauf befindlichen Pakete benötigt.

6.1.2. Repositorien für Stable Benutzer

Hier ist eine standardmäßige sources.list für ein System, auf welchem eine Stable-Version von Debian läuft:

Beispiel 6.2. /etc/apt/sources.list-Datei für Debian Stable

# Security updates
deb http://security.debian.org/ buster/updates main contrib non-free
deb-src http://security.debian.org/ buster/updates main contrib non-free

## Debian mirror

# Base repository
deb https://deb.debian.org/debian buster main contrib non-free
deb-src https://deb.debian.org/debian buster main contrib non-free

# Stable updates
deb https://deb.debian.org/debian buster-updates main contrib non-free
deb-src https://deb.debian.org/debian buster-updates main contrib non-free

# Stable backports
deb https://deb.debian.org/debian buster-backports main contrib non-free
deb-src https://deb.debian.org/debian buster-backports main contrib non-free
This file lists all sources of packages associated with the Buster version of Debian (the current Stable suite as of this writing). In the example above, we opted to name “buster” explicitly instead of using the corresponding “stable“ aliases (stable, stable-updates, stable-backports) because we don't want to have the underlying distribution changed outside of our control when the next stable release comes out.
Die meisten Pakete kommen aus dem "base repository", das alle Pakete enthält, aber selten aktualisiert wird (etwa alle 2 Monate mit einem "point release"). Die anderen Repositories sind Untermengen (sie enthalten nicht alle Pakete) und können Aktualisierungen beinhalten (Pakete mit neuerer Version) die APT installieren könnte. Die folgenden Abschnitte erläutern den Zweck und die Richtlinien, die jedes dieser Repositories regeln.
Man muss wissen, dass, wenn die benötigte Version eines Paketes in mehreren Repositories verfügbar ist, das zuerst in der Liste sources.list aufgeführte verwendet wird. Aus diesem Grund werden nicht offizielle Bezugsquellen üblicherweise ans Ende der Liste gesetzt.
Nebenbei bemerkt trifft das meiste in diesem Abschnitt über Stable gesagte gleichermaßen auf Oldstable zu, denn letztere ist ja nichts anderes als eine ältere Stable, die parallel gepflegt wird.

6.1.2.1. Sicherheitsaktualisierungen

Debian takes security seriously. Known software vulnerabilities in Debian are tracked in the Security Bug Tracker and usually get fixed in a reasonable timeframe. The security updates are not hosted on the usual network of Debian mirrors but on security.debian.org, a small set of machines maintained by the Debian System Administrators. This archive contains security updates prepared by the Debian Security Team and/or by package maintainers for the Stable and Oldstable distribution.
The server can also host security updates for Testing but this doesn't happen very often since those updates tend to reach the Testing suite via the regular flow of updates coming from Unstable.
For serious issues, the security team issues a Debian Security Advisory (DSA) and announces it together with the security update on the mailing list (archive).

6.1.2.2. Stable-Aktualisierungen

Stable-Aktualisierungen sind nicht sicherheitsrelevant, werden aber als wichtig genug erachtet, um sie den Anwendern vor der nächsten Stable Release aufzuspielen.
This repository will typically contain fixes for critical and serious bugs which could not be fixed before release or which have been introduced by subsequent updates. Depending on the urgency, it can also contain updates for packages that have to evolve over time, like spamassassin's spam detection rules, clamav's virus database, the daylight-saving time rules of all timezones (tzdata), the ESR version of Firefox (firefox-esr) or cryptographic keyrings like debian-archive-keyring.
In practice, this repository is a subset of the proposed-updates repository, carefully selected by the Stable Release Managers. All updates are announced on the mailing list (archive) and will be included in the next Stable point release anyway.
deb https://deb.debian.org/debian buster-updates main contrib non-free

6.1.2.3. Proposed Updates

Einmal veröffentlicht, wird die Distribution Stable nur noch etwa alle 2 Monate aktualisiert. Im proposed-updates-Repository werden die vorgesehenen Aktualisierungen vorbereitet (kontrolliert von den Stable-Release-Betreuern).
Sowohl die Aktualisierungen von Stable als auch diejenigen zur Behebung von Sicherheitslücken, die in den voranstehenden Abschnitten beschrieben wurden, sind immer in diesem Repository enthalten, aber mehr noch, es bietet den Betreuern die Gelegenheit, wesentliche Fehler zu beheben, die kein sofortiges Release rechtfertigen.
Anyone can use this repository to test those updates before their official publication. The extract below uses the buster-proposed-updates alias which is both more explicit and more consistent since stretch-proposed-updates also exists (for the Oldstable updates):
deb https://deb.debian.org/debian buster-proposed-updates main contrib non-free

6.1.2.4. Stable Backports

Das stable-backports-Repository enthält "rückportierte Pakete". Der Ausdruck beschreibt ein Paket mit kürzlich erschienener Software, das für eine ältere Distribution neukompiliert wurde, im Allgemeinen für Stable.
When the distribution becomes a little dated, numerous software projects have released new versions that are not integrated into the current Stable suite, which is only modified to address the most critical problems, such as security issues. Since the Testing and Unstable suites can be more risky, package maintainers sometimes voluntarily offer recompilations of recent software applications for Stable, which has the advantage to users and system administrators to limit potential instability to a small number of chosen packages. The page https://backports.debian.org provides more information.
Backports from stable-backports are only created from packages available in Testing. This ensures that all installed backports will be upgradable to the corresponding stable version once the next stable release of Debian is available.
Even though this repository provides newer versions of packages, APT will not install them unless you give explicit instructions to do so (or unless you have already done so with a former version of the given backport):
$ sudo apt-get install package/buster-backports
$ sudo apt-get install -t buster-backports package

6.1.3. Repositories für Testing/Unstable Anwender

Hier ist eine standardmäßige sources.list für ein System, auf welchem entweder die Version Testing oder Unstable läuft:

Beispiel 6.3. Beispoieldatei /etc/apt/sources.list für Debian-Anwender von Testing/Unstable

# Unstable
deb https://deb.debian.org/debian unstable main contrib non-free
deb-src https://deb.debian.org/debian unstable main contrib non-free

# Testing
deb https://deb.debian.org/debian testing main contrib non-free
deb-src https://deb.debian.org/debian testing main contrib non-free

# Testing security updates
deb http://security.debian.org/ testing-security main contrib non-free
deb-src http://security.debian.org/ testing-security main contrib non-free

# Stable
deb https://deb.debian.org/debian stable main contrib non-free
deb-src https://deb.debian.org/debian stable main contrib non-free

# Stable security updates
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
With this sources.list file APT will install packages from the Unstable suite. If that is not desired, use the APT::Default-Release setting (see Abschnitt 6.2.3, „Das System aktualisieren“) to instruct APT to pick packages from another suite (most likely Testing in this case).
Es gibt gute Gründe alle diese Repositories vorzuhalten, obwohl ein einziges doch genügen sollte. Testing-Anwender werden es schätzen, ein einzelnes Paket aus Unstable herauspicken zu können, wenn die Version Testing einen nervigen Fehler enthält. Und auf der anderen Seite haben Benutzer von Unstable, die von einem unerwarteten Rückschlag betroffen sind, die Möglichkeit, Pakete auf die (vermutlich funktionierende) Testing-Version zurückzusetzen.
The inclusion of Stable is more debatable but it often gives access to some packages, which have been removed from the development versions. It also ensures that you get the latest updates for packages, which have not been modified since the last stable release.

6.1.3.1. Das Paketdepot Experimental

Das Archiv von Paketen in Experimental ist auf allen Debian-Spiegelservern vorhanden und enthält Pakete, die aufgrund ihrer nicht den Standards entsprechenden Qualität noch nicht in Unstable sind – oft sind es Entwicklerversionen oder Vorab-Versionen (Alpha, Beta, Veröffentlichungskandidat…). Ein Paket kann auch dorthin verschoben werden, wenn Änderungen Probleme verursachen können. Der Paketbetreuer versucht diese Probleme dann mit der Hilfe erfahrener Benutzter, die mit problembehafteter Software umgehen können, aufzuspüren. Nach dieser ersten Stufe wird das Paket nach Unstable verschoben, wo es ein viel größeres Publikum erreicht und dadurch viel gründlicher getestet wird.
Generell wird Experimental von Benutzern genutzt, denen es nichts ausmacht, wenn ihr System beschädigt wird und sie es reparieren müssen. Diese Distribution ermöglicht es, ein Paket einzubinden, das ein Benutzer ausprobieren möchte oder weil er es benötigt. Genau das ist die Vorgehensweise von Debian, da das Hinzufügen dieser in APTs sources.list-Datei nicht dazu führt, dass diese Pakete systematisch benutzt werden. Die hinzuzufügende Zeile ist:
deb https://deb.debian.org/debian experimental main contrib non-free

6.1.4. Using Alternate Mirrors

The sources.list examples in this chapter refer to package repositories hosted on deb.debian.org. Those URLs will redirect you to servers which are close to you and which are managed by Content Delivery Networks (CDN) whose main role is to store multiple copies of the files across the world, and to deliver them as fast as possible to users. The CDN companies that Debian is working with are Debian partners who are offering their services freely to Debian. While none of those servers are under direct control of Debian, the fact that the whole archive is sealed by GPG signatures makes it a non-issue.
Picky users who are not satisfied with the performance of deb.debian.org can try to find a better mirror in the official mirror list:
But when you don't know which mirror is best for you, this list is of not much use. Fortunately for you, Debian maintains DNS entries of the form ftp.country-code.debian.org (e.g. ftp.us.debian.org for the USA, ftp.fr.debian.org for France, etc.) which are covering many countries and which are pointing to one (or more) of the best mirrors available within that country.
As an alternative to deb.debian.org, there used to be httpredir.debian.org. This service would identify a mirror close to you (among the list of official mirrors, using GeoIP mainly) and would redirect APT's requests to that mirror. This service has been deprecated due to reliability concerns and now httpredir.debian.org provides the same CDN-based service as deb.debian.org.

6.1.5. Inoffizielle Resourcen: mentors.debian.net

There are numerous non-official sources of Debian packages set up by advanced users who have recompiled some software (Ubuntu made this popular with their Personal Package Archive (PPA) service, by programmers who make their creation available to all, and even by Debian developers who offer pre-versions of their package online.
The mentors.debian.net site is interesting (although it only provides source packages), since it gathers packages created by candidates to the status of official Debian developer or by volunteers who wish to create Debian packages without going through that process of integration. These packages are made available without any guarantee regarding their quality; make sure that you check their origin and integrity and then test them before you consider using them in production.
Ein Paket zu installieren bedeutet, dessen Urheber Root-Rechte zu gewähren, da dieser über den Inhalt der Einrichtungsskripte entscheidet, die unter der Paket-Identität ausgeführt werden. Offizielle Debian-Pakete werden von Freiwilligen erstellt, die ausgewählt und überprüft wurden, und die ihre Pakete signieren können, so dass deren Herkunft und Integrität überprüft werden kann.
In general, be wary of a package whose origin you don't know and which isn't hosted on one of the official Debian servers: evaluate the degree to which you can trust the creator, and check the integrity of the package.

6.1.6. Caching Proxy (Zwischenspeicher) für Debian Pakete

Wenn für ein ganzes Netzwerk der gleiche Server für das Herunterladen der gleichen aktualisierten Pakete konfiguriert wird, weiß jeder Administrator, wie hilfreich ein dazwischengeschalteter Proxy ist, der als lokaler Zwischenspeicher im Netzwerk fungiert (siehe Seitenleiste WÖRTERVERZEICHNIS Cache).
Sie können APT so konfigurieren, dass "standardmäßig" ein Proxy benutzt wird (siehe Abschnitt 6.2.4, „Konfigurationsoptionen“ für die APT-Seite und Abschnitt 11.6, „HTTP/FTP-Proxy“ für die Proxy-Seite), aber das Debian-Ökosystem bietet noch bessere Möglichkeiten für diesen Zweck. Die speziellen Programme, die in diesem Abschnitt vorgestellt werden, sind intelligenter als ein einfacher Cache, denn sie können auf eine spezielle Struktur an APT-Repositories zurückgreifen (beispielsweise wissen sie, ob einzelne Dateien obsolet sind oder nicht, und können so die Vorhaltezeit anpassen).
apt-cacher and apt-cacher-ng arbeiten wie normale Proxy-Server. Die sources.list von APT bleibt unverändert, aber APT ist so konfiguriert, dass es diese als Proxies für ausgehende Anfragen nutzt.
approx auf der anderen Seite, arbeitet wie ein HTTP-Server, der alle im Netz verfügbaren Repositories unter seiner Top-Level-Domain zur Verfügung stellt. Die Verknüpfungen zwischen den entfernten URL's der Repositories und diesen Top-Level-Verzeichnissen sind in /etc/approx/approx.conf gespeichert:
# <name> <repository-base-url>
debian   https://deb.debian.org/debian
security http://security.debian.org
approx runs by default on port 9999 via a systemd socket and requires the users to adjust their sources.list file to point to the approx server:
# Sample sources.list pointing to a local approx server
deb http://localhost:9999/security buster/updates main contrib non-free
deb http://localhost:9999/debian buster main contrib non-free