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. |
config | No | An additional maintainer script for packages that prompt through debconf (the Debian Configuration Management Specification, version 2 or higher). It may run before preinst, before the package is unpacked and before any of its dependencies are satisfied, so it may use only the tools of essential packages. |
templates | No | The debconf templates: the questions and messages config and postinst use to prompt the user. Policy requires user-visible messages to be translatable through a gettext-based system such as po-debconf. |
Source: Debian Policy, Binary packages (ch-binary.rst, the introduction, which calls these files “package metadata files” held in control.tar, and “Prompting in maintainer scripts”) and Package maintainer scripts (ch-maintainerscripts.rst), raw from salsa.debian.org. Policy’s rules for the four maintainer scripts: they must be proper executable files; a script must start with the #! line; they should be readable and executable by anyone and must not be world-writable; and each must exit with status 0 on success and non-zero on failure, which dpkg checks to decide what to do next. Scripts are not guaranteed a controlling terminal and must be able to fall back to non-interactive behaviour; they are expected to be idempotent (run again after success or after a partial failure they must do no harm and finish what is left); programs they call should have no path prepended, and they should not reset PATH. Prompting in postinst should be guarded so that it does not happen when postinst is called with abort-upgrade, abort-remove or abort-deconfigure.
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. Debian Policy (ch-controlfields.rst) says that some fields
are folded in the source template debian/control but not in any other
control file, and that the tools that generate the other control files (such as
dpkg-gencontrol) remove the line breaks from such fields; the relationship
fields are the case Policy names (ch-relationships.rst: “All of the
relationship fields can only be folded in source package template control files”), so a
binary package’s control holds each of them on one line.
Syntax rules (Debian Policy, “Syntax of control files”)
- A control file is one or more stanzas of fields, separated by empty lines (a parser may also accept lines of only spaces and tabs). A binary package’s
controlhas one stanza. The order of stanzas is significant. - A field is the field name, a colon, then the value. The name consists of US-ASCII characters except control characters, space and colon (U+0021 to U+0039 and U+003B to U+007E) and must not start with
#or-. Names are not case-sensitive; values are, unless the field says otherwise. Spaces and tabs just before or after the value are ignored. - A stanza must not contain two fields with the same name.
- Empty field values and comment lines are allowed only in a source package template (
debian/control): a line starting with#in column 1 is a comment there and is ignored, even between continuation lines. A binary package’scontrolhas neither. - Field types: simple (the default): one line, no folding. Folded: a logical line that may continue on following lines that start with a space or tab; whitespace including newlines is not significant. Multiline: continuation lines as in folded fields, but whitespace and newlines are significant, and the text on the first line often has a special meaning or must be empty (
Descriptionis one). - Empty lines and lines of only spaces or tabs are not allowed inside a value or between fields; a blank line in a multiline value is written as a space and a full stop.
- Whitespace must not appear inside names (of packages, architectures, files or anything else), inside version numbers, or between the characters of a multi-character version relation (for example
>=). - All control files are encoded in UTF-8.
Field value rules (Debian Policy)
Policy lists Package, Version, Architecture, Maintainer and Description as mandatory in a binary package’s control, and Section and Priority as recommended (deb-control(5) calls Maintainer and Description recommended; the table above follows dpkg). Further rules, from ch-controlfields.rst and ch-archive.rst:
| Field | Rule |
|---|---|
Package, Source | Names consist only of lower-case letters (a-z), digits, +, - and ., are at least two characters long and start with a letter or digit. In a binary control file Source may be followed by a version in parentheses, omitted when it equals Version; the whole field may be left out when the source package has the binary package’s name and version. |
Version | See version numbers. |
Maintainer | The name first, then the e-mail address in angle brackets (RFC 822 form). A name containing a full stop does not work directly as an RFC 822 address; a program that uses the field as an address must correct that. deb-control(5) says the exact format is that of deb-email(7): a name, at least one space, then the address in angle brackets. The name is one or more quoted (") or unquoted parts, which may contain any UTF-8 character except <, >, " and control characters; a comma is allowed only inside a double-quoted part. The address is a local part, an at sign and a domain part; both parts may contain any UTF-8 character except <, >, @, ", space and control characters. A domain with a single label is allowed but gives a warning (such domains are for local hosts or are top-level domains that should not receive mail). The domain is expected in UTF-8, not IDNA/Punycode. Several addresses are separated by commas. Example: Näme "quoted, text" S. Surname <näme@exâmple.org>. An orphaned package (one with no current maintainer) should have Debian QA Group <packages@qa.debian.org> as its Maintainer (Policy, ch-binary.rst). |
Section | The form is section for the main archive area and area/section for non-free-firmware, contrib and non-free. The archive maintainers’ list of sections (Policy’s “at present”): admin, cli-mono, comm, database, debug, devel, doc, editors, education, electronics, embedded, fonts, games, gnome, gnu-r, gnustep, graphics, hamradio, haskell, httpd, interpreters, introspection, java, javascript, kde, kernel, libdevel, libs, lisp, localization, mail, math, metapackages, misc, net, news, ocaml, oldlibs, otherosfs, perl, php, python, ruby, rust, science, shells, sound, tasks, tex, text, utils, vcs, video, web, x11, xfce, zope; debian-installer is for installer packages only. The archive may override the field. |
Priority | required: needed for the system to work (dpkg itself depends on it); removing one may break the system. important: programs one would expect on any Unix-like system (not Emacs, X, TeX or other large applications). standard: a reasonably small but not too limited character-mode system, installed by default; two packages of priority standard or higher must not conflict. optional: the default for most of the archive; may conflict with each other. extra: deprecated, to be treated as optional. Priority depends only on the functionality a package gives directly to the user, not on what depends on it. From dpkg 1.22.13 a binary package without a Priority gets optional. |
Description | A multiline field: the first line is the short description (synopsis); each extended-description line is one of: a single leading space followed by text with at least one non-blank character (part of a word-wrapped paragraph); two or more leading spaces with text (shown verbatim; none, one or two of the initial spaces may be removed, the same number from every line); a space and a single full stop (a blank line, the only way to get one); a space, a full stop and more characters (reserved for the future, not to be used). Tabs must not be used. |
Installed-Size | An estimate of the disk space the package needs once installed: the sum of the sizes of each regular file and symbolic link rounded to units of 1 KiB, with a baseline of 1 KiB for every other kind of file system object; hard links are counted only once, as a regular file (deb-substvars(5), the Installed-Size substitution variable). The real size depends on block size, the file system and what maintainer scripts do. |
Homepage | A plain URL with no surrounding characters such as <>. |
| 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. Upgrading and replacing an essential package is still possible (Policy), and no is the same as not having the field. Packages needed only during boot should now use Protected instead (deb-control(5)). |
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 | How the package behaves on multi-arch installations (deb-control(5)). no: the default when the field is omitted, so adding it with an explicit no is generally not needed. same: co-installable with itself, but must not be used to satisfy the dependency of a package of a different architecture. foreign: not co-installable with itself, but allowed to satisfy a dependency, written without an architecture qualifier, of a package of a different architecture; if the dependency has an explicit architecture qualifier, foreign is ignored. allowed: lets reverse dependencies say in their Depends that they accept this package from a foreign architecture by writing :any after its name; it has no effect otherwise. |
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 |
The version in a relation may give or leave out the Debian revision (the part after the last hyphen) (deb-control(5)). Example: Depends: libc6 (>= 2.34), default-mta | mail-transport-agent.
Further rules (Debian Policy and deb-control(5))
- Deprecated operators. Policy lists only
<<,<=,=,>=and>>. The operators<and>were once allowed and mean earlier-or-equal and later-or-equal (not strictly earlier or later); dpkg still reads them with a warning, but Policy no longer allows them, so old packages may contain them. - Whitespace may appear at any point inside the parentheses (subject to the control-file rules: none inside the operator or the version) and is not otherwise significant; a space after the operator and before the version, and one after each comma and around each
|, is the convention. - Folding. Policy: all of the relationship fields can only be folded in source package template control files. A binary package’s
controltherefore has each relationship field on one line. The convention for a continuation line in a template is to start it after a comma, before the space that follows the comma. - Architecture and build-profile restrictions (Policy, ch-relationships “Restrictions”). After a package name and its optional version, an item may carry one architecture restriction list in square brackets, such as
foo [i386 amd64]orfoo [!i386], and one or more build-profile restriction lists in angle brackets, such asfoo <!nocheck>; the architecture list must come before the profile lists, and the terms inside each bracket pair are separated by whitespace. A term is an optional!and then only lower-case letters, digits,+,-,/and.. An architecture list names Debian architectures or architecture wildcards (such aslinux-any), and a!must be on all of its names or on none. For a field that describes relationships between binary packages (such asDepends) and forBuilt-Using, these restrictions must appear only in the source templatedebian/control: when the binary package’s control file is generated, a dependency whose restriction does not match is left out, and one that matches is written without the restriction (Depends: foo [i386], bar [amd64]becomesDepends: foowhen built oni386,Depends: baronamd64, and nothing on any other architecture). Architecture restrictions must not be used in the binary relationship fields of anArchitecture: allpackage. A binary package’scontrolfile therefore never contains[…]or<…>. - Default architecture qualifier. In
Depends-style fields with no:arch, the package’s own architecture is meant. InBreaks,ConflictsandReplacesthe default isanyinstead; inProvidesit is the package’s own architecture (deb-control(5)). - Provides and versions. A
Providesentry may have a version only with=. AProvideswithout a version does not satisfy a dependency that has a version, and does not violate a versionedConflictsorBreaks; a real package of the same name as a virtual one satisfies or causes the relationship like any provider of it. - Self and virtual exceptions. A
BreaksorConflictsthat names the package itself, or a virtual package it provides, is not a real breakage or conflict (so a package can conflict with every other provider of a facility). Replacesand virtual packages. For the overwriting of files, virtual packages are not considered: the replaced packages must be named by their real names.BreaksandConflictssemantics. A package is regarded as breaking or conflicting only when the other package is at least “Half-Installed” (leftover configuration files alone do not count).Breaksallows both packages unpacked at once but not the broken one to be configured;Conflictsstops them being unpacked together.
What the fields mean (Debian Policy rules)
Policy chapter 7 (ch-relationships.rst, raw from salsa.debian.org) states these rules for the fields. They are rules for the package author and for the package tools. The algorithm dpkg uses to order and resolve them (how it picks an unpack and configure order, which break it chooses in a loop, how front-ends choose packages) is runtime behaviour, not part of the package file, and is not described here, in the same way as the maintainer scripts.
Dependsdeclares an absolute dependency. It takes effect only when a package is to be configured: a package will not be configured unless every package in itsDependsis configured (except in a circular dependency). It does not stop a package being on the system unconfigured while its dependencies are unsatisfied, and a properly installed package can be replaced by a version whose dependencies cannot be met; it is then left unconfigured. Policy says to use it when the other package is needed for a significant part of the functionality, or whenpostinstorprermneed the other package unpacked or configured. Forpostinst configurethe dependencies are unpacked and configured first; forprermand otherpostinstactions they are normally at least unpacked but may be only Half-Installed if an earlier upgrade of the dependency failed; forpostrmthere is no guarantee that they are available, and the script must skip actions that need an absent dependency. BecauseDependsonly orders configuration, the packages of one run are usually all unpacked first and all configured later.Pre-Dependsis likeDependsbut also forces dpkg to complete the installation of the named packages before it starts to install the declaring package. When the declaring package is about to be unpacked, the pre-dependency is met if the named package is fully configured, or is only Unpacked or Half-Configured provided it was correctly configured at some point in the past (and not removed or partly removed since); then both the earlier-configured and the current Unpacked or Half-Configured version must satisfy any version clause. When the declaring package is about to be configured it is treated as a normalDepends. UnlikeDepends, aPre-Dependsdoes not allow a circular dependency to be broken: if one is met while honouring it, the installation is aborted. It is also required ifpreinstneeds the named package, which Policy says is best avoided, and should be used sparingly.- Circular dependencies. If there is a loop among packages being installed or removed, an order that honours every dependency is impossible, so the loop is broken at some point and at least one package has its dependencies violated. If a package in the loop has no
postinst, the cycle is broken at that package; otherwise the breaking point is arbitrary. Packages should avoid circular dependencies, especially if they have apostinst. Recommendsis a strong but not absolute dependency: it lists the packages found together with this one in all but unusual installations.Suggestssays that one package may be more useful with others, but installing it without them is perfectly reasonable.EnhancesisSuggestsin the opposite direction and appears in the enhancing package’s control file. Policy says these three are used only by the front-ends to dpkg (apt-get,aptitude,dselect).Breaksappears in the version of the package that causes the named package to break. dpkg refuses to unpack the breaking package unless the broken one is deconfigured first, and refuses to let the broken package be reconfigured. Normally it has an “earlier than” version clause, introduced in the version that exposes a bug in, or takes over a file from, earlier versions of the broken package; it tells higher-level tools that the broken package must be upgraded first. Policy saysBreaksshould normally be used rather thanConflictswhen moving a file between packages, when splitting a package, and when the breaking package exposes a bug in particular versions of the broken one.Conflicts: dpkg will not unpack the two packages at the same time. When one is to be unpacked the other must be removed first; dpkg removes it automatically if the package being unpacked is marked as replacing it, or the installed one is marked deselected, or both areEssential; otherwise it stops the installation with an error (by design an error when the installed package isEssentialand the new one is not). Policy saysConflictsshould be used when two packages provide the same file and will keep doing so, together withProvideswhen only one provider of a virtual facility may be unpacked at a time, and when simultaneous installation must be prevented for ongoing reasons. An “earlier than” clause inConflictsprevents dpkg from upgrading or installing the declaring package until the conflicting package has been upgraded or removed, which Policy calls a strong restriction (and usually a sign thatBreakswas meant).Providesand virtual names. A virtual package is one that appears in some package’sProvides; the effect is as if the providing packages were named wherever the virtual name appears. If a concrete and a virtual package have the same name, either can satisfy the dependency or cause the conflict. To make one real package the default for a virtual dependency, list the real package as an alternative before the virtual one. A virtual facility that only one real package can provide at a time needs every provider toConflictswith the virtual name.Replaceshas two uses. First, to overwrite files of another package: dpkg then replaces the file of the old package with the new package’s file, which is no longer owned by the old package; Policy saysBreaksshould normally be used with it (its example:Replaces: foo (<< 1.2-3)andBreaks: foo (<< 1.2-3)infoo-data). A package left with no files dpkg knows of is considered to have “disappeared” (marked not wanted and Not-Installed; its conffile details ignored; itspostrmrun with a special argument). For this use virtual packages are not considered and the replaced packages must be named by their real names. It only takes effect when both packages are at least partly on the system at once. Second, to let the packaging system decide which package to remove when there is a conflict; this use only takes effect when the packages do conflict, and the replaced name may then be a virtual package (every mail transport agent hasProvides,ConflictsandReplacesofmail-transport-agent).Replacesis one way: the replacing package has to be installed after the replaced one.
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. Debian Policy: the absence of a revision is equivalent to a revision of 0 (so 1.0 and 1.0-0 are equal, and 1.0 sorts before 1.0-1, as deb-version(7) says); a version without a revision is a native package, one with a revision is non-native. It is conventional to restart the revision at 1 when the upstream version increases. |
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). The tilde and its special sorting were introduced in dpkg 1.10, and some parts of the dpkg build scripts gained support for it only later in the 1.10.x series (deb-version(7), “NOTES”). 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.
Version conventions in the Debian archive
Source: Debian Policy, ch-controlfields.rst (“Special version conventions”; the list “is not exhaustive”). The strings below are conventions that change how versions sort; dpkg does not interpret them.
| Pattern | Meaning |
|---|---|
no - revision | A native package. |
+really in the upstream version | A newer upstream was rolled back to an older one; the text after +really is the true upstream version, for example 2.3+really2.2-1 after 2.3-3. Used instead of a new epoch. |
revision ending .N | A non-maintainer upload (NMU) of a non-native package, with a source upload. |
native upstream version ending +nmuN | An NMU of a native package, with a source upload. |
+bN | A binary NMU: a binary-only upload without source changes (at the end of the upstream version of a native package or of the revision of a non-native one). |
revision +debNuX or ~debNuX; native +debNuX | A stable update for Debian release N, the Xth (from 1). +debNuX keeps the same upstream version (1.4-5+deb10u1); ~debNuX is a stable update to a new upstream version based on a newer unstable package (1.5-1~deb10u1); with a new upstream and no unstable package the revision is 0+debNuX (1.5-0+deb10u1). All sort before the later unstable version of the package. |
~bpoNuX | A backport to the stable release N, revision X (from 1); sorts before a stable update with the same upstream version. Conventions can stack: 1.4-5+deb10u1~bpo9u1. |
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); the text of deb-md5sums(5) says “absolute pathname” but its
example lines are relative, so the manual page disagrees with itself. Trailing slashes are trimmed; trailing white space and
empty lines are not accepted. Whether conffiles are listed is not stated. The file is for integrity
verification and deduplication, “and not for any kind of security purpose”.
If the file is missing from the package, dpkg generates the matching
information itself at unpack time (since dpkg 1.16.3).
conffiles
One absolute path per line, optionally preceded by a flag and white space. Trailing
white space is trimmed; empty lines and lines of only white space are not
accepted (deb-conffiles(5)).
| 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). |
Debian Policy’s rules for conffiles (section 10.7, ch-files.rst, raw):
- A conffile is a file listed in the package’s
conffiles, whichdpkgtreats specially. It is not the same as a configuration file: almost every conffile is a configuration file, but many configuration files are not conffiles. Configuration files live in/etc(symbolic links from elsewhere if a program needs another place)./etc/init.dscripts,/etc/defaultfiles, scripts in/etc/cron.{hourly,daily,weekly,monthly}and cron files in/etc/cron.dmust be treated as configuration files, and so must any script that embeds configuration information (10.7.1). - Behaviour required of every configuration file: local changes are kept when the package is upgraded, and the file is kept when the package is removed and deleted only when it is purged. Obsolete configuration files without local changes should be removed on upgrade.
- A conffile is the default version shipped in the package; it must not be changed by the maintainer scripts, during installation or at any other time. The maintainer scripts must not alter a conffile of any package, their own included.
- A package must not contain or make hard links to a conffile.
- The other way to handle a configuration file is from the maintainer scripts. Such a file must not be listed as a conffile and must not be in the package; the scripts create, update and maintain it, and remove it on purge. Those scripts must be idempotent, must cope with every way
dpkgcan call them, must not overwrite or mangle the user’s configuration without asking, and must not ask unnecessary questions (particularly during upgrades); they need only configure what gets the package running. An example or template file they use goes in/usr/share/packageor/usr/lib/package, depending on whether it is architecture-independent (/usr/share) or not (/usr/lib), as an ordinary file, linked from/usr/share/doc/package/examplesif it is an example. The two ways must not be mixed for one file (dpkgwould ask about overwriting it at every upgrade) (10.7.3). - If several packages use one configuration file and may be installed together, one of them is its owner and handles it as a configuration file; the others must depend on the owner if they need the file to work (no dependency if they can work without it). If the related packages must all be able to change it: the owner manages it with maintainer scripts, provides a program the others use to change it, and the others use only that program (depending on the owner, or accepting that they cannot change it). If it cannot be shared that way, the packages must conflict; alternatives and diversions are unlikely to be suitable, because
dpkgdoes not handle diverted conffiles well (10.7.4). Two packages that list the same file as a conffile must conflict. If one is removed (not purged) and the other installed, the new package takes the conffile over, and a user-modified file is treated like any other locally modified conffile.
templates
The debconf templates file holds the meta-data of the configuration questions: stanzas in RFC 822 form, separated by blank lines (Debian Configuration Management Specification, section 3.1, debian.org raw HTML). The meta-data is static: the debconf protocol cannot change it.
| Field | Meaning |
|---|---|
Template | The template’s name: components separated by /, each limited to letters, digits and + - . _. Usually a configuration variable of the same name uses it, but several variables may share one template. |
Type | So the data can be checked. The common types are below; implementations may define more. |
Choices | For select and multiselect: the possible values, separated by a comma and a space (Choices: yes, no, maybe). |
Default | The default value. For multiselect it is a comma-and-space separated list, like Choices. |
Description | The short description (about 50 characters at most) on the first line, then the extended description on continuation lines. The front end may word-wrap the extended description; a line holding only . separates paragraphs, and text indented by extra white space is not wrapped. Both descriptions may contain substitutions such as ${foo}, expanded when they are shown. |
Description-ll, Description-ll_LL, Description-ll_LL.encoding | Translations of the description. The same suffixes may be added to Choices of a select or multiselect question and to Default of a string or password question. |
| Type | Meaning |
|---|---|
string | Any string. |
boolean | true or false. |
select | One of the values in Choices. |
multiselect | Any number of the values in Choices; the value is a comma-and-space separated list. |
note | Important text the user should see; if it cannot be shown it may be saved to a log file or mailbox. |
text | Cosmetic text shown alongside other questions; simpler front ends may never show it. |
password | A password; the value entered is written to the debconf database. |
title | A short string shown with the SETTITLE command; only the short description is used. |
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 |
Rules from deb-triggers(5) (raw man/deb-triggers.pod), in addition to the table:
- Leading and trailing white space and everything after the first
#on a line are trimmed; blank lines are ignored. - All triggers a package is interested in must be listed with an
interestdirective. - Activations by
activatehappen at the start of: unpack, configure, remove (including when the package is removed for the benefit of a conflicting package), purge and deconfigure. - If the package disappears while another package is being unpacked, its triggers are activated when the disappearance is noticed, near the end of that unpack.
- Trigger processing, and the change from triggers-awaited to installed, do not cause activations.
- On unpack, triggers named in both the old and the new version of the package are activated.
- Await and noawait: an
-awaitactivation puts the activating package in the triggers-awaited state only if the interest is also an await one; a-noawaitactivation never does. Aninterest-noawaitforces noawait whatever the activation asked, including adpkg-trigger --no-await; withinterestorinterest-awaitthe mode follows how the trigger was activated. - The
-noawaitvariants (dpkg 1.16.1) and the-awaitaliases (dpkg 1.17.21) make older dpkg fail on the file.
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. deb-shlibs(5) says the dependencies
must mention the most recent version of the package that added new symbols
to the library, and adds: “This is not the only reason the dependencies might need to
be tightened.” Debian Policy (ch-sharedlibs.rst, “The shlibs File Format”)
states the requirement as: the version restriction must be new enough that any binary
built against the current version of the library will work with any version of the
shared library that satisfies the dependency. Policy’s example: if the last change to
zlib1g that could change behaviour for a client was in
1:1.2.3.3.dfsg-1, the entry is libz 1 zlib1g (>= 1:1.2.3.3.dfsg).
The optional type is normally not needed; the only type in use is udeb (Debian Policy, ch-sharedlibs.rst, “The shlibs File Format”): it marks a line that is valid for udeb packages, and the colon and the space after it are required, as in udeb: libz 1 zlib1g-udeb (>= 1:1.2.3.3.dfsg), written beside the ordinary line libz 1 zlib1g (>= 1:1.2.3.3.dfsg) when the package also has a udeb. Lines starting with
# are comments; blank lines are not allowed.
Example: libcrunch 1 libcrunch1 (>= 1.2-1). The file is
debian/shlibs, debian/binary-name.shlibs in a source tree and
DEBIAN/shlibs in the package, and must ship in the same binary package as the libraries
it describes, so the mapping matches and can be found from the package that owns the library. Library and
version are separated by white space. A shared-library package must ship either a
symbols or a shlibs file (Policy). A library that has a
udeb must also ship shlibs, because udebs do not support
symbols.
SONAME forms
Two SONAME formats are supported (deb-shlibs(5), “SONAME FORMATS”), where
name is usually prefixed by lib:
| Form | Use | Library and version fields |
|---|---|---|
name.so.version | Tends to be used by shared libraries with stable interfaces. | For libcrunch.so.1: library libcrunch, version 1, as in the example above. |
name-version.so | Shared libraries with unstable interfaces: the whole version becomes part of the SONAME and must be given in full when linking against the library. | The manual page gives no example for this form. |
A shlibs file records a SONAME as a library name and a version, such as libfoo VERSION, not the SONAME itself. Policy’s footnote: if the SONAME does not match one of these two forms (libfoo-VERSION.so or libfoo.so.VERSION), it cannot be represented in a shlibs file. Policy also says shlibs files only support a limited range of SONAMEs, which makes them difficult to use in some unusual corner cases, and that symbols files are therefore recommended for most shared library packages (shlibs for most C++ libraries, where exhaustive symbol information is onerous to keep).
Dependency versions in shlibs and symbols files
Policy (ch-sharedlibs.rst, “Shared library ABI changes”): when a library adds an interface that a binary can detect at build time (its example is a new enum value that a function accepts), the minimal version of that function in a symbols file, or the version in the dependency of a shlibs file, must be raised to the version that introduced it. Otherwise a binary built against the new library could be installed with an older library that does not support it and fail at run time. Versions in either file normally should not contain the Debian revision, since the behaviour of a library is normally fixed for an upstream version and every Debian packaging of that upstream version behaves the same. In the rare case that the behaviour changed in a particular Debian revision, Policy recommends appending ~ to the end of the version that includes the revision, so that a backport of the library package, which uses the usual backport versioning, can satisfy the dependency.
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 minimal version, and optionally which alternative template to use. Fields separated by exactly one space. For C++ the name is the mangled symbol. The minimal version is the most recent version of the shared library that changed the behaviour of that symbol, whether by adding it, changing its function signature (the parameters, their types or the return type), or changing its behaviour in a way that is visible to a caller (Policy, ch-sharedlibs.rst). |
#MINVER# in a template becomes (>= min-version)
or nothing. Policy’s example: compress@Base 1:1.1.4 (no symbol version; last changed its behaviour in upstream 1:1.1.4) and compressBound@ZLIB_1.2.0 1:1.2.0; a package using only compress gets zlib1g (>= 1:1.1.4), one using compressBound gets zlib1g (>= 1:1.2.0). A package that provides a shared library must ship either a symbols or a shlibs file, and a symbols file must ship in the same binary package as the libraries it describes. udebs do not support symbols; use shlibs for them.
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
Symbol tags and the source template
The file a package ships is plain. The template in the source package
(debian/symbols, debian/package.symbols and the
same with an architecture suffix) is a superset that dpkg-gensymbols
turns into it; deb-src-symbols(5) describes it. A line starting with
# is a comment unless it starts with #include; a line
starting #MISSING: records a symbol that has disappeared. Two more
metavariables exist in templates: #PACKAGE# (the real package name) and
#CURVER# (a (= binary-version) constraint, dpkg
1.23.4).
A tag list goes directly before the symbol name with no space, in parentheses,
tags separated by |, a value after =; names and values
cannot contain ), | or =. A name that follows a tag list may be quoted
with ' or " to hold spaces; if no tags are specified for the symbol, quote characters are part of the name, which continues up to the first space. For example (tag1=i am marked|tag name with space)"tagged quoted symbol"@Base 1.0 names the symbol tagged quoted symbol with two tags, while untagged_symbol@Base 1.0 is untagged. Without -t,
dpkg-gensymbols acts on the tags and removes them from its output; with
-t it keeps every tag, known or not.
| Tag | Meaning |
|---|---|
optional | The symbol may vanish without making dpkg-gensymbols fail; it stays reported as MISSING in each diff. May carry a value giving the reason. |
arch=list | Only for the listed architectures, in Build-Depends syntax without brackets, for example arm64 any-amd64 riscv64, linux-any or !armel. |
arch-bits=32|64 | Only for that word size (dpkg 1.18.0). |
arch-endian=little|big | Only for that byte order (dpkg 1.18.0). Tags chain: (arch-bits=32|arch-endian=little)name@Base 1.0. |
allow-internal | Keeps a symbol that dpkg-gensymbols would otherwise drop as a toolchain implementation detail, as in libgcc (dpkg 1.20.1). |
c++ | Pattern: the name is matched against the demangled form from c++filt, for symbols whose mangled names differ between architectures. |
symver | Pattern: matches every symbol of one symbol version, as in (symver)GLIBC_2.7 2.7. |
regex | Pattern: a Perl regular expression matched against name@version, as in (regex)"^mystack_.*@Base$" 1.0. |
Patterns are tried only for symbols with no explicit entry. Explicit entries win;
then the alias patterns (c++, symver); then generic ones
(regex and combinations), in file order. Patterns combine in the order
written, as (c++|regex), and a match inherits other tags, so
(regex|optional)"private" 1.0 makes every match optional. A pattern that
matches nothing is “lost” and fails the check at -c1 and above unless it
is optional. The older wildcard form *@GLIBC_2.0 2.0 still
works but is deprecated in favour of (symver|optional)GLIBC_2.0 2.0.
A tagged #include "file" gives every included symbol those tags; included
symbols can add or override tags but not remove inherited ones. The file is read
line by line and an include is processed as soon as it is encountered, so included
content can override anything that appeared before the directive, and anything after
it can override the included content. An included file can repeat the header line
with the library’s SONAME, which then overrides any header line read earlier;
duplicating header lines is best avoided (for example by putting only
#include "libsomething1.symbols.common" and then the architecture-specific
symbol lines in the including file).
Sources: deb-src-symbols(5) and deb-symbols(5) on
manpages.debian.org (unstable), read 13 November 2026. Neither page gives dpkg
versions for optional, arch, c++,
symver or regex. The dpkg-gensymbols(1) page
(its options and exit status) was not read.
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.
Scope: this page gives each script’s name, the arguments it is called with and the rules the scripts themselves must follow, which is what the package file holds. The order in which dpkg calls them during an install, upgrade or removal, what it guarantees at each call, and how it unwinds after an error (Debian Policy 6.5 to 6.8) are dpkg’s runtime behaviour, not part of the file format, and are not described here.
| 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, or failed on failed-upgrade (deb-preinst(5)). |
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, or failed on failed-upgrade (deb-postinst(5)). |
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. The
maintainer-script, shlibs and md5sums sections were re-checked on 2026-11-14 against the raw manual page sources
(man/deb-prerm.pod, deb-preinst.pod, deb-postinst.pod,
deb-postrm.pod, deb-shlibs.pod, deb-md5sums.pod in
salsa.debian.org/dpkg-team/dpkg). Debian Policy (raw policy/*.rst from
salsa.debian.org/dbnpolicy/policy): ch-controlfields.rst (syntax of control files, the
binary control fields, Version and its conventions), ch-relationships.rst,
ch-maintainerscripts.rst, ch-binary.rst (package metadata files, debconf),
ch-archive.rst (sections and priorities) and ch-sharedlibs.rst (the
shlibs format). Also read raw this session: deb-triggers.pod, deb-conffiles.pod,
deb-version.pod and deb-control.pod. Read raw again on
2026-11-14 (curl from salsa.debian.org): deb-email.pod,
deb-substvars.pod, deb-symbols.pod, deb-shlibs.pod,
deb-src-symbols.pod, deb-control.pod, deb-version.pod,
and Policy ch-sharedlibs.rst, ch-controlfields.rst and
ch-binary.rst.