The control.tar member (see archive
layout) holds the package’s metadata and scripts as plain files. In a source tree
they are kept in the DEBIAN/ folder that dpkg-deb --build
packs. This page follows dpkg’s manual pages deb-control(5),
deb-version(7), deb-conffiles(5),
deb-md5sums(5), deb-triggers(5), deb-shlibs(5),
deb-symbols(5) and the four maintainer-script pages.
Files in control.tar
| File | Required | Contents |
|---|---|---|
control | Yes | The package’s fields. |
md5sums | No | MD5 of each installed file. |
conffiles | No | Configuration files dpkg must not overwrite silently. |
triggers | No | Trigger interests and activations. |
shlibs | No | Shared library dependency information. |
symbols | No | Per-symbol dependency information. |
preinst, postinst, prerm, postrm | No | Executable maintainer scripts. |
The control file
A subset of the deb822 format: Field: value lines. Field names are not
case-sensitive; values are, unless said otherwise. A value may continue on following
lines; installation tools generally join them, except in
Description, where line breaks matter. A binary package’s control file
has one paragraph.
| Field | Status | Meaning and values |
|---|---|---|
Package | Required | The package name, also used to make file names. |
Package-Type | Optional | deb (the default) or udeb (a cut-down package for the Debian installer); more types may be added. |
Version | Required | The version, with a Debian revision for non-native packages. |
Maintainer | Recommended | Name <email> of the packager (not usually the upstream author). |
Description | Recommended | First line: a short summary. Following lines: the long description, each starting with a space; a line of a space and a full stop (␣.) is a blank line. |
Section | Optional | A category such as utils, net, mail, text or x11; allowed values are set by the distribution. |
Priority | Optional | required, important, standard, optional, extra or unknown; other values are allowed. |
Installed-Size | Optional | Approximate disk space used once installed, in KiB. |
Protected | Optional | yes or no: needed to boot the system (or a local meta-package); tools refuse to remove it without forcing. dpkg 1.20.1 and later. |
Essential | Optional | yes or no: needed by the packaging system or for the system to work at all; tools refuse to remove it without forcing. |
Build-Essential | Optional | yes or no: needed to build other packages. Usually added by archive software. |
Architecture | Required | all for architecture-independent packages, or one architecture such as amd64, arm64, armel, i386; no wildcards. Names start with a letter or digit, then letters, digits and dashes. |
Origin | Optional | Name of the distribution the package comes from. |
Bugs | Optional | Bug tracker, as bts-type://bts-address, such as debbugs://bugs.debian.org. |
Homepage | Optional | Upstream project’s home page URL. |
Tag | Optional | A list of descriptive tags, from the vocabulary of the debtags project. |
Multi-Arch | Optional | no (default): not co-installable with itself for other architectures. same: can be installed for several architectures at once, and satisfies dependencies only from its own architecture. foreign: not co-installable with itself, but satisfies unqualified dependencies of packages of other architectures. allowed: dependants may accept it from any architecture by writing :any. |
Source | Optional | source-name [(source-version)]: the source package, when its name differs; the version only when it differs from Version. |
Subarchitecture | Optional | Used by the Debian installer (udebs). |
Kernel-Version | Optional | Used by the Debian installer (kernel module udebs). |
Installer-Menu-Item | Optional | Used by the Debian installer (menu position). |
Depends | Optional | Packages needed for the package to do anything useful. Their postinst runs before this package’s; this package’s prerm runs before theirs. |
Pre-Depends | Optional | Packages that must be installed and configured before this one is installed (usually because its preinst needs them). |
Recommends | Optional | Packages normally installed with it; tools warn when they are left out. |
Suggests | Optional | Packages that may make it more useful. |
Breaks | Optional | Packages this one breaks (for example by exposing their bugs); they cannot stay configured with it. Comma means OR here; default architecture qualifier any. |
Conflicts | Optional | Packages that cannot be installed at the same time (for example, sharing file names). Both should name each other. |
Replaces | Optional | Packages whose files this one may overwrite; with Conflicts, forces their removal. |
Enhances | Optional | Packages this one enhances: Suggests in the other direction. |
Provides | Optional | Virtual packages it provides, such as mail-transport-agent; each with an optional architecture qualifier and an optional exact version ((= 1.0), dpkg 1.17.11 and later). |
Built-Using | Optional | Source packages whose code went into this binary (for licence compliance), each with an exact (= version). |
Static-Built-Using | Optional | Source packages statically linked or compiled in (static libraries, Go, Rust, header-only libraries), each with an exact version. dpkg 1.21.3 and later. |
Built-For-Profiles | Obsolete | Build profiles active when it was built, space separated (dpkg 1.17.2 to 1.18.19; replaced by the .buildinfo file). |
Auto-Built-Package | Optional | Why the package was generated automatically, space separated; the only reason defined is debug-symbols. |
Build-Ids | Optional | ELF build IDs of the objects in the package, space separated. |
Package: hello
Version: 2.10-3
Architecture: amd64
Maintainer: Jane Doe <jane@example.org>
Installed-Size: 281
Depends: libc6 (>= 2.34)
Section: devel
Priority: optional
Homepage: https://www.gnu.org/software/hello/
Description: example package based on GNU hello
The GNU hello program produces a familiar, friendly greeting.
.
Seriously, though: this is an example of how to do a Debian package.
Relationship syntax
Depends, Pre-Depends, Recommends,
Suggests are comma-separated lists of groups,
all of which must be met (AND); within a group, alternatives are separated by
| (OR), which binds tighter. In Breaks,
Conflicts and Replaces each comma-separated item stands
alone.
Each item is name[:arch] [(op version)]:
| Part | Meaning |
|---|---|
:arch | An architecture name matches only that architecture (dpkg 1.16.5); :any matches any architecture when the target is Multi-Arch: allowed (dpkg 1.16.2). Without one, the dependant’s own architecture. |
<< | Strictly earlier |
<= | Earlier or equal |
= | Exactly equal |
>= | Later or equal |
>> | Strictly later |
Example: Depends: libc6 (>= 2.34), default-mta | mail-transport-agent.
Version numbers
[epoch:]upstream-version[-debian-revision]
| Part | Rules |
|---|---|
| epoch | A small unsigned integer, 0 when left out; used to fix past numbering mistakes. Without it the upstream version may not contain colons. |
| upstream-version | Required; should start with a digit. Letters, digits and . + - : ~; hyphens only when there is a Debian revision, colons only when there is an epoch. |
| debian-revision | Letters, digits and + . ~. Split off at the last hyphen. A missing revision sorts before any revision. |
Comparison: epochs numerically, then upstream versions, then revisions, each by
repeatedly comparing a run of non-digits (character by character, letters before
non-letters, and ~ before everything, even the end of the string) and
then a run of digits as a number (empty = 0). So 1.0~rc1 <
1.0 < 1.0a < 1.0+b1, because the end of
the string sorts after ~ but before anything else, and letters sort
before other characters.
md5sums
One line per plain file: its MD5 as 32 hexadecimal digits (either case), two spaces,
and its path, which the page’s examples write without a leading slash
(usr/bin/dpkg). Trailing slashes are trimmed; trailing white space and
empty lines are not accepted. Whether conffiles are listed is not stated.
conffiles
One absolute path per line, optionally preceded by a flag and white space. Empty lines are not allowed.
| Flag | Meaning |
|---|---|
| (none) | The file is in the package and is a conffile. Listed files missing from the package are ignored. |
remove-on-upgrade | Remove this former conffile on the next upgrade; it must not be in the package (dpkg 1.20.6 and later). |
triggers
One directive trigger-name per line; everything after
# is ignored, as are blank lines. An unknown directive stops the package
installing.
| Directive | Meaning | Since dpkg |
|---|---|---|
interest | This package wants to know when the trigger is activated (its postinst runs with triggered); the activating package waits if the activation asked to. | — |
interest-await | Same as interest. | 1.17.21 |
interest-noawait | Activating packages never wait for this package to process the trigger. | 1.16.1 |
activate | Activate the trigger whenever this package is unpacked, configured, removed, purged or deconfigured. | — |
activate-await | Same as activate: wait for processing if the interested package asked for that. | 1.17.21 |
activate-noawait | Activate without waiting. | 1.16.1 |
shlibs
One line per shared library: [type:] library
version dependencies, where library and version come from
the library’s SONAME and dependencies, to the end of the line, use the
Depends syntax; the dependency should name the latest package version
that added symbols. The optional type is normally not needed. Lines starting with
# are comments; blank lines are not allowed.
Example: libcrunch 1 libcrunch1 (>= 1.2-1).
symbols
Finer-grained than shlibs: the minimum version needed for each exported symbol. For each library:
| Line | Form | Meaning |
|---|---|---|
| Header | soname dependency-template | The SONAME as objdump shows it, then the main dependency template. |
| Alternatives | | template | Further templates, numbered from 1. |
| Meta-information | * Field: value | Build-Depends-Package (the -dev package; dpkg 1.14.13), Build-Depends-Packages (comma-separated list, overrides it; 1.20.0), Allow-Internal-Symbol-Groups (space-separated groups, such as aeabi and gomp, whose internal symbols are kept; 1.20.1). |
| Symbols | name@version min-version [template-id] | Each starting with a space: the symbol and its symbol version (Base when unversioned), the earliest package version that provides it, and optionally which alternative template to use. Fields separated by exactly one space. |
#MINVER# in a template becomes (>= min-version)
or nothing.
libGL.so.1 libgl1
| libgl1-mesa-glx #MINVER#
* Build-Depends-Package: libgl1-mesa-dev
publicGlSymbol@Base 6.3-1
implementationSpecificSymbol@Base 6.5.2-7 1
Maintainer scripts
Executable files run by dpkg at fixed points, with arguments saying why.
“new-” and “old-” name the script from the new or old version of the package. The
new-version arguments marked † are passed since dpkg 1.18.5.
| Script and arguments | When |
|---|---|
new-preinst install | Before a first install. |
new-preinst install old-version new-version† | Before reinstalling a package that was removed but not purged. |
new-preinst upgrade old-version new-version† | Before an upgrade. |
old-preinst abort-upgrade new-version | When the old postrm failed during an upgrade. |
postinst configure old-version | After unpacking, to configure; the old version is the last one configured, empty on first install. |
postinst triggered "trigger-names" | When interested triggers were activated; the names, space separated, are one argument. |
old-postinst abort-upgrade new-version | When the old prerm failed during an upgrade. |
old-postinst abort-remove | When prerm failed during removal. |
postinst abort-deconfigure in-favour new-package new-version [removing old-package old-version] | When prerm failed while deconfiguring for another package. |
postinst abort-remove in-favour new-package new-version | When prerm failed while being replaced because of a conflict. |
prerm remove | Before removal. |
old-prerm upgrade new-version† | Before an upgrade. |
new-prerm failed-upgrade old-version new-version | When the old prerm upgrade failed. |
prerm deconfigure in-favour new-package new-version [removing old-package old-version] | Before deconfiguring because a package it depends on is being replaced by a conflicting one. |
prerm remove in-favour new-package new-version | Before being replaced because of a conflict. |
postrm remove | After removal. |
postrm purge | After purging (removal of conffiles as well). |
old-postrm upgrade new-version | After an upgrade. |
new-postrm failed-upgrade old-version new-version† | When the old postrm upgrade failed. |
postrm disappear overwriter-package overwriter-version | After every file of the package has been replaced by another package. |
new-postrm abort-install | When preinst failed during a first install. |
new-postrm abort-install old-version new-version† | When preinst failed while reinstalling a removed package. |
new-postrm abort-upgrade old-version new-version† | When preinst failed during an upgrade. |
Sources
dpkg manual pages (dpkg 1.23): deb-control(5) (fields, relationship
syntax), deb-version(7), deb-md5sums(5),
deb-conffiles(5), deb-triggers(5),
deb-shlibs(5), deb-symbols(5), deb-preinst(5),
deb-postinst(5), deb-prerm(5) and
deb-postrm(5); deb(5) for the list of control files.