Chapter 6. Packages, Repositories, and Updates
Debian software arrives as packages - versioned .deb files carrying
programs, documentation, and the metadata that says what each package needs
and conflicts with - published in repositories whose contents are
cryptographically signed. Two layers cooperate to turn those repositories
into an installed system: APT resolves versions, downloads, and checks
signatures, while dpkg owns the database of what is installed and performs
every actual change. This chapter covers both layers and the workflows
built on them: how to read package metadata, how sources are configured and
verified, how software is installed, removed, and kept current, how to pin
or hold versions when a machine must not drift, how to build and use a
repository of your own (including for machines with no network at all), and
how to repair the package system when an upgrade is interrupted or a
repository goes bad.
The examples run on the same Debian 13.7 amd64 system used throughout the
book, with apt 3.0.4 and dpkg 1.22.22, and the conventions are those of
Chapter 3: commands entered in john's ordinary shell
begin with $, commands entered in a root shell begin with #, a
single elevated command is written $ sudo command, and the marker itself
is not typed. A root shell is the one from sudo -i - john's account has
sudo rights as established in Chapter 2 - and exit
leaves it; sudo may ask for john's password the first time, as
Chapter 3 describes. Each console block shows one
complete command followed by its own output; where a capture is trimmed, a
note says what was omitted. Versions, timestamps, file counts, and pending
updates on your system will differ from the captures.
Work files live under a dedicated workspace in john's home, created once for the chapter and reused by every procedure that builds something:
$ mkdir -p ~/debian-handbook/package-management/{downloads,local-packages,offline-stage}
The braces expand to the three subdirectory names, so one mkdir creates
downloads/ for fetched archives, local-packages/ for the practice
packages built in this chapter, and offline-stage/ for the
disconnected-system exercise. The command prints nothing on success.
Chapter 16 explains why /tmp and /var/tmp are not
used for material worth keeping.
One artifact deserves advance notice. Section 6.2.3 builds a small,
signed, local practice archive under /srv, populated with deliberately
fake packages, and that archive plays three roles as the chapter proceeds:
the signed source whose verification you watch in Section 6.2.3, a
third-party repository whose influence must be contained in Section 6.2.4,
and the internal package archive an organization might run in
Section 6.6. The fake packages are tiny by construction - a control file, a
readme, sometimes one script - so nothing here risks real software, and
Section 6.7 ends by removing everything the chapter created.