dpkg
can be instructed not to ask for confirmation when replacing a configuration file (with the --force-confdef --force-confold
options). Interactions can, however, have three other sources: some come from APT itself, some are handled by debconf
, and some happen on the command line due to package configuration scripts.
-y
option (or --assume-yes
) tells APT to consider the answer to all its questions to be “yes”.
debconf
deserves more details. This program was, from its inception, designed to control the relevance and volume of questions displayed to the user, as well as the way they are shown. That is why its configuration requests a minimal priority for questions; only questions above the minimal priority are displayed. debconf
assumes the default answer (defined by the package maintainer) for questions which it decided to skip.
noninteractive
out of the choices, all user interaction is disabled. If a package tries to display an informative note, it will be sent to the administrator by email.
debconf
, use the dpkg-reconfigure
tool from the debconf package; the relevant command is dpkg-reconfigure debconf
. Note that the configured values can be temporarily overridden with environment variables when needed (for instance, DEBIAN_FRONTEND
controls the interface, as documented in the debconf(7) manual page).
dpkg
. There is unfortunately no standard solution, and no answer is overwhelmingly better than another.
/dev/null
into it with command
</dev/null
, or to feed it with an endless stream of newlines. None of these methods are 100 % reliable, but they generally lead to the default answers being used, since most scripts consider a lack of reply as an acceptance of the default value.
Example 6.3. Non-interactive upgrade script
export DEBIAN_FRONTEND=noninteractive yes '' | apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade