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 can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
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
package. 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 information about how this is done.
To reconfigure a package which has already been configured, try the dpkg-reconfigure(8) command instead.
Configuring consists of the following steps:
1. Unpack the conffiles, and at the same time back up
the old conffiles, so that they can be restored if
something goes wrong.
2. Run postinst script, if provided by the package.
Removing of a package consists of the following steps:
1. Run prerm script
2. Remove the installed files
3. Run postrm script
Note: some configuration files might be unknown to dpkg because they are created and handled separately through the configuration scripts. In that case, dpkg won't remove them by itself, but the package's postrm script (which is called by dpkg), has to take care of their removal during purge. Of course, this only applies to files in system directories, not configuration files written to individual users' home directories.
Purging of a package consists of the following steps:
1. Remove the package, if not already removed. See --remove
for detailed information about how this is done.
2. Run postrm script.
Currently the only functional check performed is an md5sum verification against the stored value in the files database. It will only get checked if the database contains the file md5sum. To check for any missing metadata in the database, the --audit command can be used.
The output format is selectable with the --verify-format option, which by default uses the rpm format, but that might change in the future, and as such, programs parsing this command output should be explicit about the format they expect.
A simpler one-shot command to retrieve and update the available file is dselect update. Note that this file is mostly useless if you don't use dselect but an APT-based frontend: APT has its own system to keep track of available packages.
The available file needs to be up-to-date for this command to be useful, otherwise unknown packages will be ignored with a warning. See the --update-avail and --merge-avail commands for more information.
-b, --build directory [archive|directory] Build a deb package. -c, --contents archive List contents of a deb package. -e, --control archive [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 package. -f, --field archive [control-field...] Display control field(s) of a package. --ctrl-tarfile archive Output the control tar-file contained in a Debian package. --fsys-tarfile archive Output the filesystem tar-file contained by a Debian package. -I, --info archive [control-file...] Show information about a package.
-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 /var/lib/dpkg/available. Users of APT-based frontends should use apt-cache show package-name instead.
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
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 already installed.
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 serious 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 dependencies.
breaks: Install, even if this would break another package (since dpkg 1.14.6).
conflicts: Install, even if it conflicts with another package. This is dangerous, for it will usually cause overwriting of some files.
confmiss: If a conffile is missing and the version in the package did change, always install the missing conffile without prompting. This is dangerous, since it means not preserving a change (removing) made to the file.
confnew: If a conffile has been modified and the version in the package did change, 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 and the version in the package did change, 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 and the version in the package did change, always choose the default action without prompting. 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 action.
confask: If a conffile has been modified always offer to replace it with the version in the package, even if the version in the package did not change (since dpkg 1.15.8). If any of --force-confmiss, --force-confnew, --force-confold, or --force-confdef is also given, it will be used to decide the final action.
overwrite: Overwrite one package's file with another's file.
overwrite-dir: Overwrite one package's directory with another's file.
overwrite-diverted: Overwrite a diverted file with an undiverted version.
unsafe-io: Do not perform safe I/O operations when unpacking (since dpkg 18.104.22.168). Currently this implies not performing file system syncs before file renames, which is known to cause substantial performance degradation on some file systems, unfortunately the ones that require the safe I/O on the first place due to their unreliable behaviour causing zero-length files on abrupt system crashes.
Note: For ext4, the main offender, consider using instead the mount option nodelalloc, which will fix both the performance degradation and the data safety issues, the latter by making the file system not produce zero-length files on abrupt system crashes with any software not doing syncs before atomic renames.
Warning: Using this option might improve performance at the cost of losing data, use with care.
architecture: Process even packages with wrong or no architecture.
bad-version: Process even packages with wrong versions (since dpkg 1.16.1).
bad-path: PATH is missing important programs, so problems are likely.
not-root: Try to (de)install things even when not root.
bad-verify: Install a package even if it fails authenticity check.
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 actually do nothing)
Warning: take into account that depending on the excluded paths you might completely break your system, use with caution.
The glob patterns use the same wildcards used in the shell, were '*' matches any sequence of characters, including the empty string and also '/'. For example, «/usr/*/READ*» matches «/usr/share/doc/package/README». As usual, '?' matches any single character (again, including '/'). And '[' starts a character class, which can contain a list of characters, ranges and complementations. See glob(7) for detailed information about globbing. Note: the current implementation might re-include more directories and symlinks than needed, to be on the safe side and avoid possible unpack failures, future work might fix this.
This can be used to remove all paths except some particular ones; a typical case is:
to remove all documentation files except the copyright files.
These two options can be specified multiple times, and interleaved with each other. Both are processed in the given order, with the last rule that matches a file name making the decision.
The only currently supported output format is rpm, which consists of a line for every path that failed any check. The lines start with 9 characters to report each specific check result, a '?' implies the check could not be done (lack of support, file permissions, etc), '.' implies the check passed, and an alphanumeric character implies a specific check failed; the md5sum verification is denoted with a '5' on the third character. The line is followed by a space and an attribute character (currently 'c' for conffiles), another space and the pathname.
The other files listed below are in their default directories, see option --admindir to see how to change locations of these files.
The status file is backed up daily in /var/backups. It can be useful if it's lost or corrupted due to filesystems troubles.
The following files are components of a binary package. See deb(5) for more information about them:
control conffiles preinst postinst prerm postrm triggers
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
cd /media/cdrom/pool/main/v/vim 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 after having updated
the available file there with your package manager frontend of choice
(see https://wiki.debian.org/Teams/Dpkg/FAQ for more details), for example:
apt-cache dumpavail | dpkg --merge-avail
or with dpkg 1.17.6 and earlier:
avail=`mktemp` apt-cache dumpavail >"$avail" dpkg --merge-avail "$avail" rm "$avail"
you can install it with:
dpkg --clear-selections 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 packages. 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.