Score:1

Why would Dpkg::Options --force-confold be ignored?

fj flag

I have been trying to suppress an interactive dialog with regards to modified config files and conflicts. I have been all over the search results, and everyone keeps copy and pasting the same exact answer without providing additional context.

I have landed at the solution to put a config file in /etc/apt/apt.conf.d that contains the well-copy-pasted item:

Dpkg::Options {
   "--force-confdef";
   "--force-confold";
}

I have included APT::Get::Assume-Yes "true"; and this is absolutely working. I have confirmed with apt-config that the Dpkg::Options are being loaded. But every time I try DEBIAN_FRONTEND=noninteractive sudo apt upgrade with this config, the interactive dialog stops my automated script.

Could someone provide more than copypasta as to why this config is failing? Why would these settings be ignored?


To reproduce my plight:

  1. Create a new Ubuntu 20.04 instance on Lightsail
  2. Add /etc/apt/apt.conf.d/99confold containing the settings above
  3. Modify /etc/cloud/cloud.cfg in some way
  4. sudo apt update then sudo apt upgrade

The conflict dialog still appears towards the end of the updates.

JBCP avatar
us flag
I am running into this using the options on the command line, trying to install nvidia-docker2 and related packages.
Score:0
nc flag

There are a few reasons why the Dpkg::Options setting you've specified in your /etc/apt/apt.conf.d file might be ignored:

You may be using a version of apt that does not support the Dpkg::Options setting. The Dpkg::Options setting was introduced in apt version 1.1.0, so if you are using an older version, this setting will be ignored.

The Dpkg::Options setting may be overridden by a setting in another configuration file. apt reads configuration files from multiple locations, and settings in later files can override earlier ones. For example, if you have a file /etc/apt/apt.conf.d/99force-confold that contains the line Dpkg::Options {"--force-confnew"};, this setting will override the --force-confold setting you specified in your earlier configuration file.

The Dpkg::Options setting may not apply to the specific package or operation you are performing. The Dpkg::Options setting affects how dpkg handles configuration files when installing or upgrading packages, but it may not apply to other operations such as removing packages or updating the package cache.

If you are using a recent version of apt and the Dpkg::Options setting is not being overridden by another configuration file, it's possible that the --force-confold option is not applicable to the operation you are trying to perform. You can try specifying the --force-confdef option instead, which forces dpkg to use the default version of any modified configuration files.

It's also worth noting that the DEBIAN_FRONTEND=noninteractive setting does not suppress all interactive prompts when using apt. It only suppresses prompts that are specifically related to the debconf system, which is used to ask questions and set configuration options during the installation of certain packages. If you are seeing an interactive prompt that is not related to debconf, this setting will not suppress it.

timi avatar
fj flag
Thanks so much for taking the time! There aren't any config conflicts with `--force-confnew` according to `apt-config`. I have added reproduction steps which show what I'm running into in the fewest steps possible.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.