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 ?


This 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 ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.