10

I am installing packages on remote server, using ssh:

ssh root@my-host "DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get --quiet --yes install w3m"

even though I have set DEBIAN_FRONTEND=noninteractive, the installation gets stuck on following question, and I have to press enter manually:

Configuration file '/etc/w3m/config'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** config (Y/I/N/O/D/Z) [default=N] ? 

I suspect, the question is being asked by dpkg --configure -a and not by apt-get and therefore noninteractive is ignored.

How can I automate this and have default option selected automatically, without being asked ?

1 Answer 1

16

This kind of configuration file change conflict is dealt with by dpkg, and you can force it to choose the default option using the --force-confdef option. Do heed the warning from the documentation though:

Warning: These options are mostly intended to be used by experts only. Using them without fully understanding their effects may break your whole system.

To provide this option when dpkg is invoked by APT, you need to add it to the APT settings, for example by adding the following line to /etc/apt/apt.conf:

DPkg::options { "--force-confdef"; };

or, for a single invocation:

apt-get -o DPkg::Options::=--force-confdef ...

DEBIAN_FRONTEND=noninteractive only affects debconf, and that’s not involved at all in this scenario.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.