dpkg(1) dpkg suite dpkg(1)
dpkg - package manager for Debian
dpkg [options] action
This manual is intended for users wishing to understand dpkg's command
line options and package states in more detail than that provided by
It should not be used by package maintainers wishing to understand how
dpkg will install their packages. The descriptions of what dpkg does
when installing and removing packages are particularly inadequate.
dpkg is a tool to install, build, remove and manage Debian packages.
The primary and more user-friendly front-end for dpkg is aptitude(1).
dpkg itself is controlled entirely via command line parameters, which
consist of exactly one action and zero or more options. The action-
parameter tells dpkg what to do and options control the behavior of the
action in some way.
dpkg can be also be used as a front-end to dpkg-deb(1). The following
are dpkg-deb actions, and if they are encountered, dpkg just runs
dpkg-deb with the parameters given to it:
-X, --vextract, and
Please refer to dpkg-deb(1) for information about these actions.
INFORMATION ABOUT PACKAGES
dpkg maintains some usable information about available packages. The
information is divided in three classes: states, selection states and
flags. These values are intended to be changed mainly with dselect.
The package is not installed on your system.
Only the configuration files of the package exist on the system.
The installation of the package has been started, but not com-
pleted for some reason.
The package is unpacked, but not configured.
The package is unpacked and configuration has been started, but
not yet completed for some reason.
The package awaits trigger processing by another package.
The package has been triggered.
The package is unpacked and configured OK.
PACKAGE SELECTION STATES
The package is selected for installation.
The package is selected for deinstallation (i.e. we want to
remove all files, except configuration files).
purge The package is selected to be purged (i.e. we want to remove
everything, even configuration files).
hold A package marked to be on hold is not handled by dpkg, unless
forced to do that with option --force-hold.
A package marked reinst-required is broken and requires rein-
stallation. These packages cannot be removed, unless forced with
-i, --install package_file...
Install the package. If --recursive or -R option is specified,
package_file must refer to a directory instead.
Installation consists of the following steps:
1. Extract the control files of the new package.
2. If another version of the same package was installed before
the new installation, execute prerm script of the old package.
3. Run preinst script, if provided by the package.
4. Unpack the new files, and at the same time back up the old
files, so that if something goes wrong, they can be restored.
5. If another version of the same package was installed before
the new installation, execute the postrm script of the old pack-
age. Note that this script is executed after the preinst script
of the new package, because new files are written at the same
time old files are removed.
6. Configure the package. See --configure for detailed informa-
tion about how this is done.
Unpack the package, but don't configure it. If --recursive or -R
option is specified, package_file must refer to a directory
Reconfigure an unpacked package. If -a or --pending is given
instead of package, all unpacked but unconfigured packages are
Configuring consists of the following steps:
1. Unpack the configuration files, and at the same time back up
the old configuration files, so that they can be restored if
something goes wrong.
2. Run postinst script, if provided by the package.
Processes only triggers. All pending triggers will be processed.
If package names are supplied only those packages' triggers will
be processed, exactly once each where necessary. Use of this
option may leave packages in the improper triggers-awaited and
triggers-pending states. This can be fixed later by running:
dpkg --configure --pending.
-r, --remove, -P, --purge package...|-a|--pending
Remove an installed package. -r or --remove remove everything
except configuration files. This may avoid having to reconfigure
the package if it is reinstalled later. (Configuration files are
the files listed in the debian/conffiles control file). -P or
--purge removes everything, including configuration files. If -a
or --pending is given instead of a package name, then all pack-
ages unpacked, but marked to be removed or purged in file
/var/lib/dpkg/status, are removed or purged, respectively.
Removing of a package consists of the following steps:
1. Run prerm script
2. Remove the installed files
3. Run postrm script
--update-avail, --merge-avail Packages-file
Update dpkg's and dselect's idea of which packages are avail-
able. With action --merge-avail, old information is combined
with information from Packages-file. With action --update-avail,
old information is replaced with the information in the Pack-
ages-file. The Packages-file distributed with Debian is simply
named Packages. dpkg keeps its record of available packages in
A simpler one-shot command to retrieve and update the available
file is dselect update.
-A, --record-avail package_file...
Update dpkg and dselect's idea of which packages are available
with information from the package package_file. If --recursive
or -R option is specified, package_file must refer to a direc-
Forget about uninstalled unavailable packages.
Erase the existing information about what packages are avail-
Searches for packages that have been installed only partially on
your system. dpkg will suggest what to do with them to get them
Get list of package selections, and write it to stdout. Without
a pattern, packages marked with state purge will not be shown.
Set package selections using file read from stdin. This file
should be in the format '<package> <state>', where state is one
of install, hold, deinstall or purge. Blank lines and comment
lines beginning with '#' are also permitted.
Set the requested state of every non-essential package to dein-
stall. This is intended to be used immediately before
--set-selections, to deinstall any packages not in list given to
Searches for packages selected for installation, but which for
some reason still haven't been installed.
Print architecture of packages dpkg installs (for example,
--compare-versions ver1 op ver2
Compare version numbers, where op is a binary operator. dpkg
returns success (zero result) if the specified condition is sat-
isfied, and failure (nonzero result) otherwise. There are two
groups of operators, which differ in how they treat an empty
ver1 or ver2. These treat an empty version as earlier than any
version: lt le eq ne ge gt. These treat an empty version as
later than any version: lt-nl le-nl ge-nl gt-nl. These are pro-
vided only for compatibility with control file syntax: << <<<< <<= =
>>= >>>> >>.
Accept a series of commands on input file descriptor <n>. Note:
additional options set on the command line, and thru this file
descriptor, are not reset for subsequent commands executed dur-
ing the same run.
--help Display a brief help message.
Give help about the --force-thing options.
Give help about debugging options.
Display dpkg licence.
Display dpkg version information.
See dpkg-deb(1) for more information about the following
-b, --build directory [archive|directory]
Build a deb package.
-c, --contents archive
List contents of a deb package.
-e, --control filename [directory]
Extract control-information from a package.
-x, --extract archive directory
Extract the files contained by package.
-X, --vextract archive directory
Extract and display the filenames contained by a
-f, --field archive [control-field...]
Display control field(s) of a package.
Display the filesystem tar-file contained by a
-I, --info archive [control-file...]
Show information about a package.
See dpkg-query(1) for more information about the following
-l, --list package-name-pattern...
List packages matching given pattern.
-s, --status package-name...
Report status of specified package.
-L, --listfiles package-name...
List files installed to your system from package-name.
-S, --search filename-search-pattern...
Search for a filename from installed packages.
-p, --print-avail package-name...
Display details about package-name, as found in
All options can be specified both on the command line and in the dpkg
configuration file /etc/dpkg/dpkg.cfg. Each line in the configuration
file is either an option (exactly the same as the command line option
but without leading dashes) or a comment (if it starts with a #).
Change after how many errors dpkg will abort. The default is 50.
When a package is removed, there is a possibility that another
installed package depended on the removed package. Specifying
this option will cause automatic deconfiguration of the package
which depended on the removed package.
Switch debugging on. octal is formed by bitwise-orring desired
values together from the list below (note that these values may
change in future releases). -Dh or --debug=help display these
1 Generally helpful progress information
2 Invocation and status of maintainer scripts
10 Output for each file processed
100 Lots of output for each file processed
20 Output for each configuration file
200 Lots of output for each configuration file
40 Dependencies and conflicts
400 Lots of dependencies/conflicts output
10000 Trigger activation and processing
20000 Lots of output regarding triggers
40000 Silly amounts of output regarding triggers
1000 Lots of drivel about e.g. the dpkg/info dir
2000 Insane amounts of drivel
--force-things, --no-force-things, --refuse-things
Force or refuse (no-force and refuse mean the same thing) to do
some things. things is a comma separated list of things speci-
fied below. --force-help displays a message describing them.
Things marked with (*) are forced by default.
Warning: These options are mostly intended to be used by experts
only. Using them without fully understanding their effects may
break your whole system.
all: Turns on (or off) all force options.
downgrade(*): Install a package, even if newer version of it is
Warning: At present dpkg does not do any dependency checking on
downgrades and therefore will not warn you if the downgrade
breaks the dependency of some other package. This can have seri-
ous side effects, downgrading essential system components can
even make your whole system unusable. Use with care.
configure-any: Configure also any unpacked but unconfigured
packages on which the current package depends.
hold: Process packages even when marked "hold".
remove-reinstreq: Remove a package, even if it's broken and
marked to require reinstallation. This may, for example, cause
parts of the package to remain on the system, which will then be
forgotten by dpkg.
remove-essential: Remove, even if the package is considered
essential. Essential packages contain mostly very basic Unix
commands. Removing them might cause the whole system to stop
working, so use with caution.
depends: Turn all dependency problems into warnings.
depends-version: Don't care about versions when checking depen-
breaks: Install, even if this would break another package.
conflicts: Install, even if it conflicts with another package.
This is dangerous, for it will usually cause overwriting of some
confmiss: Always install a missing configuration file. This is
dangerous, since it means not preserving a change (removing)
made to the file.
confnew: If a conffile has been modified always install the new
version without prompting, unless the --force-confdef is also
specified, in which case the default action is preferred.
confold: If a conffile has been modified always keep the old
version without prompting, unless the --force-confdef is also
specified, in which case the default action is preferred.
confdef: If a conffile has been modified always choose the
default action. If there is no default action it will stop to
ask the user unless --force-confnew or --force-confold is also
been given, in which case it will use that to decide the final
overwrite: Overwrite one package's file with another's file.
overwrite-dir Overwrite one package's directory with another's
overwrite-diverted: Overwrite a diverted file with an undiverted
architecture: Process even packages with the wrong architecture.
bad-path: PATH is missing important programs, so problems are
not-root: Try to (de)install things even when not root.
bad-verify: Install a package even if it fails authenticity
Ignore dependency-checking for specified packages (actually,
checking is performed, but only warnings about conflicts are
given, nothing else).
Select new or old binary package format. This is a dpkg-deb(1)
Don't read or check contents of control file while building a
package. This is a dpkg-deb(1) option.
--no-act, --dry-run, --simulate
Do everything which is supposed to be done, but don't write any
changes. This is used to see what would happen with the speci-
fied action, without actually modifying anything.
Be sure to give --no-act before the action-parameter, or you
might end up with undesirable results. (e.g. dpkg --purge foo
--no-act will first purge package foo and then try to purge
package --no-act, even though you probably expected it to actu-
ally do nothing)
Recursively handle all regular files matching pattern *.deb
found at specified directories and all of its subdirectories.
This can be used with -i, -A, --install, --unpack and --avail
-G Don't install a package if a newer version of the same package
is already installed. This is an alias of --refuse-downgrade.
Change default administrative directory, which contains many
files that give information about status of installed or unin-
stalled packages, etc. (Defaults to /var/lib/dpkg)
Change default installation directory which refers to the direc-
tory where packages are to be installed. instdir is also the
directory passed to chroot(2) before running package's installa-
tion scripts, which means that the scripts see instdir as a root
directory. (Defaults to /)
Changing root changes instdir to dir and admindir to
Only process the packages that are selected for installation.
The actual marking is done with dselect or by dpkg, when it han-
dles packages. For example, when a package is removed, it will
be marked selected for deinstallation.
Don't install the package if the same version of the package is
Send machine-readable package status and progress information to
file descriptor n. This option can be specified multiple times.
The information is generally one record per line, in one of the
status: package: status
Package status changed; status is as in the status file.
status: package : error : extended-error-message
An error occurred. Unfortunately at the time of writing
extended-error-message can contain newlines, although in
locales where the translators have not made mistakes
every newline is followed by at least one space.
status: file : conffile-prompt : 'real-old' 'real-new' usered-
User is being asked a configuration file question.
processing: stage: package
Sent just before a processing stage starts. stage is one
of upgrade, install (both sent before unpacking), config-
ure, trigproc, remove, purge.
Log status change updates and actions to filename, instead of
the default /var/log/dpkg.log. If this option is given multiple
times, the last filename is used. Log messages are of the form
`YYYY-MM-DD HH:MM:SS status <state> <pkg> <installed-version>'
for status change updates; `YYYY-MM-DD HH:MM:SS <action> <pkg>
<installed-version> <available-version>' for actions where
<action> is one of install, upgrade, remove, purge; and `YYYY-
MM-DD HH:MM:SS conffile <filename> <decision>' for conffile
changes where <decision> is either install or keep.
Do not try to verify package signatures.
Do not run any triggers in this run (activations will still be
recorded). If used with --configure package or --triggers-only
package then the named package postinst will still be run even
if only a triggers run is needed. Use of this option may leave
packages in the improper triggers-awaited and triggers-pending
states. This can be fixed later by running: dpkg --configure
Cancels a previous --no-triggers.
Configuration file with default options.
Default log file (see /etc/dpkg/dpkg.cfg(5) and option --log).
The other files listed below are in their default directories, see
option --admindir to see how to change locations of these files.
List of available packages.
Statuses of available packages. This file contains information
about whether a package is marked for removing or not, whether
it is installed or not, etc. See section INFORMATION ABOUT PACK-
AGES for more info.
The following files are components of a binary package. See deb(5) for
more information about them:
Define this to something if you prefer dpkg starting a new shell
rather than suspending itself, while doing a shell escape.
SHELL The program dpkg will execute when starting a new shell.
Sets the number of columns dpkg should use when displaying for-
matted text. Currently only used by -l.
To list packages related to the editor vi(1):
dpkg -l '*vi*'
To see the entries in /var/lib/dpkg/available of two packages:
dpkg --print-avail elvis vim | less
To search the listing of packages yourself:
To remove an installed elvis package:
dpkg -r elvis
To install a package, you first need to find it in an archive or CDROM.
The "available" file shows that the vim package is in section "edi-
dpkg -i vim_4.5-3.deb
To make a local copy of the package selection states:
dpkg --get-selections >>myselections
You might transfer this file to another computer, and install it there
dpkg --set-selections <<myselections
Note that this will not actually install or remove anything, but just
set the selection state on the requested packages. You will need some
other application to actually download and install the requested pack-
ages. For example, run apt-get dselect-upgrade.
Ordinarily, you will find that dselect(1) provides a more convenient
way to modify the package selection states.
Additional functionality can be gained by installing any of the follow-
ing packages: apt, aptitude and debsums.
aptitude(1), apt(1), dselect(1), dpkg-deb(1), dpkg-query(1), deb(5),
deb-control(5), dpkg.cfg(5), and dpkg-reconfigure(8).
--no-act usually gives less information than might be helpful.
See /usr/share/doc/dpkg/THANKS for the list of people who have contrib-
uted to dpkg.
Debian Project 2008-04-06 dpkg(1)