Packages, repositories and dependencies

Beginner · 6 min

What a package contains, how a repository's signed index ties every file to a checksum, how dependencies are resolved, and why curl | sh is a step back.

Before thisDistributions and release modelsThe filesystem hierarchy

ExplainingComputers · 7 min · from 0:40

Packages, repositories and dependencies

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by ExplainingComputersReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • A package is an archive of files plus metadata: name, version, architecture, dependencies, conflicts, and scripts to run on install or removal. The package manager records every file it installs.
  • A repository is a web directory with a signed index. The signature covers a list of checksums for the package lists, and the lists hold a checksum for every package, so one trusted key protects everything downloaded.
  • Dependencies are declared by name and version range (Depends: libssl3t64 (>= 3.0.0)). The resolver picks a set of packages that satisfies all of them at once, including virtual packages provided by several real ones.
  • Mirrors carry identical signed content, so any mirror can be used without trusting its operator.
  • curl | sh skips all of this: no signature chain, no record of files, no clean removal, no security updates, and a truncated download can run half a script. Prefer the distribution's package, then a vendor repository.

Installing software without a package manager

Imagine installing a web server by hand. You download a tarball, compile it, copy the binary to /usr/local/sbin, the config to /etc, a man page somewhere. It needs OpenSSL, so you install that too, and PCRE, and zlib. Six months later a security fix comes out for OpenSSL. Which machines have it? Which version? Which files belong to it? To remove the web server, which files do you delete?

Package management exists to answer those questions automatically. A distribution’s package manager knows every file on the system that came from a package, every version, and every dependency, and it can update or remove any of them cleanly.

What a package is

A package is an archive with two parts: the files to install, and metadata about them. I downloaded the real nginx package for Debian 13 from deb.debian.org and took it apart on a Mac with ar and tar. A .deb holds three members:

$ ar t nginx_1.26.3-3+deb13u10_amd64.deb
debian-binary
control.tar.xz
data.tar.xz

data.tar.xz is the payload: just 13 entries, including ./usr/sbin/nginx, its man page and copyright file. control.tar.xz holds the metadata. Its control file begins:

Package: nginx
Version: 1.26.3-3+deb13u10
Architecture: amd64
Depends: libc6 (>= 2.34), libcrypt1 (>= 1:4.1.0), libpcre2-8-0 (>= 10.22),
 libssl3t64 (>= 3.0.0), zlib1g (>= 1:1.1.4), iproute2, nginx-common (= 1.26.3-3+deb13u10)
Breaks: nginx-core (<< 1.22.1-6~), nginx-extras (<< 1.22.1-6~), nginx-light (<< 1.22.1-6~)
Provides: httpd, httpd-cgi, nginx-abi-1.26.3-1

(The Depends line is wrapped here for width.) The version string also tells a story: upstream nginx 1.26.3, Debian packaging revision 3, and +deb13u10, the tenth stable update for Debian 13. Debian keeps 1.26 for the whole release and backports fixes, as the release models lesson explained. RPM packages on Fedora and RHEL hold the same two parts in a different container format.

Dependencies and the resolver

Depends lists other packages by name with version constraints. Breaks and Conflicts say what cannot coexist. Recommends and Suggests are softer. Provides declares virtual packages: nginx provides httpd, so a package that needs “some web server” can depend on httpd and be satisfied by nginx, Apache or another.

Asking for one package therefore means solving a puzzle: find a set of package versions where every Depends is met and nothing Breaks anything else. That is the resolver’s job, in apt and dnf alike. It is why a release is tested as a whole set. If two programs need incompatible versions of one library, there may be no solution, and the package manager says so instead of half-installing.

The library sonames in those names, like the 3 in libssl3t64, come back in the shared libraries lesson.

Repositories and the chain of signatures

A repository is a directory on a web server. What makes it trustworthy is its index. I fetched Debian’s real index on 2026-11-28:

  • dists/trixie/InRelease, a 1,488-line text file that says Suite: stable, Version: 13.8, dated 21 November 2026, followed by checksums of every index file and an OpenPGP signature block.
  • One of those lines reads be3d7d96...6557412 9679304 main/binary-amd64/Packages.xz. I downloaded Packages.xz, and shasum -a 256 printed exactly be3d7d96...6557412.
  • Packages lists 68,829 packages for amd64 in main. The nginx entry gives SHA256: 222f1f29...8750a9, which is exactly what shasum printed for the .deb I downloaded.

So one signature on a small text file protects every byte below it. This is why mirrors are safe to use: anyone can run a copy of the repository, and a tampered package would fail the checksum chain. The signing keys, and how to add a third-party one safely, are the subject of the signing keys lesson.

Why not curl | sh?

Many projects install with one line: curl -fsSL https://example.com/install.sh | sh. It is convenient, and it gives up everything above.

  • Trust. You trust whatever that URL serves at that moment, over one TLS connection, with no signature from a key you chose to trust in advance.
  • Records. Nothing records which files the script wrote, so there is no clean uninstall and no conflict check against what packages own.
  • Updates. Security fixes do not arrive with your normal apt upgrade or dnf upgrade.
  • Partial runs. If the connection drops mid-download, the shell has already started executing what arrived. The video in deeper from You Suck at Programming demonstrates exactly that failure.

The order of preference on a server is: the distribution’s own package; then the vendor’s signed repository, added properly; then a container image or a sandboxed format; and only then a script, downloaded to a file, read, and run deliberately.

About the video

The embed is ExplainingComputers’s “Linux Packaging Formats: Deb, RPM, Flatpak, Snap & AppImage”, August 2026, clipped to its “Deb & RPM” chapter (about 6.5 minutes). Christopher Barnatt explains what native packages are and how package managers and repositories deliver them, in his usual calm, desktop-oriented style. The rest of the video, on Flatpak, Snap and AppImage, is the embed for the universal formats lesson. The clip does not cover signatures, checksums or dependency resolution in depth, which this lesson does with real files. I judged it from the chapters and description, and English from its English auto-caption track. KodeKloud’s six-minute overview and the curl-pipe-sh demonstration are in deeper.

What was run: downloading Debian’s InRelease, Packages index and the nginx .deb, checking SHA-256 sums, and unpacking the .deb, all on a Mac. Relationship field meanings follow the Debian Policy Manual’s chapter on package relationships, checked 2026-11-28.

Check yourself

  1. 01A mirror you have never heard of serves your Debian packages. Why is that not a security problem by itself?

    apt checks the signature on the InRelease file against keys it already trusts, then checks every downloaded index and package against the checksums inside it. A mirror cannot change a package without breaking those checks.

  2. 02What is a virtual package, using nginx as an example?

    A name that no real package carries but several packages declare they provide. The nginx package's control file says Provides: httpd, so anything that depends on httpd can be satisfied by nginx or another web server.

  3. 03Why can't you cleanly uninstall software installed with curl | sh?

    The package manager never recorded which files the script wrote, so there is no file list to remove and no metadata for upgrades or conflict checks.

  4. 04What does a resolver do when two packages need incompatible versions of the same library?

    It cannot install both from the same repository version, so it reports a conflict or holds one back. That is why distributions rebuild and test whole sets of packages together for a release.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark