Debian Binary Package File Format Explained
This article provides an overview of the binary package file format
utilized by the Debian operating system, known as the .deb
format. It covers the structure of .deb files, their
internal archive components, and the core command-line tools used to
manage, inspect, and install these packages on Debian and its derivative
distributions.
The Debian operating system uses the .deb format for
distributing and installing binary software packages. A
.deb file is essentially a standard Unix ar
archive that encapsulates the application binaries, configuration files,
metadata, and installation scripts necessary to integrate software into
the system.
Internally, every Debian binary package consists of three main files
packaged inside the ar container:
- debian-binary: A plain text file that specifies the
version of the Debian package format being used, which is typically
version
2.0. - control.tar.gz (or compressed with
.xzor.zst): An archive containing package metadata. This includes the package name, version, dependencies, architecture, maintainer details, and optional maintainer scripts (such aspreinst,postinst,prerm, andpostrm) that run before or after installation and removal. - data.tar.gz (or compressed with
.xzor.zst): An archive containing the actual program files, libraries, documentation, and configuration files that will be extracted onto the target filesystem during installation.
Debian packages are handled at different abstraction levels depending on the task:
- dpkg: The primary low-level tool responsible for
unpacking, installing, and removing individual
.debfiles directly from the local file system. It does not resolve remote dependencies automatically. - APT (Advanced Package Tool): The high-level package
management system that works on top of
dpkg. APT interacts with remote repositories, automatically resolves and downloads necessary dependencies, and invokesdpkgto perform the actual installation of.debpackages.
Because Debian's packaging standard is both stable and robust, the
.deb format is also used by numerous Debian-derived Linux
distributions, including Ubuntu, Linux Mint, and Raspberry Pi OS.