13

There is

apt-get -o Dpkg::Options::="--force-confnew"

and

apt-get -o Dpkg::Options::="--force-confold"

and many more.

How can I get a list of all Dpkg::Options and their currently set values?

MestreLion
  • 20,086

3 Answers3

17

Unfortunately, apt-config dump doesn't list the dpkg options you were looking for. man dpkg helped me find this command, --force-help, which is more specific to the particular dpkg force options you were interested in, but not a comprehensive list of options:

$ dpkg --force-help
dpkg forcing options - control behaviour when problems found:
  warn but continue:  --force-<thing>,<thing>,...
  stop with error:    --refuse-<thing>,<thing>,... | --no-force-<thing>,...
 Forcing things:
  [!] all                Set all force options
  [*] downgrade          Replace a package with a lower version
      configure-any      Configure any package which may help this one
      hold               Process incidental packages even when on hold
      not-root           Try to (de)install things even when not root
      bad-path           PATH is missing important programs, problems likely
      bad-verify         Install a package even if it fails authenticity check
      bad-version        Process even packages with wrong versions
      overwrite          Overwrite a file from one package with another
      overwrite-diverted Overwrite a diverted file with an undiverted version
  [!] overwrite-dir      Overwrite one package's directory with another's file
  [!] unsafe-io          Do not perform safe I/O operations when unpacking
  [!] confnew            Always use the new config files, don't prompt
  [!] confold            Always use the old config files, don't prompt
  [!] confdef            Use the default option for new config files if one
                         is available, don't prompt. If no default can be found,
                         you will be prompted unless one of the confold or
                         confnew options is also given
  [!] confmiss           Always install missing config files
  [!] confask            Offer to replace config files with no new versions
  [!] architecture       Process even packages with wrong or no architecture
  [!] breaks             Install even if it would break another package
  [!] conflicts          Allow installation of conflicting packages
  [!] depends            Turn all dependency problems into warnings
  [!] depends-version    Turn dependency version problems into warnings
  [!] remove-reinstreq   Remove packages which require installation
  [!] remove-essential   Remove an essential package

WARNING - use of options marked [!] can seriously damage your installation.
Forcing options marked [*] are enabled by default.
d4nyll
  • 2,664
  • 1
    This is helpful, as is https://linux.die.net/man/1/dpkg (see the --force-*things* section) however neither shows the current set values as requested by OP. – thom_nic Oct 18 '17 at 18:50
  • 1
    I should have also mentioned that apt-config dump will list Dpkg::Options, but only if some are set e.g. in /etc/apt/apt.conf.d/. S.a. https://askubuntu.com/a/104912/399010 – thom_nic Oct 18 '17 at 19:01
8

Can be done using.

apt-config dump
1

Short Answer: dpkg --force-help

I disagree with the accepted answer. Although apt-config dump is helpful for viewing some of the currently-enabled options - many of which are commonly useful for simple apt operations - it does not show all of the options for dpkg actions, namely, the "force" options to which the original question refers. For viewing which of these additional options are enabled by default, as well as which options should only be changed when completely necessary by a well-informed user, one must use the help provided (from CLI) by dpkg --force-help. The man page for dpkg provides a short explanation of this flag's output under its section describing the --force-*things* flag for the dpkg command. This man page can also be viewed online: http://man7.org/linux/man-pages/man1/dpkg.1.html https://linux.die.net/man/1/dpkg (These are just a couple locations).