1 # dpkg manual page - dpkg(1)
3 # Copyright © 1996 Juho Vuori <javuori@cc.helsinki.fi>
4 # Copyright © 1999 Jim Van Zandt <jrv@vanzandt.mv.com>
5 # Copyright © 1999-2003 Wichert Akkerman <wakkerma@debian.org>
6 # Copyright © 2000-2003 Adam Heath <doogie@debian.org>
7 # Copyright © 2002 Josip Rodin
8 # Copyright © 2004-2005 Scott James Remnant <keybuk@debian.org>
9 # Copyright © 2006-2016 Guillem Jover <guillem@debian.org>
10 # Copyright © 2007-2008 Ian Jackson <ijackson@chiark.greenend.org.uk>
11 # Copyright © 2008-2011 Raphaël Hertzog <hertzog@debian.org>
13 # This is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <https://www.gnu.org/licenses/>.
30 dpkg - package manager for Debian
35 [I<option>...] I<action>
39 This manual is intended for users wishing to understand B<dpkg>'s
40 command line options and package states in more detail than that
41 provided by B<dpkg --help>.
43 It should I<not> be used by package maintainers wishing to
44 understand how B<dpkg> will install their packages.
46 descriptions of what B<dpkg> does when installing and removing
47 packages are particularly inadequate.
51 B<dpkg> is a medium-level tool to install, build, remove and manage
53 The primary and more user-friendly front-end for B<dpkg>
54 as a CLI (command-line interface) is L<apt(8)> and
55 as a TUI (terminal user interface) is L<aptitude(8)>.
57 controlled entirely via command line parameters, which consist of exactly
58 one action and zero or more options.
59 The action-parameter tells B<dpkg>
60 what to do and options control the behavior of the action in some way.
62 B<dpkg> can also be used as a front-end to L<dpkg-deb(1)> and
64 The list of supported actions can be found later on in the B<ACTIONS> section.
65 If any such action is encountered B<dpkg>
66 just runs B<dpkg-deb> or B<dpkg-query> with the parameters given
67 to it, but no specific options are currently passed to them, to use
68 any such option the back-ends need to be called directly.
70 =head1 INFORMATION ABOUT PACKAGES
72 B<dpkg> maintains some usable information about available
74 The information is divided in three classes: B<states>,
75 B<selection states> and B<flags>.
76 These values are intended to
77 be changed mainly with B<dselect>.
83 =item B<not-installed>
85 The package is not installed on your system.
89 Only the configuration files or the B<postrm> script and the data it needs
90 to remove of the package exist on the system.
92 =item B<half-installed>
94 The installation of the package has been started, but not completed for
99 The package is unpacked, but not configured.
101 =item B<half-configured>
103 The package is unpacked and configuration has been started, but not yet
104 completed for some reason.
106 =item B<triggers-awaited>
108 The package awaits trigger processing by another package.
110 =item B<triggers-pending>
112 The package has been triggered.
116 The package is correctly unpacked and configured.
120 =head2 Package selection states
126 The package is selected for installation.
130 A package marked to be on B<hold> is kept on the same version, that is,
131 no automatic new installs, upgrades or removals will be performed on them,
132 unless these actions are requested explicitly, or are permitted to be done
133 automatically with the B<--force-hold> option.
137 The package is selected for deinstallation (i.e. we want to remove all
138 files, except configuration files).
142 The package is selected to be purged (i.e. we want to remove everything
143 from system directories, even configuration files).
147 The package selection is unknown.
148 A package that is also in a B<not-installed> state, and with an
149 B<ok> flag will be forgotten in the next database store.
159 A package marked B<ok> is in a known state, but might need further
164 A package marked B<reinstreq> is broken and requires
166 These packages cannot be removed, unless forced with
167 option B<--force-remove-reinstreq>.
175 =item B<-i>, B<--install> I<package-file>...
178 If B<--recursive> or B<-R> option is
179 specified, I<package-file> must refer to a directory instead.
181 Installation consists of the following steps:
187 Extract the control files of the new package.
191 If another version of the same package was installed before
192 the new installation, execute I<prerm> script of the old package.
196 Run I<preinst> script, if provided by the package.
200 Unpack the new files, and at the same time back up the old
201 files, so that if something goes wrong, they can be restored.
205 If another version of the same package was installed before
206 the new installation, execute the I<postrm> script of the old
208 Note that this script is executed after the I<preinst>
209 script of the new package, because new files are written at the same
210 time old files are removed.
214 Configure the package.
215 See B<--configure> for detailed
216 information about how this is done.
220 =item B<--unpack> I<package-file>...
222 Unpack the package, but don't configure it.
224 B<-R> option is specified, I<package-file> must refer to a
227 Will process triggers for B<Pre-Depends> unless B<--no-triggers> has
230 =item B<--configure> I<package>...|B<-a>|B<--pending>
232 Configure a package which has been unpacked but not yet configured.
233 If B<-a> or B<--pending> is given instead of I<package>,
234 all unpacked but unconfigured packages are configured.
236 To reconfigure a package which has already been configured, try the
237 L<dpkg-reconfigure(8)> command instead (which is part of the B<debconf>
240 Configuring consists of the following steps:
246 Unpack the conffiles, and at the same time back up
247 the old conffiles, so that they can be restored if
248 something goes wrong.
252 Run I<postinst> script, if provided by the package.
256 Will process triggers unless B<--no-triggers> has been specified.
258 =item B<--triggers-only> I<package>...|B<-a>|B<--pending>
260 Processes only triggers (since dpkg 1.14.17).
261 All pending triggers will be processed.
263 names are supplied only those packages' triggers will be processed, exactly
264 once each where necessary.
265 Use of this option may leave packages in the improper B<triggers-awaited>
266 and B<triggers-pending> states.
268 can be fixed later by running: B<dpkg --configure --pending>.
270 =item B<-r>, B<--remove> I<package>...|B<-a>|B<--pending>
272 Remove an installed package.
273 This removes everything except conffiles and other data cleaned up by
274 the I<postrm> script,
275 which may avoid having to reconfigure the package if it is reinstalled
276 later (conffiles are configuration files that are listed in the
277 I<DEBIAN/conffiles> control file).
278 If there is no I<DEBIAN/conffiles> control file nor I<DEBIAN/postrm>
279 script, this command is equivalent to calling B<--purge>.
280 If B<-a> or B<--pending> is given instead of a package name,
281 then all packages unpacked, but marked to be removed in file
282 I<%ADMINDIR%/status>, are removed.
284 Removing of a package consists of the following steps:
294 Remove the installed files.
298 Run I<postrm> script.
302 Will process triggers unless B<--no-triggers> has been specified.
304 =item B<-P>, B<--purge> I<package>...|B<-a>|B<--pending>
306 Purge an installed or already removed package.
307 This removes everything,
308 including conffiles, and anything else cleaned up from I<postrm>.
309 If B<-a> or B<--pending> is given instead of a package name,
310 then all packages unpacked or removed, but marked to be purged in file
311 I<%ADMINDIR%/status>, are purged.
313 B<Note>: Some configuration files might be unknown to B<dpkg> because they
314 are created and handled separately through the configuration scripts.
316 that case, B<dpkg> won't remove them by itself, but the package's
317 I<postrm> script (which is called by B<dpkg>), has to take care of
318 their removal during purge.
319 Of course, this only applies to files in
320 system directories, not configuration files written to individual users'
323 Purging of a package consists of the following steps:
329 Remove the package, if not already removed.
331 for detailed information about how this is done.
335 Run I<postrm> script.
339 Will process triggers unless B<--no-triggers> has been specified.
341 =item B<-V>, B<--verify> [I<package-name>...]
343 Verifies the integrity of I<package-name> or all packages if omitted,
344 by comparing information from the files installed by a package with the
345 files metadata information stored in the B<dpkg> database
348 of the files metadata information in the database is the binary packages
350 That metadata gets collected at package unpack time during
351 the installation process.
353 Currently the only functional check performed is an md5sum verification
354 of the file contents against the stored value in the files database.
355 It will only get checked
356 if the database contains the file md5sum.
357 To check for any missing
358 metadata in the database, the B<--audit> command can be used.
359 This is only an integrity check and should not be considered as any
360 kind of security verification.
362 The output format is selectable with the B<--verify-format>
363 option, which by default uses the B<rpm> format, but that might
364 change in the future, and as such, programs parsing this command
365 output should be explicit about the format they expect.
367 =item B<-C>, B<--audit> [I<package-name>...]
369 Performs database sanity and consistency checks for I<package-name>
370 or all packages if omitted (per package checks since dpkg 1.17.10).
371 For example, searches for packages that have been installed only partially
372 on your system or that have missing, wrong or obsolete control data or
374 B<dpkg> will suggest what to do with them to get them fixed.
376 =item B<--update-avail> [I<Packages-file>]
378 =item B<--merge-avail> [I<Packages-file>]
380 Update B<dpkg>'s and B<dselect>'s idea of which packages are
382 With action B<--merge-avail>,
383 old information is combined with information from I<Packages-file>.
385 B<--update-avail>, old information is replaced with the information
386 in the I<Packages-file>.
387 The I<Packages-file> distributed with Debian is simply named «I<Packages>».
388 If the I<Packages-file>
389 argument is missing or named «B<->» then it will be read from
390 standard input (since dpkg 1.17.7).
391 B<dpkg> keeps its record of
392 available packages in I<%ADMINDIR%/available>.
394 A simpler one-shot command to retrieve and update the I<available>
395 file is B<dselect update>.
396 Note that this file is mostly useless
397 if you don't use B<dselect> but an APT-based frontend: APT has its
398 own system to keep track of available packages.
400 =item B<-A>, B<--record-avail> I<package-file>...
402 Update B<dpkg> and B<dselect>'s idea of which packages are
403 available with information from the package I<package-file>.
405 B<--recursive> or B<-R> option is specified, I<package-file>
406 must refer to a directory instead.
408 =item B<--forget-old-unavail>
410 Now B<obsolete> and a no-op as B<dpkg> will automatically forget
411 uninstalled unavailable packages (since dpkg 1.15.4), but only those that
412 do not contain user information such as package selections.
414 =item B<--clear-avail>
416 Erase the existing information about what packages are available.
418 =item B<--get-selections> [I<package-name-pattern>...]
420 Get list of package selections, and write it to stdout.
422 non-installed packages (i.e. those which have been previously purged) will
425 =item B<--set-selections>
427 Set package selections using file read from stdin.
429 in the format “I<package> I<state>”, where state is one of
430 B<install>, B<hold>, B<deinstall> or B<purge>.
432 and comment lines beginning with ‘B<#>’ are also permitted.
434 The I<available> file needs to be up-to-date for this command to be
435 useful, otherwise unknown packages will be ignored with a warning.
437 the B<--update-avail> and B<--merge-avail> commands for more
440 =item B<--clear-selections>
442 Set the requested state of every non-essential package to deinstall
443 (since dpkg 1.13.18).
444 This is intended to be used immediately before B<--set-selections>,
445 to deinstall any packages not in list given to B<--set-selections>.
447 =item B<--yet-to-unpack>
449 Searches for packages selected for installation, but which for some
450 reason still haven't been installed.
452 B<Note>: This command makes use of both the available file and the package
455 =item B<--predep-package>
457 Print a single package which is the target of one or more relevant
458 pre-dependencies and has itself no unsatisfied pre-dependencies.
460 If such a package is present, output it as a Packages file entry,
461 which can be massaged as appropriate.
463 B<Note>: This command makes use of both the available file and the package
466 Returns 0 when a package is printed, 1 when no suitable package is
467 available and 2 on error.
469 =item B<--add-architecture> I<architecture>
471 Add I<architecture> to the list of architectures for which packages can
472 be installed without using B<--force-architecture> (since dpkg 1.16.2).
474 B<dpkg> is built for (i.e. the output of B<--print-architecture>)
475 is always part of that list.
477 =item B<--remove-architecture> I<architecture>
479 Remove I<architecture> from the list of architectures for which packages
480 can be installed without using B<--force-architecture>
483 architecture is currently in use in the database then the operation will
484 be refused, except if B<--force-architecture> is specified.
486 architecture B<dpkg> is built for (i.e. the output of
487 B<--print-architecture>) can never be removed from that list.
489 =item B<--print-architecture>
491 Print architecture of packages B<dpkg> installs (for example, “i386”).
493 =item B<--print-foreign-architectures>
495 Print a newline-separated list of the extra architectures B<dpkg> is
496 configured to allow packages to be installed for (since dpkg 1.16.2).
498 =item B<--assert-help>
500 Give help about the B<--assert->I<feature> options (since dpkg 1.21.0).
502 =item B<--assert->I<feature>
504 Asserts that B<dpkg> supports the requested feature.
505 Returns 0 if the feature is fully supported, 1 if the feature is known but
506 B<dpkg> cannot provide support for it yet, and 2 if the feature is unknown.
507 The current list of assertable features is:
511 =item B<support-predepends>
513 Supports the B<Pre-Depends> field (since dpkg 1.1.0).
515 =item B<working-epoch>
517 Supports epochs in version strings (since dpkg 1.4.0.7).
519 =item B<long-filenames>
521 Supports long filenames in L<deb(5)> archives (since dpkg 1.4.1.17).
523 =item B<multi-conrep>
525 Supports multiple B<Conflicts> and B<Replaces> (since dpkg 1.4.1.19).
529 Supports multi-arch fields and semantics (since dpkg 1.16.2).
531 =item B<versioned-provides>
533 Supports versioned B<Provides> (since dpkg 1.17.11).
535 =item B<protected-field>
537 Supports the B<Protected> field (since dpkg 1.20.1).
541 =item B<--validate->I<thing> I<string>
543 Validate that the I<thing> I<string> has a correct syntax
544 (since dpkg 1.18.16).
545 Returns 0 if the I<string> is valid, 1 if the I<string> is invalid but
546 might be accepted in lax contexts, and 2 if the I<string> is invalid.
547 The current list of validatable I<thing>s is:
553 Validates the given package name (since dpkg 1.18.16).
557 Validates the given trigger name (since dpkg 1.18.16).
561 Validates the given architecture name (since dpkg 1.18.16).
565 Validates the given version (since dpkg 1.18.16).
569 =item B<--compare-versions> I<ver1> I<op> I<ver2>
571 Compare version numbers, where I<op> is a binary operator.
573 returns true (B<0>) if the specified condition is satisfied,
574 and false (B<1>) otherwise.
576 two groups of operators, which differ in how they treat an empty
578 These treat an empty version as earlier than any version:
579 B<lt le eq ne ge gt>.
580 These treat an empty version as later than any version:
581 B<lt-nl le-nl ge-nl gt-nl>.
583 only for compatibility with control file syntax: B<E<lt> E<lt>E<lt> E<lt>= = E<gt>= E<gt>E<gt>
585 The B<E<lt>> and B<E<gt>> operators are obsolete and should B<not>
586 be used, due to confusing semantics.
587 To illustrate: B<0.1 E<lt> 0.1>
592 =item B<--command-fd> I<n>
594 Accept a series of commands on input file descriptor I<n>.
596 B<Note>: Additional options set on the command line, and through this
597 file descriptor, are not reset for subsequent commands executed during the
602 =item B<-?>, B<--help>
604 Display a brief help message.
606 =item B<--force-help>
608 Give help about the B<--force->I<thing> options.
610 =item B<-Dh>, B<--debug=help>
612 Give help about debugging options.
616 Display B<dpkg> version information.
618 When used with B<--robot>, the output will be the program version number
619 in a dotted numerical format, with no newline.
621 =item B<dpkg-deb actions>
623 See L<dpkg-deb(1)> for more information about the following actions,
624 and other actions and options not exposed by the B<dpkg> front-end.
628 =item B<-b>, B<--build> I<directory> [I<archive>|I<directory>]
632 =item B<-c>, B<--contents> I<archive>
634 List contents of a deb package.
636 =item B<-e>, B<--control> I<archive> [I<directory>]
638 Extract control-information from a package.
640 =item B<-x>, B<--extract> I<archive> I<directory>
642 Extract the files contained by package.
644 =item B<-X>, B<--vextract> I<archive> I<directory>
646 Extract and display the filenames contained by a package.
648 =item B<-f>, B<--field> I<archive> [I<control-field>...]
650 Display control field(s) of a package.
652 =item B<--ctrl-tarfile> I<archive>
654 Output the control tar-file contained in a Debian package.
656 =item B<--fsys-tarfile> I<archive>
658 Output the filesystem tar-file contained by a Debian package.
660 =item B<-I>, B<--info> I<archive> [I<control-file>...]
662 Show information about a package.
666 =item B<dpkg-query actions>
668 See L<dpkg-query(1)> for more information about the following actions,
669 and other actions and options not exposed by the B<dpkg> front-end.
673 =item B<-l>, B<--list> I<package-name-pattern>...
675 List packages matching given pattern.
677 =item B<-s>, B<--status> I<package-name>...
679 Report status of specified package.
681 =item B<-L>, B<--listfiles> I<package-name>...
683 List files installed to your system from I<package-name>.
685 =item B<-S>, B<--search> I<filename-search-pattern>...
687 Search for a filename from installed packages.
689 =item B<-p>, B<--print-avail> I<package-name>...
691 Display details about I<package-name>, as found in
692 I<%ADMINDIR%/available>.
693 Users of APT-based frontends
694 should use B<apt show> I<package-name> instead.
702 All options can be specified both on the command line and in the B<dpkg>
703 configuration file I<%PKGCONFDIR%/dpkg.cfg> or fragment files (with names
704 matching this shell pattern '[0-9a-zA-Z_-]*') on the configuration
705 directory I<%PKGCONFDIR%/dpkg.cfg.d/>.
706 Each line in the configuration
707 file is either an option (exactly the same as the command line option but
708 without leading hyphens) or a comment (if it starts with a ‘B<#>’).
712 =item B<--abort-after=>I<number>
714 Change after how many errors B<dpkg> will abort.
717 =item B<-B>, B<--auto-deconfigure>
719 When a package is removed, there is a possibility that another
720 installed package depended on the removed package.
722 option will cause automatic deconfiguration of the package which
723 depended on the removed package.
725 =item B<-D>I<octal>, B<--debug=>I<octal>
728 I<octal> is formed by bitwise-ORing desired
729 values together from the list below (note that these values may change
731 B<-Dh> or B<--debug=help> display these
735 1 Generally helpful progress information
736 2 Invocation and status of maintainer scripts
737 10 Output for each file processed
738 100 Lots of output for each file processed
739 20 Output for each configuration file
740 200 Lots of output for each configuration file
741 40 Dependencies and conflicts
742 400 Lots of dependencies/conflicts output
743 10000 Trigger activation and processing
744 20000 Lots of output regarding triggers
745 40000 Silly amounts of output regarding triggers
746 1000 Lots of drivel about for example the dpkg/info dir
747 2000 Insane amounts of drivel
749 =item B<--force->I<things>
751 =item B<--no-force->I<things>, B<--refuse->I<things>
753 Force or refuse (B<no-force> and B<refuse> mean the same thing)
755 I<things> is a comma separated list of things specified below.
756 B<--force-help> displays a message describing them.
757 Things marked with (*) are forced by default.
759 B<Warning>: These options are mostly intended to be used by experts
761 Using them without fully understanding their effects may break
768 Turns on (or off) all force options.
770 =item B<downgrade>(*):
772 Install a package, even if newer version of it is already installed.
774 B<Warning>: At present B<dpkg> does not do any dependency
775 checking on downgrades and therefore will not warn you
776 if the downgrade breaks the dependency of some other
778 This can have serious side effects, downgrading
779 essential system components can even make your whole
783 =item B<configure-any>:
785 Configure also any unpacked but unconfigured packages on which the current
790 Allow automatic installs, upgrades or removals of packages even when marked
792 B<Note>: When these actions are requested explicitly, the “hold” package
793 selection state always gets ignored.
795 =item B<remove-reinstreq>:
797 Remove a package, even if it's broken and marked to require
799 This may, for example, cause parts of the package to
800 remain on the system, which will then be forgotten by B<dpkg>.
802 =item B<remove-protected>:
804 Remove, even if the package is considered protected (since dpkg 1.20.1).
805 Protected packages contain mostly important system boot infrastructure or
806 are used for custom system-local meta-packages.
807 Removing them might cause the whole system to be unable to boot or lose
808 required functionality to operate, so use with caution.
810 =item B<remove-essential>:
812 Remove, even if the package is considered essential.
813 Essential packages contain mostly very basic Unix commands, required for
814 the packaging system, for the operation of the system in general or during
815 boot (although the latter should be converted to protected packages instead).
816 Removing them might cause the whole system to stop working,
821 Turn all dependency problems into warnings.
822 This affects the B<Pre-Depends> and B<Depends> fields.
824 =item B<depends-version>:
826 Don't care about versions when checking dependencies.
827 This affects the B<Pre-Depends> and B<Depends> fields.
831 Install, even if this would break another package (since dpkg 1.14.6).
832 This affects the B<Breaks> field.
836 Install, even if it conflicts with another package.
838 for it will usually cause overwriting of some files.
839 This affects the B<Conflicts> field.
843 Always install the missing conffile without prompting.
845 since it means not preserving a change (removing) made to the file.
849 If a conffile has been modified and the version in the package did change,
850 always install the new version without prompting, unless the
851 B<--force-confdef> is also specified, in which case the default
856 If a conffile has been modified and the version in the package did change,
857 always keep the old version without prompting, unless the
858 B<--force-confdef> is also specified, in which case the default
863 If a conffile has been modified and the version in the package did change,
864 always choose the default action without prompting.
865 If there is no default
866 action it will stop to ask the user unless B<--force-confnew> or
867 B<--force-confold> is also given, in which case it will use
868 that to decide the final action.
872 If a conffile has been modified always offer to replace it with the
873 version in the package, even if the version in the package did not
874 change (since dpkg 1.15.8).
875 If any of B<--force-confnew>,
876 B<--force-confold>, or B<--force-confdef> is also given,
877 it will be used to decide the final action.
881 Overwrite one package's file with another's file.
883 =item B<overwrite-dir>:
885 Overwrite one package's directory with another's file.
887 =item B<overwrite-diverted>:
889 Overwrite a diverted file with an undiverted version.
891 =item B<statoverride-add>:
893 Overwrite an existing stat override when adding it (since dpkg 1.19.5).
895 =item B<statoverride-remove>:
897 Ignore a missing stat override when removing it (since dpkg 1.19.5).
899 =item B<security-mac>(*):
901 Use platform-specific Mandatory Access Controls (MAC) based security when
902 installing files into the filesystem (since dpkg 1.19.5).
903 On Linux systems the implementation uses SELinux.
907 Do not perform safe I/O operations when unpacking (since dpkg 1.15.8.6).
909 implies not performing file system syncs before file renames, which is
910 known to cause substantial performance degradation on some file systems,
911 unfortunately the ones that require the safe I/O on the first place due
912 to their unreliable behaviour causing zero-length files on abrupt
915 I<Note>: For ext4, the main offender, consider using instead the
916 mount option B<nodelalloc>, which will fix both the performance
917 degradation and the data safety issues, the latter by making the file
918 system not produce zero-length files on abrupt system crashes with
919 any software not doing syncs before atomic renames.
921 B<Warning>: Using this option might improve performance at the cost of
922 losing data, use with care.
924 =item B<script-chrootless>:
926 Run maintainer scripts without L<chroot(2)>ing into B<instdir> even
927 if the package does not support this mode of operation (since dpkg 1.18.5).
929 B<Warning>: This can destroy your host system, use with extreme care.
931 =item B<architecture>:
933 Process even packages with wrong or no architecture.
935 =item B<bad-version>:
937 Process even packages with wrong versions (since dpkg 1.16.1).
941 B<PATH> is missing important programs, so problems are likely.
945 Try to (de)install things even when not root.
949 Install a package even if it fails authenticity check.
953 =item B<--ignore-depends>=I<package>,...
955 Ignore dependency-checking for specified packages (actually, checking is
956 performed, but only warnings about conflicts are given, nothing else).
957 This affects the B<Pre-Depends>, B<Depends> and B<Breaks> fields.
959 =item B<--no-act>, B<--dry-run>, B<--simulate>
961 Do everything which is supposed to be done, but don't write any
963 This is used to see what would happen with the specified
964 action, without actually modifying anything.
966 Be sure to give B<--no-act> before the action-parameter, or you might
967 end up with undesirable results (e.g. B<dpkg --purge foo --no-act> will
968 first purge package “foo” and then try to purge package ”--no-act”, even
969 though you probably expected it to actually do nothing).
971 =item B<-R>, B<--recursive>
973 Recursively handle all regular files matching pattern B<*.deb>
974 found at specified directories and all of its subdirectories.
976 be used with B<-i>, B<-A>, B<--install>, B<--unpack> and
977 B<--record-avail> actions.
981 Don't install a package if a newer version of the same package is already
983 This is an alias of B<--refuse-downgrade>.
985 =item B<--admindir=>I<dir>
987 Set the administrative directory to I<directory>.
988 This directory contains many files that give information about status of
989 installed or uninstalled packages, etc.
990 Defaults to «I<%ADMINDIR%>» if B<DPKG_ADMINDIR> has not been set.
992 =item B<--instdir=>I<dir>
994 Set the installation directory, which refers to the directory where
995 packages are to be installed.
996 B<instdir> is also the directory passed
997 to L<chroot(2)> before running package's installation scripts, which
998 means that the scripts see B<instdir> as a root directory.
1001 =item B<--root=>I<dir>
1003 Set the root directory to B<directory>, which sets the installation
1004 directory to «I<dir>» and the administrative
1005 directory to «I<dir>B<%ADMINDIR%>».
1007 =item B<-O>, B<--selected-only>
1009 Only process the packages that are selected for installation.
1011 actual marking is done with B<dselect> or by B<dpkg>, when it
1013 For example, when a package is removed, it will
1014 be marked selected for deinstallation.
1016 =item B<-E>, B<--skip-same-version>
1018 Don't install the package if the same version and architecture
1019 of the package is already installed.
1021 Since dpkg 1.21.10, the architecture is also taken into account,
1022 which makes it possible to cross-grade packages or install additional
1023 co-installable instances with the same version, but different architecture.
1025 =item B<--pre-invoke=>I<command>
1027 =item B<--post-invoke=>I<command>
1029 Set an invoke hook I<command> to be run via “%DPKG_DEFAULT_SHELL% -c” before or
1030 after the B<dpkg> run for the I<unpack>, I<configure>, I<install>,
1034 actions (since dpkg 1.15.4), and
1035 I<add-architecture> and
1036 I<remove-architecture>
1037 actions (since dpkg 1.17.19).
1039 option can be specified multiple times.
1040 The order the options are specified
1041 is preserved, with the ones from the configuration files taking precedence.
1042 The environment variable B<DPKG_HOOK_ACTION> is set for the hooks to the
1043 current B<dpkg> action.
1045 B<Note>: Front-ends might call B<dpkg> several
1046 times per invocation, which might run the hooks more times than expected.
1048 =item B<--path-exclude=>I<glob-pattern>
1050 =item B<--path-include=>I<glob-pattern>
1052 Set I<glob-pattern> as a path filter, either by excluding or re-including
1053 previously excluded paths matching the specified patterns during install
1054 (since dpkg 1.15.8).
1056 B<Warning>: Take into account that depending on the excluded paths you
1057 might completely break your system, use with caution.
1059 The glob patterns use the same wildcards used in the shell, were
1060 ‘*’ matches any sequence of characters, including the empty string
1062 For example, «I</usr/*/READ*>» matches
1063 «I</usr/share/doc/package/README>».
1064 As usual, ‘?’ matches any single character (again, including ‘/’).
1066 starts a character class, which can contain a list of characters, ranges
1067 and complementations.
1068 See L<glob(7)> for detailed information about
1070 B<Note>: The current implementation might re-include more directories
1071 and symlinks than needed, in particular when there is a more specific
1072 re-inclusion, to be on the safe side and avoid possible unpack failures;
1073 future work might fix this.
1075 This can be used to remove all paths except some particular ones; a typical
1078 --path-exclude=/usr/share/doc/*
1079 --path-include=/usr/share/doc/*/copyright
1081 to remove all documentation files except the copyright files.
1083 These two options can be specified multiple times, and interleaved with
1085 Both are processed in the given order, with the last rule that
1086 matches a file name making the decision.
1088 The filters are applied when unpacking the binary packages, and as such
1089 only have knowledge of the type of object currently being filtered
1090 (e.g. a normal file or a directory) and have not visibility of what
1091 objects will come next.
1092 Because these filters have side effects (in contrast to L<find(1)>
1093 filters), excluding an exact pathname that happens to be a directory object
1094 like I</usr/share/doc> will not have the desired result, and only that
1095 pathname will be excluded (which could be automatically reincluded if the
1096 code sees the need).
1097 Any subsequent files contained within that directory will fail to unpack.
1099 B<Hint>: make sure the globs are not expanded by your shell.
1101 =item B<--verify-format> I<format-name>
1103 Sets the output format for the B<--verify> command (since dpkg 1.17.2).
1105 The only currently supported output format is B<rpm>, which consists
1106 of a line for every path that failed any check.
1107 These lines have the following format:
1110 B<missing > [B<c>] I<pathname> [B<(>I<error-message>B<)>]
1111 B<??5??????> [B<c>] I<pathname>
1113 The first 9 characters are used to report the checks result,
1114 either a literal B<missing> when the file is not present or its metadata
1116 or one of the following special characters that report the result for each
1123 Implies the check could not be done (lack of support, file permissions, etc).
1127 Implies the check passed.
1129 =item ‘I<A-Za-z0-9>’
1131 Implies a specific check failed.
1132 The following positions and alphanumeric characters are currently supported:
1138 These checks are currently not supported, will always be ‘B<?>’.
1142 The file mode check failed (since dpkg 1.21.0).
1143 Because pathname metadata is currently not tracked, this check can only be
1144 partially emulated via a very simple heuristic for pathnames that have a
1145 known digest, which implies they should be regular files, where the check
1146 will fail if the pathname is not a regular file on the filesystem.
1147 This check will currently never succeed as it does not have enough
1148 information available.
1152 The digest check failed, which means the file contents have changed.
1153 This is only an integrity check and should not be considered as any
1154 kind of security verification.
1158 These checks are currently not supported, will always be ‘B<?>’.
1164 The line is followed by a space and an attribute character.
1165 The following attribute character is supported:
1171 The pathname is a conffile.
1175 Finally followed by another space and the pathname.
1177 In case the entry was of the B<missing> type, and the file was not actually
1178 present on the filesystem, then the line is followed by a space and the
1179 error message enclosed within parenthesis.
1181 =item B<--status-fd> I<n>
1183 Send machine-readable package status and progress information to file
1185 This option can be specified multiple times.
1187 information is generally one record per line, in one of the following
1192 =item B<status:> I<package>B<:> I<status>
1194 Package status changed; I<status> is as in the status file.
1196 =item B<status:> I<package> B<: error :> I<extended-error-message>
1199 Any possible newlines in I<extended-error-message>
1200 will be converted to spaces before output.
1202 =item B<status:> I<file> B<: conffile-prompt : '>I<real-old>B<' '>I<real-new>B<'> I<useredited> I<distedited>
1204 User is being asked a conffile question.
1206 =item B<processing:> I<stage>B<:> I<package>
1208 Sent just before a processing stage starts.
1210 B<upgrade>, B<install> (both sent before unpacking),
1211 B<configure>, B<trigproc>, B<disappear>, B<remove>, B<purge>.
1215 =item B<--status-logger>=I<command>
1217 Send machine-readable package status and progress information to the
1218 shell I<command>'s standard input, to be run via “%DPKG_DEFAULT_SHELL% -c”
1219 (since dpkg 1.16.0).
1220 This option can be specified multiple times.
1221 The output format used is the same as in B<--status-fd>.
1223 =item B<--log=>I<filename>
1225 Log status change updates and actions to I<filename>, instead of
1226 the default I<%LOGDIR%/dpkg.log>.
1227 If this option is given multiple times, the last filename is used.
1228 Log messages are of the form:
1232 =item YYYY-MM-DD HH:MM:SS B<startup> I<type> I<command>
1234 For each dpkg invocation where I<type> is B<archives> (with a
1235 I<command> of B<unpack> or B<install>) or B<packages>
1236 (with a I<command> of B<configure>, B<triggers-only>,
1237 B<remove> or B<purge>).
1239 =item YYYY-MM-DD HH:MM:SS B<status> I<state> I<pkg> I<installed-version>
1241 For status change updates.
1243 =item YYYY-MM-DD HH:MM:SS I<action> I<pkg> I<installed-version> I<available-version>
1245 For actions where I<action> is one of B<install>, B<upgrade>,
1246 B<configure>, B<trigproc>, B<disappear>, B<remove> or B<purge>.
1248 =item YYYY-MM-DD HH:MM:SS B<conffile> I<filename> I<decision>
1250 For conffile changes where I<decision> is either B<install> or
1257 Use a machine-readable output format.
1258 This provides an interface for programs
1259 that need to parse the output of some of the commands that do not otherwise
1260 emit a machine-readable output format.
1261 No localization will be used, and the
1262 output will be modified to make it easier to parse.
1264 The only currently supported command is B<--version>.
1268 Disables the use of any pager when showing information (since dpkg 1.19.2).
1270 =item B<--no-debsig>
1272 Do not try to verify package signatures.
1274 =item B<--no-triggers>
1276 Do not run any triggers in this run (since dpkg 1.14.17), but activations
1277 will still be recorded.
1278 If used with B<--configure> I<package> or
1279 B<--triggers-only> I<package> then the named package postinst
1280 will still be run even if only a triggers run is needed.
1282 may leave packages in the improper B<triggers-awaited> and
1283 B<triggers-pending> states.
1284 This can be fixed later by running:
1285 B<dpkg --configure --pending>.
1289 Cancels a previous B<--no-triggers> (since dpkg 1.14.17).
1299 The requested action was successfully performed.
1300 Or a check or assertion command returned true.
1304 A check or assertion command returned false.
1308 Fatal or unrecoverable error due to invalid command-line usage, or
1309 interactions with the system, such as accesses to the database,
1310 memory allocations, etc.
1316 =head2 External environment
1322 This variable is expected to be defined in the environment and point to
1323 the system paths where several required programs are to be found.
1325 not set or the programs are not found, B<dpkg> will abort.
1329 If set, B<dpkg> will use it as the directory from which to read the user
1330 specific configuration file.
1334 If set, B<dpkg> will use it as the directory in which to create
1335 temporary files and directories.
1339 The program B<dpkg> will execute when starting a new interactive shell,
1340 or when spawning a command via a shell.
1346 The program B<dpkg> will execute when running a pager,
1347 which will be executed with «B<$SHELL -c>»,
1348 for example when displaying the conffile differences.
1349 If B<SHELL> is not set, «B<%DPKG_DEFAULT_SHELL%>» will be used instead.
1350 The B<DPKG_PAGER> overrides the B<PAGER> environment variable
1351 (since dpkg 1.19.2).
1353 =item B<DPKG_COLORS>
1355 Sets the color mode (since dpkg 1.18.5).
1356 The currently accepted values are: B<auto> (default), B<always> and
1361 Sets the debug mask (since dpkg 1.21.10) from an octal value.
1362 The currently accepted flags are described in the B<--debug> option.
1366 Sets the force flags (since dpkg 1.19.5).
1367 When this variable is present, no built-in force defaults will be applied.
1368 If the variable is present but empty, all force flags will be disabled.
1370 =item B<DPKG_ADMINDIR>
1372 If set and the B<--admindir> or B<--root> options have not been
1373 specified, it will be used as the B<dpkg> administrative directory
1374 (since dpkg 1.20.0).
1376 =item B<DPKG_FRONTEND_LOCKED>
1378 Set by a package manager frontend to notify dpkg that it should not acquire
1379 the frontend lock (since dpkg 1.19.1).
1383 =head2 Internal environment
1389 Defined by B<dpkg> to “B<-FRSXMQ>”, if not already set, when
1390 spawning a pager (since dpkg 1.19.2).
1391 To change the default behavior, this variable can be preset to some other
1392 value including an empty string, or the B<PAGER> or B<DPKG_PAGER>
1393 variables can be set to disable specific options with «B<-+>», for
1394 example B<DPKG_PAGER="less -+F">.
1398 Defined by B<dpkg> on the maintainer script environment to indicate
1399 which installation to act on (since dpkg 1.18.5).
1400 The value is intended to be prepended to any path maintainer scripts
1402 During normal operation, this variable is empty.
1403 When installing packages into a different B<instdir>, B<dpkg>
1404 normally invokes maintainer scripts using L<chroot(2)> and leaves
1405 this variable empty, but if B<--force-script-chrootless> is
1406 specified then the L<chroot(2)> call is skipped and B<instdir>
1409 =item B<DPKG_ADMINDIR>
1411 Defined by B<dpkg> on the maintainer script environment to indicate
1412 the B<dpkg> administrative directory to use (since dpkg 1.16.0).
1413 This variable is always set to the current B<--admindir> value.
1417 Defined by B<dpkg> on the subprocesses environment to all the currently
1418 enabled force option names separated by commas (since dpkg 1.19.5).
1420 =item B<DPKG_SHELL_REASON>
1422 Defined by B<dpkg> on the shell spawned on the conffile prompt to
1423 examine the situation (since dpkg 1.15.6).
1424 Current valid value: B<conffile-prompt>.
1426 =item B<DPKG_CONFFILE_OLD>
1428 Defined by B<dpkg> on the shell spawned on the conffile prompt to
1429 examine the situation (since dpkg 1.15.6).
1430 Contains the path to the old conffile.
1432 =item B<DPKG_CONFFILE_NEW>
1434 Defined by B<dpkg> on the shell spawned on the conffile prompt to
1435 examine the situation (since dpkg 1.15.6).
1436 Contains the path to the new conffile.
1438 =item B<DPKG_HOOK_ACTION>
1440 Defined by B<dpkg> on the shell spawned when executing a hook action
1441 (since dpkg 1.15.4).
1442 Contains the current B<dpkg> action.
1444 =item B<DPKG_RUNNING_VERSION>
1446 Defined by B<dpkg> on the maintainer script environment to the
1447 version of the currently running B<dpkg> instance (since dpkg 1.14.17).
1449 =item B<DPKG_MAINTSCRIPT_PACKAGE>
1451 Defined by B<dpkg> on the maintainer script environment to the
1452 (non-arch-qualified) package name being handled (since dpkg 1.14.17).
1454 =item B<DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT>
1456 Defined by B<dpkg> on the maintainer script environment to the
1457 package reference count, i.e. the number of package instances with
1458 a state greater than B<not-installed> (since dpkg 1.17.2).
1460 =item B<DPKG_MAINTSCRIPT_ARCH>
1462 Defined by B<dpkg> on the maintainer script environment to the
1463 architecture the package got built for (since dpkg 1.15.4).
1465 =item B<DPKG_MAINTSCRIPT_NAME>
1467 Defined by B<dpkg> on the maintainer script environment to the
1468 name of the script running, one of B<preinst>, B<postinst>,
1469 B<prerm> or B<postrm> (since dpkg 1.15.7).
1471 =item B<DPKG_MAINTSCRIPT_DEBUG>
1473 Defined by B<dpkg> on the maintainer script environment to a value
1474 (‘B<0>’ or ‘B<1>’) noting whether debugging has been
1475 requested (with the B<--debug> option) for the maintainer scripts
1476 (since dpkg 1.18.4).
1484 =item I<%PKGCONFDIR%/dpkg.cfg.d/[0-9a-zA-Z_-]*>
1486 Configuration fragment files (since dpkg 1.15.4).
1488 =item I<%PKGCONFDIR%/dpkg.cfg>
1490 Configuration file with default options.
1492 =item I<%LOGDIR%/dpkg.log>
1494 Default log file (see I<%PKGCONFDIR%/dpkg.cfg> and option
1499 The other files listed below are in their default directories, see option
1500 B<--admindir> to see how to change locations of these files.
1504 =item I<%ADMINDIR%/available>
1506 List of available packages.
1508 =item I<%ADMINDIR%/status>
1510 Statuses of available packages.
1511 This file contains information about
1512 whether a package is marked for removing or not, whether it is
1513 installed or not, etc.
1514 See section L</INFORMATION ABOUT PACKAGES>
1517 The status file is backed up daily in I<%BACKUPSDIR%>.
1519 useful if it's lost or corrupted due to filesystems troubles.
1523 The format and contents of a binary package are described in L<deb(5)>.
1525 =head2 Filesystem filenames
1527 During unpacking and configuration B<dpkg> uses various filenames for
1528 backup and rollback purposes.
1529 The following is a simplified explanation of how these filenames get used
1530 during package installation.
1536 During unpack, B<dpkg> extracts new filesystem objects into
1537 I<pathname>B<.dpkg-new>
1538 (except for existing directories or symlinks to directories which get skipped),
1539 once that is done and after having performed backups of the old objects,
1540 the objects get renamed to I<pathname>.
1544 During unpack, B<dpkg> makes backups of the old filesystem objects into
1545 I<pathname>B<.dpkg-tmp> after extracting the new objects.
1546 These backups are performed as either a rename for directories
1547 (but only if they switch file type),
1548 a new symlink copy for symlinks,
1549 or a hard link for any other filesystem object,
1550 except for conffiles which get no backups because they are processed
1553 In case of needing to rollback, these backups get used to restore the
1554 previous contents of the objects.
1555 These get removed automatically after the installation is complete.
1559 During configuration, when installing a new version,
1560 B<dpkg> can make a backup of the previous modified conffile into
1561 I<pathname>B<.dpkg-old>.
1563 =item F<*.dpkg-dist>
1565 During configuration, when keeping the old version,
1566 B<dpkg> can make a backup of the new unmodified conffile into
1567 I<pathname>B<.dpkg-dist>.
1573 Any operation that needs write access to the database or the filesystem
1574 is considered a privileged operation that might allow root escalation.
1575 These operations must never be delegated to an untrusted user or be done
1576 on untrusted packages, as that might allow root access to the system.
1578 Some operations (such as package verification) might need root privileges
1579 to be able to access files on the filesystem that would otherwise be
1580 inaccessible due to restricted permissions, but should otherwise work
1581 normally and produce appropriate messages in those cases.
1583 Query operations should never require root, and delegating their execution
1584 to unprivileged users via some gain-root command can have security
1585 implications (such as privilege escalation), for example when a pager is
1586 automatically invoked by the tool.
1588 See also the B<SECURITY> section of the L<dpkg-deb(1)> and L<dpkg-split(1)>
1593 B<--no-act> usually gives less information than might be helpful.
1597 To list installed packages related to the editor L<vi(1)> (note that
1598 B<dpkg-query> does not load the I<available> file anymore by
1599 default, and the B<dpkg-query> B<--load-avail> option should
1600 be used instead for that):
1608 To see the entries in I<%ADMINDIR%/available> of two packages:
1612 dpkg --print-avail vim neovim | less
1616 To search the listing of packages yourself:
1620 dpkg --print-avail | less
1624 To remove an installed neovim package:
1632 To install a package, you first need to find it in an archive or media disc.
1633 When using an archive based on a pool structure,
1634 knowing the archive area and the name of the package is enough to infer
1639 dpkg -i /media/bdrom/pool/main/v/vim/vim_9.0.2018-1_amd64.deb
1643 To make a local copy of the package selection states:
1647 dpkg --get-selections >myselections
1651 You might transfer this file to another computer, and after having updated
1652 the I<available> file there with your package manager frontend of choice
1653 (see L<https://wiki.debian.org/Teams/Dpkg/FAQ#set-selections> for more
1654 details), for example:
1658 apt-cache dumpavail | dpkg --merge-avail
1662 you can install it with:
1666 dpkg --clear-selections
1667 dpkg --set-selections <myselections
1671 Note that this will not actually install or remove anything, but just
1672 set the selection state on the requested packages.
1674 other application to actually download and install the requested
1676 For example, run B<apt-get dselect-upgrade>.
1678 Ordinarily, you will find that L<dselect(1)> provides a more
1679 convenient way to modify the package selection states.
1681 =head1 ADDITIONAL FUNCTIONALITY
1683 Additional functionality can be gained by installing any of the
1684 following packages: B<apt>, B<aptitude> and B<debsig-verify>.
1697 L<dpkg-reconfigure(8)>.
1701 See I<%PKGDOCDIR%/THANKS> for the list of people who have
1702 contributed to B<dpkg>.