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. The
45 descriptions of what B<dpkg> does when installing and removing
46 packages are particularly inadequate.
50 B<dpkg> is a medium-level tool to install, build, remove and manage
52 The primary and more user-friendly front-end for B<dpkg>
53 as a CLI (command-line interface) is B<apt>(8) and
54 as a TUI (terminal user interface) is B<aptitude>(8).
56 controlled entirely via command line parameters, which consist of exactly
57 one action and zero or more options. The action-parameter tells B<dpkg>
58 what to do and options control the behavior of the action in some way.
60 B<dpkg> can also be used as a front-end to B<dpkg-deb>(1) and
61 B<dpkg-query>(1). The list of supported actions can be found later on
62 in the B<ACTIONS> section. If any such action is encountered B<dpkg>
63 just runs B<dpkg-deb> or B<dpkg-query> with the parameters given
64 to it, but no specific options are currently passed to them, to use
65 any such option the back-ends need to be called directly.
67 =head1 INFORMATION ABOUT PACKAGES
69 B<dpkg> maintains some usable information about available
70 packages. The information is divided in three classes: B<states>,
71 B<selection states> and B<flags>. These values are intended to
72 be changed mainly with B<dselect>.
78 =item B<not-installed>
80 The package is not installed on your system.
84 Only the configuration files or the B<postrm> script and the data it needs
85 to remove of the package exist on the system.
87 =item B<half-installed>
89 The installation of the package has been started, but not completed for
94 The package is unpacked, but not configured.
96 =item B<half-configured>
98 The package is unpacked and configuration has been started, but not yet
99 completed for some reason.
101 =item B<triggers-awaited>
103 The package awaits trigger processing by another package.
105 =item B<triggers-pending>
107 The package has been triggered.
111 The package is correctly unpacked and configured.
115 =head2 Package selection states
121 The package is selected for installation.
125 A package marked to be on B<hold> is kept on the same version, that is,
126 no automatic new installs, upgrades or removals will be performed on them,
127 unless these actions are requested explicitly, or are permitted to be done
128 automatically with the B<--force-hold> option.
132 The package is selected for deinstallation (i.e. we want to remove all
133 files, except configuration files).
137 The package is selected to be purged (i.e. we want to remove everything
138 from system directories, even configuration files).
142 The package selection is unknown.
143 A package that is also in a B<not-installed> state, and with an
144 B<ok> flag will be forgotten in the next database store.
154 A package marked B<ok> is in a known state, but might need further
159 A package marked B<reinstreq> is broken and requires
160 reinstallation. These packages cannot be removed, unless forced with
161 option B<--force-remove-reinstreq>.
169 =item B<-i>, B<--install> I<package-file>...
171 Install the package. If B<--recursive> or B<-R> option is
172 specified, I<package-file> must refer to a directory instead.
174 Installation consists of the following steps:
180 Extract the control files of the new package.
184 If another version of the same package was installed before
185 the new installation, execute I<prerm> script of the old package.
189 Run I<preinst> script, if provided by the package.
193 Unpack the new files, and at the same time back up the old
194 files, so that if something goes wrong, they can be restored.
198 If another version of the same package was installed before
199 the new installation, execute the I<postrm> script of the old
200 package. Note that this script is executed after the I<preinst>
201 script of the new package, because new files are written at the same
202 time old files are removed.
206 Configure the package. See B<--configure> for detailed
207 information about how this is done.
211 =item B<--unpack> I<package-file>...
213 Unpack the package, but don't configure it. If B<--recursive> or
214 B<-R> option is specified, I<package-file> must refer to a
217 Will process triggers for B<Pre-Depends> unless B<--no-triggers> has
220 =item B<--configure> I<package>...|B<-a>|B<--pending>
222 Configure a package which has been unpacked but not yet configured.
223 If B<-a> or B<--pending> is given instead of I<package>,
224 all unpacked but unconfigured packages are configured.
226 To reconfigure a package which has already been configured, try the
227 B<dpkg-reconfigure>(8) command instead (which is part of the B<debconf>
230 Configuring consists of the following steps:
236 Unpack the conffiles, and at the same time back up
237 the old conffiles, so that they can be restored if
238 something goes wrong.
242 Run I<postinst> script, if provided by the package.
246 Will process triggers unless B<--no-triggers> has been specified.
248 =item B<--triggers-only> I<package>...|B<-a>|B<--pending>
250 Processes only triggers (since dpkg 1.14.17).
251 All pending triggers will be processed.
253 names are supplied only those packages' triggers will be processed, exactly
254 once each where necessary. Use of this option may leave packages in the
255 improper B<triggers-awaited> and B<triggers-pending> states. This
256 can be fixed later by running: B<dpkg --configure --pending>.
258 =item B<-r>, B<--remove> I<package>...|B<-a>|B<--pending>
260 Remove an installed package.
261 This removes everything except conffiles and other data cleaned up by
262 the I<postrm> script,
263 which may avoid having to reconfigure the package if it is reinstalled
264 later (conffiles are configuration files that are listed in the
265 I<DEBIAN/conffiles> control file).
266 If there is no I<DEBIAN/conffiles> control file nor I<DEBIAN/postrm>
267 script, this command is equivalent to calling B<--purge>.
268 If B<-a> or B<--pending> is given instead of a package name,
269 then all packages unpacked, but marked to be removed in file
270 I<%ADMINDIR%/status>, are removed.
272 Removing of a package consists of the following steps:
282 Remove the installed files.
286 Run I<postrm> script.
290 Will process triggers unless B<--no-triggers> has been specified.
292 =item B<-P>, B<--purge> I<package>...|B<-a>|B<--pending>
294 Purge an installed or already removed package. This removes everything,
295 including conffiles, and anything else cleaned up from I<postrm>.
296 If B<-a> or B<--pending> is given instead of a package name,
297 then all packages unpacked or removed, but marked to be purged in file
298 I<%ADMINDIR%/status>, are purged.
300 B<Note>: Some configuration files might be unknown to B<dpkg> because they
301 are created and handled separately through the configuration scripts. In
302 that case, B<dpkg> won't remove them by itself, but the package's
303 I<postrm> script (which is called by B<dpkg>), has to take care of
304 their removal during purge. Of course, this only applies to files in
305 system directories, not configuration files written to individual users'
308 Purging of a package consists of the following steps:
314 Remove the package, if not already removed. See B<--remove>
315 for detailed information about how this is done.
319 Run I<postrm> script.
323 Will process triggers unless B<--no-triggers> has been specified.
325 =item B<-V>, B<--verify> [I<package-name>...]
327 Verifies the integrity of I<package-name> or all packages if omitted,
328 by comparing information from the files installed by a package with the
329 files metadata information stored in the B<dpkg> database
332 of the files metadata information in the database is the binary packages
333 themselves. That metadata gets collected at package unpack time during
334 the installation process.
336 Currently the only functional check performed is an md5sum verification
337 of the file contents against the stored value in the files database.
338 It will only get checked
339 if the database contains the file md5sum. To check for any missing
340 metadata in the database, the B<--audit> command can be used.
342 The output format is selectable with the B<--verify-format>
343 option, which by default uses the B<rpm> format, but that might
344 change in the future, and as such, programs parsing this command
345 output should be explicit about the format they expect.
347 =item B<-C>, B<--audit> [I<package-name>...]
349 Performs database sanity and consistency checks for I<package-name>
350 or all packages if omitted (per package checks since dpkg 1.17.10).
351 For example, searches for packages that have been installed only partially
352 on your system or that have missing, wrong or obsolete control data or
353 files. B<dpkg> will suggest what to do with them to get them fixed.
355 =item B<--update-avail> [I<Packages-file>]
357 =item B<--merge-avail> [I<Packages-file>]
359 Update B<dpkg>'s and B<dselect>'s idea of which packages are
360 available. With action B<--merge-avail>, old information is
361 combined with information from I<Packages-file>. With action
362 B<--update-avail>, old information is replaced with the information
363 in the I<Packages-file>. The I<Packages-file> distributed with
364 Debian is simply named «I<Packages>». If the I<Packages-file>
365 argument is missing or named «B<->» then it will be read from
366 standard input (since dpkg 1.17.7). B<dpkg> keeps its record of
367 available packages in I<%ADMINDIR%/available>.
369 A simpler one-shot command to retrieve and update the I<available>
370 file is B<dselect update>. Note that this file is mostly useless
371 if you don't use B<dselect> but an APT-based frontend: APT has its
372 own system to keep track of available packages.
374 =item B<-A>, B<--record-avail> I<package-file>...
376 Update B<dpkg> and B<dselect>'s idea of which packages are
377 available with information from the package I<package-file>. If
378 B<--recursive> or B<-R> option is specified, I<package-file>
379 must refer to a directory instead.
381 =item B<--forget-old-unavail>
383 Now B<obsolete> and a no-op as B<dpkg> will automatically forget
384 uninstalled unavailable packages (since dpkg 1.15.4), but only those that
385 do not contain user information such as package selections.
387 =item B<--clear-avail>
389 Erase the existing information about what packages are available.
391 =item B<--get-selections> [I<package-name-pattern>...]
393 Get list of package selections, and write it to stdout. Without a pattern,
394 non-installed packages (i.e. those which have been previously purged) will
397 =item B<--set-selections>
399 Set package selections using file read from stdin. This file should be
400 in the format “I<package> I<state>”, where state is one of
401 B<install>, B<hold>, B<deinstall> or B<purge>. Blank lines
402 and comment lines beginning with ‘B<#>’ are also permitted.
404 The I<available> file needs to be up-to-date for this command to be
405 useful, otherwise unknown packages will be ignored with a warning. See
406 the B<--update-avail> and B<--merge-avail> commands for more
409 =item B<--clear-selections>
411 Set the requested state of every non-essential package to deinstall
412 (since dpkg 1.13.18).
413 This is intended to be used immediately before B<--set-selections>,
414 to deinstall any packages not in list given to B<--set-selections>.
416 =item B<--yet-to-unpack>
418 Searches for packages selected for installation, but which for some
419 reason still haven't been installed.
421 B<Note>: This command makes use of both the available file and the package
424 =item B<--predep-package>
426 Print a single package which is the target of one or more relevant
427 pre-dependencies and has itself no unsatisfied pre-dependencies.
429 If such a package is present, output it as a Packages file entry,
430 which can be massaged as appropriate.
432 B<Note>: This command makes use of both the available file and the package
435 Returns 0 when a package is printed, 1 when no suitable package is
436 available and 2 on error.
438 =item B<--add-architecture> I<architecture>
440 Add I<architecture> to the list of architectures for which packages can
441 be installed without using B<--force-architecture> (since dpkg 1.16.2).
443 B<dpkg> is built for (i.e. the output of B<--print-architecture>)
444 is always part of that list.
446 =item B<--remove-architecture> I<architecture>
448 Remove I<architecture> from the list of architectures for which packages
449 can be installed without using B<--force-architecture>
450 (since dpkg 1.16.2). If the
451 architecture is currently in use in the database then the operation will
452 be refused, except if B<--force-architecture> is specified. The
453 architecture B<dpkg> is built for (i.e. the output of
454 B<--print-architecture>) can never be removed from that list.
456 =item B<--print-architecture>
458 Print architecture of packages B<dpkg> installs (for example, “i386”).
460 =item B<--print-foreign-architectures>
462 Print a newline-separated list of the extra architectures B<dpkg> is
463 configured to allow packages to be installed for (since dpkg 1.16.2).
465 =item B<--assert-help>
467 Give help about the B<--assert->I<feature> options (since dpkg 1.21.0).
469 =item B<--assert->I<feature>
471 Asserts that B<dpkg> supports the requested feature.
472 Returns 0 if the feature is fully supported, 1 if the feature is known but
473 B<dpkg> cannot provide support for it yet, and 2 if the feature is unknown.
474 The current list of assertable features is:
478 =item B<support-predepends>
480 Supports the B<Pre-Depends> field (since dpkg 1.1.0).
482 =item B<working-epoch>
484 Supports epochs in version strings (since dpkg 1.4.0.7).
486 =item B<long-filenames>
488 Supports long filenames in B<deb>(5) archives (since dpkg 1.4.1.17).
490 =item B<multi-conrep>
492 Supports multiple B<Conflicts> and B<Replaces> (since dpkg 1.4.1.19).
496 Supports multi-arch fields and semantics (since dpkg 1.16.2).
498 =item B<versioned-provides>
500 Supports versioned B<Provides> (since dpkg 1.17.11).
502 =item B<protected-field>
504 Supports the B<Protected> field (since dpkg 1.20.1).
508 =item B<--validate->I<thing> I<string>
510 Validate that the I<thing> I<string> has a correct syntax
511 (since dpkg 1.18.16).
512 Returns 0 if the I<string> is valid, 1 if the I<string> is invalid but
513 might be accepted in lax contexts, and 2 if the I<string> is invalid.
514 The current list of validatable I<thing>s is:
520 Validates the given package name (since dpkg 1.18.16).
524 Validates the given trigger name (since dpkg 1.18.16).
528 Validates the given architecture name (since dpkg 1.18.16).
532 Validates the given version (since dpkg 1.18.16).
536 =item B<--compare-versions> I<ver1> I<op> I<ver2>
538 Compare version numbers, where I<op> is a binary operator. B<dpkg>
539 returns true (B<0>) if the specified condition is satisfied,
540 and false (B<1>) otherwise. There are
541 two groups of operators, which differ in how they treat an empty
542 I<ver1> or I<ver2>. These treat an empty version as earlier than any
543 version: B<lt le eq ne ge gt>. These treat an empty version as later
544 than any version: B<lt-nl le-nl ge-nl gt-nl>. These are provided
545 only for compatibility with control file syntax: B<E<lt> E<lt>E<lt> E<lt>= = E<gt>= E<gt>E<gt>
546 E<gt>>. The B<E<lt>> and B<E<gt>> operators are obsolete and should B<not>
547 be used, due to confusing semantics. To illustrate: B<0.1 E<lt> 0.1>
552 =item B<--command-fd> I<n>
554 Accept a series of commands on input file descriptor I<n>.
556 B<Note>: Additional options set on the command line, and through this
557 file descriptor, are not reset for subsequent commands executed during the
562 =item B<-?>, B<--help>
564 Display a brief help message.
566 =item B<--force-help>
568 Give help about the B<--force->I<thing> options.
570 =item B<-Dh>, B<--debug=help>
572 Give help about debugging options.
576 Display B<dpkg> version information.
578 When used with B<--robot>, the output will be the program version number
579 in a dotted numerical format, with no newline.
581 =item B<dpkg-deb actions>
583 See B<dpkg-deb>(1) for more information about the following actions,
584 and other actions and options not exposed by the B<dpkg> front-end.
588 =item B<-b>, B<--build> I<directory> [I<archive>|I<directory>]
592 =item B<-c>, B<--contents> I<archive>
594 List contents of a deb package.
596 =item B<-e>, B<--control> I<archive> [I<directory>]
598 Extract control-information from a package.
600 =item B<-x>, B<--extract> I<archive> I<directory>
602 Extract the files contained by package.
604 =item B<-X>, B<--vextract> I<archive> I<directory>
606 Extract and display the filenames contained by a package.
608 =item B<-f>, B<--field> I<archive> [I<control-field>...]
610 Display control field(s) of a package.
612 =item B<--ctrl-tarfile> I<archive>
614 Output the control tar-file contained in a Debian package.
616 =item B<--fsys-tarfile> I<archive>
618 Output the filesystem tar-file contained by a Debian package.
620 =item B<-I>, B<--info> I<archive> [I<control-file>...]
622 Show information about a package.
626 =item B<dpkg-query actions>
628 See B<dpkg-query>(1) for more information about the following actions,
629 and other actions and options not exposed by the B<dpkg> front-end.
633 =item B<-l>, B<--list> I<package-name-pattern>...
635 List packages matching given pattern.
637 =item B<-s>, B<--status> I<package-name>...
639 Report status of specified package.
641 =item B<-L>, B<--listfiles> I<package-name>...
643 List files installed to your system from I<package-name>.
645 =item B<-S>, B<--search> I<filename-search-pattern>...
647 Search for a filename from installed packages.
649 =item B<-p>, B<--print-avail> I<package-name>...
651 Display details about I<package-name>, as found in
652 I<%ADMINDIR%/available>. Users of APT-based frontends
653 should use B<apt show> I<package-name> instead.
661 All options can be specified both on the command line and in the B<dpkg>
662 configuration file I<%PKGCONFDIR%/dpkg.cfg> or fragment files (with names
663 matching this shell pattern '[0-9a-zA-Z_-]*') on the configuration
664 directory I<%PKGCONFDIR%/dpkg.cfg.d/>. Each line in the configuration
665 file is either an option (exactly the same as the command line option but
666 without leading hyphens) or a comment (if it starts with a ‘B<#>’).
670 =item B<--abort-after=>I<number>
672 Change after how many errors B<dpkg> will abort. The default is 50.
674 =item B<-B>, B<--auto-deconfigure>
676 When a package is removed, there is a possibility that another
677 installed package depended on the removed package. Specifying this
678 option will cause automatic deconfiguration of the package which
679 depended on the removed package.
681 =item B<-D>I<octal>, B<--debug=>I<octal>
683 Switch debugging on. I<octal> is formed by bitwise-ORing desired
684 values together from the list below (note that these values may change
685 in future releases). B<-Dh> or B<--debug=help> display these
689 1 Generally helpful progress information
690 2 Invocation and status of maintainer scripts
691 10 Output for each file processed
692 100 Lots of output for each file processed
693 20 Output for each configuration file
694 200 Lots of output for each configuration file
695 40 Dependencies and conflicts
696 400 Lots of dependencies/conflicts output
697 10000 Trigger activation and processing
698 20000 Lots of output regarding triggers
699 40000 Silly amounts of output regarding triggers
700 1000 Lots of drivel about for example the dpkg/info dir
701 2000 Insane amounts of drivel
703 =item B<--force->I<things>
705 =item B<--no-force->I<things>, B<--refuse->I<things>
707 Force or refuse (B<no-force> and B<refuse> mean the same thing)
708 to do some things. I<things> is a comma separated list of things
709 specified below. B<--force-help> displays a message describing them.
710 Things marked with (*) are forced by default.
712 B<Warning>: These options are mostly intended to be used by experts
713 only. Using them without fully understanding their effects may break
720 Turns on (or off) all force options.
722 =item B<downgrade>(*):
724 Install a package, even if newer version of it is already installed.
726 B<Warning>: At present B<dpkg> does not do any dependency
727 checking on downgrades and therefore will not warn you
728 if the downgrade breaks the dependency of some other
729 package. This can have serious side effects, downgrading
730 essential system components can even make your whole
731 system unusable. Use with care.
733 =item B<configure-any>:
735 Configure also any unpacked but unconfigured packages on which the current
740 Allow automatic installs, upgrades or removals of packages even when marked
742 B<Note>: When these actions are requested explicitly, the “hold” package
743 selection state always gets ignored.
745 =item B<remove-reinstreq>:
747 Remove a package, even if it's broken and marked to require
748 reinstallation. This may, for example, cause parts of the package to
749 remain on the system, which will then be forgotten by B<dpkg>.
751 =item B<remove-protected>:
753 Remove, even if the package is considered protected (since dpkg 1.20.1).
754 Protected packages contain mostly important system boot infrastructure or
755 are used for custom system-local meta-packages.
756 Removing them might cause the whole system to be unable to boot or lose
757 required functionality to operate, so use with caution.
759 =item B<remove-essential>:
761 Remove, even if the package is considered essential.
762 Essential packages contain mostly very basic Unix commands, required for
763 the packaging system, for the operation of the system in general or during
764 boot (although the latter should be converted to protected packages instead).
765 Removing them might cause the whole system to stop working,
770 Turn all dependency problems into warnings.
771 This affects the B<Pre-Depends> and B<Depends> fields.
773 =item B<depends-version>:
775 Don't care about versions when checking dependencies.
776 This affects the B<Pre-Depends> and B<Depends> fields.
780 Install, even if this would break another package (since dpkg 1.14.6).
781 This affects the B<Breaks> field.
785 Install, even if it conflicts with another package. This is dangerous,
786 for it will usually cause overwriting of some files.
787 This affects the B<Conflicts> field.
791 Always install the missing conffile without prompting. This is dangerous,
792 since it means not preserving a change (removing) made to the file.
796 If a conffile has been modified and the version in the package did change,
797 always install the new version without prompting, unless the
798 B<--force-confdef> is also specified, in which case the default
803 If a conffile has been modified and the version in the package did change,
804 always keep the old version without prompting, unless the
805 B<--force-confdef> is also specified, in which case the default
810 If a conffile has been modified and the version in the package did change,
811 always choose the default action without prompting. If there is no default
812 action it will stop to ask the user unless B<--force-confnew> or
813 B<--force-confold> is also been given, in which case it will use
814 that to decide the final action.
818 If a conffile has been modified always offer to replace it with the
819 version in the package, even if the version in the package did not
820 change (since dpkg 1.15.8).
821 If any of B<--force-confnew>,
822 B<--force-confold>, or B<--force-confdef> is also given,
823 it will be used to decide the final action.
827 Overwrite one package's file with another's file.
829 =item B<overwrite-dir>:
831 Overwrite one package's directory with another's file.
833 =item B<overwrite-diverted>:
835 Overwrite a diverted file with an undiverted version.
837 =item B<statoverride-add>:
839 Overwrite an existing stat override when adding it (since dpkg 1.19.5).
841 =item B<statoverride-remove>:
843 Ignore a missing stat override when removing it (since dpkg 1.19.5).
845 =item B<security-mac>(*):
847 Use platform-specific Mandatory Access Controls (MAC) based security when
848 installing files into the filesystem (since dpkg 1.19.5).
849 On Linux systems the implementation uses SELinux.
853 Do not perform safe I/O operations when unpacking (since dpkg 1.15.8.6).
855 implies not performing file system syncs before file renames, which is
856 known to cause substantial performance degradation on some file systems,
857 unfortunately the ones that require the safe I/O on the first place due
858 to their unreliable behaviour causing zero-length files on abrupt
861 I<Note>: For ext4, the main offender, consider using instead the
862 mount option B<nodelalloc>, which will fix both the performance
863 degradation and the data safety issues, the latter by making the file
864 system not produce zero-length files on abrupt system crashes with
865 any software not doing syncs before atomic renames.
867 B<Warning>: Using this option might improve performance at the cost of
868 losing data, use with care.
870 =item B<script-chrootless>:
872 Run maintainer scripts without B<chroot>(2)ing into B<instdir> even
873 if the package does not support this mode of operation (since dpkg 1.18.5).
875 B<Warning>: This can destroy your host system, use with extreme care.
877 =item B<architecture>:
879 Process even packages with wrong or no architecture.
881 =item B<bad-version>:
883 Process even packages with wrong versions (since dpkg 1.16.1).
887 B<PATH> is missing important programs, so problems are likely.
891 Try to (de)install things even when not root.
895 Install a package even if it fails authenticity check.
899 =item B<--ignore-depends>=I<package>,...
901 Ignore dependency-checking for specified packages (actually, checking is
902 performed, but only warnings about conflicts are given, nothing else).
903 This affects the B<Pre-Depends>, B<Depends> and B<Breaks> fields.
905 =item B<--no-act>, B<--dry-run>, B<--simulate>
907 Do everything which is supposed to be done, but don't write any
908 changes. This is used to see what would happen with the specified
909 action, without actually modifying anything.
911 Be sure to give B<--no-act> before the action-parameter, or you might
912 end up with undesirable results. (e.g. B<dpkg --purge foo --no-act> will
913 first purge package “foo” and then try to purge package ”--no-act”, even
914 though you probably expected it to actually do nothing).
916 =item B<-R>, B<--recursive>
918 Recursively handle all regular files matching pattern B<*.deb>
919 found at specified directories and all of its subdirectories. This can
920 be used with B<-i>, B<-A>, B<--install>, B<--unpack> and
921 B<--record-avail> actions.
925 Don't install a package if a newer version of the same package is already
926 installed. This is an alias of B<--refuse-downgrade>.
928 =item B<--admindir=>I<dir>
930 Set the administrative directory to I<directory>.
931 This directory contains many files that give information about status of
932 installed or uninstalled packages, etc.
933 Defaults to «I<%ADMINDIR%>» if B<DPKG_ADMINDIR> has not been set.
935 =item B<--instdir=>I<dir>
937 Set the installation directory, which refers to the directory where
938 packages are to be installed. B<instdir> is also the directory passed
939 to B<chroot>(2) before running package's installation scripts, which
940 means that the scripts see B<instdir> as a root directory.
943 =item B<--root=>I<dir>
945 Set the root directory to B<directory>, which sets the installation
946 directory to «I<dir>» and the administrative
947 directory to «I<dir>B<%ADMINDIR%>».
949 =item B<-O>, B<--selected-only>
951 Only process the packages that are selected for installation. The
952 actual marking is done with B<dselect> or by B<dpkg>, when it
953 handles packages. For example, when a package is removed, it will
954 be marked selected for deinstallation.
956 =item B<-E>, B<--skip-same-version>
958 Don't install the package if the same version and architecture
959 of the package is already installed.
961 Since dpkg 1.21.10, the architecture is also taken into account,
962 which makes it possible to cross-grade packages or install additional
963 co-installable instances with the same version, but different architecture.
965 =item B<--pre-invoke=>I<command>
967 =item B<--post-invoke=>I<command>
969 Set an invoke hook I<command> to be run via “sh -c” before or
970 after the B<dpkg> run for the I<unpack>, I<configure>, I<install>,
971 I<triggers-only>, I<remove>, I<purge>, I<add-architecture> and
972 I<remove-architecture> B<dpkg> actions (since dpkg 1.15.4;
973 I<add-architecture> and I<remove-architecture> actions
974 since dpkg 1.17.19). This
975 option can be specified multiple times. The order the options are specified
976 is preserved, with the ones from the configuration files taking precedence.
977 The environment variable B<DPKG_HOOK_ACTION> is set for the hooks to the
978 current B<dpkg> action.
980 B<Note>: Front-ends might call B<dpkg> several
981 times per invocation, which might run the hooks more times than expected.
983 =item B<--path-exclude=>I<glob-pattern>
985 =item B<--path-include=>I<glob-pattern>
987 Set I<glob-pattern> as a path filter, either by excluding or re-including
988 previously excluded paths matching the specified patterns during install
991 B<Warning>: Take into account that depending on the excluded paths you
992 might completely break your system, use with caution.
994 The glob patterns use the same wildcards used in the shell, were
995 ‘*’ matches any sequence of characters, including the empty string
997 For example, «I</usr/*/READ*>» matches
998 «I</usr/share/doc/package/README>».
999 As usual, ‘?’ matches any single character (again, including ‘/’).
1001 starts a character class, which can contain a list of characters, ranges
1002 and complementations. See B<glob>(7) for detailed information about
1004 B<Note>: The current implementation might re-include more directories
1005 and symlinks than needed, in particular when there is a more specific
1006 re-inclusion, to be on the safe side and avoid possible unpack failures;
1007 future work might fix this.
1009 This can be used to remove all paths except some particular ones; a typical
1012 --path-exclude=/usr/share/doc/*
1013 --path-include=/usr/share/doc/*/copyright
1015 to remove all documentation files except the copyright files.
1017 These two options can be specified multiple times, and interleaved with
1018 each other. Both are processed in the given order, with the last rule that
1019 matches a file name making the decision.
1021 The filters are applied when unpacking the binary packages, and as such
1022 only have knowledge of the type of object currently being filtered
1023 (e.g. a normal file or a directory) and have not visibility of what
1024 objects will come next.
1025 Because these filters have side effects (in contrast to B<find>(1)
1026 filters), excluding an exact pathname that happens to be a directory object
1027 like I</usr/share/doc> will not have the desired result, and only that
1028 pathname will be excluded (which could be automatically reincluded if the
1029 code sees the need).
1030 Any subsequent files contained within that directory will fail to unpack.
1032 B<Hint>: make sure the globs are not expanded by your shell.
1034 =item B<--verify-format> I<format-name>
1036 Sets the output format for the B<--verify> command (since dpkg 1.17.2).
1038 The only currently supported output format is B<rpm>, which consists
1039 of a line for every path that failed any check.
1040 These lines have the following format:
1043 B<missing > [B<c>] I<pathname> [B<(>I<error-message>B<)>]
1044 B<??5??????> [B<c>] I<pathname>
1046 The first 9 characters are used to report the checks result,
1047 either a literal B<missing> when the file is not present or its metadata
1049 or one of the following special characters that report the result for each
1056 Implies the check could not be done (lack of support, file permissions, etc).
1060 Implies the check passed.
1062 =item ‘I<A-Za-z0-9>’
1064 Implies a specific check failed.
1065 The following positions and alphanumeric characters are currently supported:
1071 These checks are currently not supported, will always be ‘B<?>’.
1075 The file mode check failed (since dpkg 1.21.0).
1076 Because pathname metadata is currently not tracked, this check can only be
1077 partially emulated via a very simple heuristic for pathnames that have a
1078 known digest, which implies they should be regular files, where the check
1079 will fail if the pathname is not a regular file on the filesystem.
1080 This check will currently never succeed as it does not have enough
1081 information available.
1085 The digest check failed, which means the file contents have changed.
1089 These checks are currently not supported, will always be ‘B<?>’.
1095 The line is followed by a space and an attribute character.
1096 The following attribute character is supported:
1102 The pathname is a conffile.
1106 Finally followed by another space and the pathname.
1108 In case the entry was of the B<missing> type, and the file was not actually
1109 present on the filesystem, then the line is followed by a space and the
1110 error message enclosed within parenthesis.
1112 =item B<--status-fd> I<n>
1114 Send machine-readable package status and progress information to file
1115 descriptor I<n>. This option can be specified multiple times. The
1116 information is generally one record per line, in one of the following
1121 =item B<status:> I<package>B<:> I<status>
1123 Package status changed; I<status> is as in the status file.
1125 =item B<status:> I<package> B<: error :> I<extended-error-message>
1127 An error occurred. Any possible newlines in I<extended-error-message>
1128 will be converted to spaces before output.
1130 =item B<status:> I<file> B<: conffile-prompt : '>I<real-old>B<' '>I<real-new>B<'> I<useredited> I<distedited>
1132 User is being asked a conffile question.
1134 =item B<processing:> I<stage>B<:> I<package>
1136 Sent just before a processing stage starts. I<stage> is one of
1137 B<upgrade>, B<install> (both sent before unpacking),
1138 B<configure>, B<trigproc>, B<disappear>, B<remove>, B<purge>.
1142 =item B<--status-logger>=I<command>
1144 Send machine-readable package status and progress information to the
1145 shell I<command>'s standard input, to be run via “sh -c”
1146 (since dpkg 1.16.0).
1147 This option can be specified multiple times.
1148 The output format used is the same as in B<--status-fd>.
1150 =item B<--log=>I<filename>
1152 Log status change updates and actions to I<filename>, instead of
1153 the default I<%LOGDIR%/dpkg.log>. If this option is given multiple
1154 times, the last filename is used. Log messages are of the form:
1158 =item YYYY-MM-DD HH:MM:SS B<startup> I<type> I<command>
1160 For each dpkg invocation where I<type> is B<archives> (with a
1161 I<command> of B<unpack> or B<install>) or B<packages>
1162 (with a I<command> of B<configure>, B<triggers-only>,
1163 B<remove> or B<purge>).
1165 =item YYYY-MM-DD HH:MM:SS B<status> I<state> I<pkg> I<installed-version>
1167 For status change updates.
1169 =item YYYY-MM-DD HH:MM:SS I<action> I<pkg> I<installed-version> I<available-version>
1171 For actions where I<action> is one of B<install>, B<upgrade>,
1172 B<configure>, B<trigproc>, B<disappear>, B<remove> or B<purge>.
1174 =item YYYY-MM-DD HH:MM:SS B<conffile> I<filename> I<decision>
1176 For conffile changes where I<decision> is either B<install> or
1183 Use a machine-readable output format. This provides an interface for programs
1184 that need to parse the output of some of the commands that do not otherwise
1185 emit a machine-readable output format. No localization will be used, and the
1186 output will be modified to make it easier to parse.
1188 The only currently supported command is B<--version>.
1192 Disables the use of any pager when showing information (since dpkg 1.19.2).
1194 =item B<--no-debsig>
1196 Do not try to verify package signatures.
1198 =item B<--no-triggers>
1200 Do not run any triggers in this run (since dpkg 1.14.17), but activations
1201 will still be recorded.
1202 If used with B<--configure> I<package> or
1203 B<--triggers-only> I<package> then the named package postinst
1204 will still be run even if only a triggers run is needed. Use of this option
1205 may leave packages in the improper B<triggers-awaited> and
1206 B<triggers-pending> states. This can be fixed later by running:
1207 B<dpkg --configure --pending>.
1211 Cancels a previous B<--no-triggers> (since dpkg 1.14.17).
1221 The requested action was successfully performed.
1222 Or a check or assertion command returned true.
1226 A check or assertion command returned false.
1230 Fatal or unrecoverable error due to invalid command-line usage, or
1231 interactions with the system, such as accesses to the database,
1232 memory allocations, etc.
1238 =head2 External environment
1244 This variable is expected to be defined in the environment and point to
1245 the system paths where several required programs are to be found. If it's
1246 not set or the programs are not found, B<dpkg> will abort.
1250 If set, B<dpkg> will use it as the directory from which to read the user
1251 specific configuration file.
1255 If set, B<dpkg> will use it as the directory in which to create
1256 temporary files and directories.
1260 The program B<dpkg> will execute when starting a new interactive shell,
1261 or when spawning a command via a shell.
1267 The program B<dpkg> will execute when running a pager,
1268 which will be executed with «B<$SHELL -c>»,
1269 for example when displaying the conffile differences.
1270 If B<SHELL> is not set, «B<sh>» will be used instead.
1271 The B<DPKG_PAGER> overrides the B<PAGER> environment variable
1272 (since dpkg 1.19.2).
1274 =item B<DPKG_COLORS>
1276 Sets the color mode (since dpkg 1.18.5).
1277 The currently accepted values are: B<auto> (default), B<always> and
1282 Sets the debug mask (since dpkg 1.21.10) from an octal value.
1283 The currently accepted flags are described in the B<--debug> option.
1287 Sets the force flags (since dpkg 1.19.5).
1288 When this variable is present, no built-in force defaults will be applied.
1289 If the variable is present but empty, all force flags will be disabled.
1291 =item B<DPKG_ADMINDIR>
1293 If set and the B<--admindir> or B<--root> options have not been
1294 specified, it will be used as the B<dpkg> administrative directory
1295 (since dpkg 1.20.0).
1297 =item B<DPKG_FRONTEND_LOCKED>
1299 Set by a package manager frontend to notify dpkg that it should not acquire
1300 the frontend lock (since dpkg 1.19.1).
1304 =head2 Internal environment
1310 Defined by B<dpkg> to “B<-FRSXMQ>”, if not already set, when
1311 spawning a pager (since dpkg 1.19.2).
1312 To change the default behavior, this variable can be preset to some other
1313 value including an empty string, or the B<PAGER> or B<DPKG_PAGER>
1314 variables can be set to disable specific options with «B<-+>», for
1315 example B<DPKG_PAGER="less -+F">.
1319 Defined by B<dpkg> on the maintainer script environment to indicate
1320 which installation to act on (since dpkg 1.18.5).
1321 The value is intended to be prepended to any path maintainer scripts
1323 During normal operation, this variable is empty.
1324 When installing packages into a different B<instdir>, B<dpkg>
1325 normally invokes maintainer scripts using B<chroot>(2) and leaves
1326 this variable empty, but if B<--force-script-chrootless> is
1327 specified then the B<chroot>(2) call is skipped and B<instdir>
1330 =item B<DPKG_ADMINDIR>
1332 Defined by B<dpkg> on the maintainer script environment to indicate
1333 the B<dpkg> administrative directory to use (since dpkg 1.16.0).
1334 This variable is always set to the current B<--admindir> value.
1338 Defined by B<dpkg> on the subprocesses environment to all the currently
1339 enabled force option names separated by commas (since dpkg 1.19.5).
1341 =item B<DPKG_SHELL_REASON>
1343 Defined by B<dpkg> on the shell spawned on the conffile prompt to
1344 examine the situation (since dpkg 1.15.6).
1345 Current valid value: B<conffile-prompt>.
1347 =item B<DPKG_CONFFILE_OLD>
1349 Defined by B<dpkg> on the shell spawned on the conffile prompt to
1350 examine the situation (since dpkg 1.15.6).
1351 Contains the path to the old conffile.
1353 =item B<DPKG_CONFFILE_NEW>
1355 Defined by B<dpkg> on the shell spawned on the conffile prompt to
1356 examine the situation (since dpkg 1.15.6).
1357 Contains the path to the new conffile.
1359 =item B<DPKG_HOOK_ACTION>
1361 Defined by B<dpkg> on the shell spawned when executing a hook action
1362 (since dpkg 1.15.4).
1363 Contains the current B<dpkg> action.
1365 =item B<DPKG_RUNNING_VERSION>
1367 Defined by B<dpkg> on the maintainer script environment to the
1368 version of the currently running B<dpkg> instance (since dpkg 1.14.17).
1370 =item B<DPKG_MAINTSCRIPT_PACKAGE>
1372 Defined by B<dpkg> on the maintainer script environment to the
1373 (non-arch-qualified) package name being handled (since dpkg 1.14.17).
1375 =item B<DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT>
1377 Defined by B<dpkg> on the maintainer script environment to the
1378 package reference count, i.e. the number of package instances with
1379 a state greater than B<not-installed> (since dpkg 1.17.2).
1381 =item B<DPKG_MAINTSCRIPT_ARCH>
1383 Defined by B<dpkg> on the maintainer script environment to the
1384 architecture the package got built for (since dpkg 1.15.4).
1386 =item B<DPKG_MAINTSCRIPT_NAME>
1388 Defined by B<dpkg> on the maintainer script environment to the
1389 name of the script running, one of B<preinst>, B<postinst>,
1390 B<prerm> or B<postrm> (since dpkg 1.15.7).
1392 =item B<DPKG_MAINTSCRIPT_DEBUG>
1394 Defined by B<dpkg> on the maintainer script environment to a value
1395 (‘B<0>’ or ‘B<1>’) noting whether debugging has been
1396 requested (with the B<--debug> option) for the maintainer scripts
1397 (since dpkg 1.18.4).
1405 =item I<%PKGCONFDIR%/dpkg.cfg.d/[0-9a-zA-Z_-]*>
1407 Configuration fragment files (since dpkg 1.15.4).
1409 =item I<%PKGCONFDIR%/dpkg.cfg>
1411 Configuration file with default options.
1413 =item I<%LOGDIR%/dpkg.log>
1415 Default log file (see I<%PKGCONFDIR%/dpkg.cfg> and option
1420 The other files listed below are in their default directories, see option
1421 B<--admindir> to see how to change locations of these files.
1425 =item I<%ADMINDIR%/available>
1427 List of available packages.
1429 =item I<%ADMINDIR%/status>
1431 Statuses of available packages. This file contains information about
1432 whether a package is marked for removing or not, whether it is
1433 installed or not, etc. See section B<INFORMATION ABOUT PACKAGES>
1436 The status file is backed up daily in I<%BACKUPSDIR%>. It can be
1437 useful if it's lost or corrupted due to filesystems troubles.
1441 The format and contents of a binary package are described in B<deb>(5).
1445 Any operation that needs write access to the database or the filesystem
1446 is considered a privileged operation that might allow root escalation.
1447 These operations must never be delegated to an untrusted user or be done
1448 on untrusted packages, as that might allow root access to the system.
1450 Some operations (such as package verification) might need root privileges
1451 to be able to access files on the filesystem that would otherwise be
1452 inaccessible due to restricted permissions, but should otherwise work
1453 normally and produce appropriate messages in those cases.
1455 Query operations should never require root, and delegating their execution
1456 to unprivileged users via some gain-root command can have security
1457 implications (such as privilege escalation), for example when a pager is
1458 automatically invoked by the tool.
1460 See also the B<SECURITY> section of the L<dpkg-deb(1)> and L<dpkg-split(1)>
1465 B<--no-act> usually gives less information than might be helpful.
1469 To list installed packages related to the editor B<vi>(1) (note that
1470 B<dpkg-query> does not load the I<available> file anymore by
1471 default, and the B<dpkg-query> B<--load-avail> option should
1472 be used instead for that):
1480 To see the entries in I<%ADMINDIR%/available> of two packages:
1484 dpkg --print-avail elvis vim | less
1488 To search the listing of packages yourself:
1492 less %ADMINDIR%/available
1496 To remove an installed elvis package:
1504 To install a package, you first need to find it in an archive or
1505 CDROM. The I<available> file shows that the vim package is in section
1510 cd /media/cdrom/pool/main/v/vim
1511 dpkg -i vim_4.5-3.deb
1515 To make a local copy of the package selection states:
1519 dpkg --get-selections >myselections
1523 You might transfer this file to another computer, and after having updated
1524 the I<available> file there with your package manager frontend of choice
1525 (see L<https://wiki.debian.org/Teams/Dpkg/FAQ#set-selections> for more
1526 details), for example:
1530 apt-cache dumpavail | dpkg --merge-avail
1534 or with dpkg 1.17.6 and earlier:
1539 apt-cache dumpavail >"$avail"
1540 dpkg --merge-avail "$avail"
1545 you can install it with:
1549 dpkg --clear-selections
1550 dpkg --set-selections <myselections
1554 Note that this will not actually install or remove anything, but just
1555 set the selection state on the requested packages. You will need some
1556 other application to actually download and install the requested
1557 packages. For example, run B<apt-get dselect-upgrade>.
1559 Ordinarily, you will find that B<dselect>(1) provides a more
1560 convenient way to modify the package selection states.
1562 =head1 ADDITIONAL FUNCTIONALITY
1564 Additional functionality can be gained by installing any of the
1565 following packages: B<apt>, B<aptitude> and B<debsums>.
1578 B<dpkg-reconfigure>(8).
1582 See I<%PKGDOCDIR%/THANKS> for the list of people who have
1583 contributed to B<dpkg>.