apt-get update non interactive

>= Apt 1.1

If you're using Apt 1.1 or above, --force-yes has been deprecated, so you've to use the options starting with --allow instead, e.g. --allow-downgrades, --allow-remove-essential, --allow-change-held-packages.

So the command is:

DEBIAN_FRONTEND=noninteractive \
  apt-get \
  -o Dpkg::Options::=--force-confold \
  -o Dpkg::Options::=--force-confdef \
  -y --allow-downgrades --allow-remove-essential --allow-change-held-packages

Note: Use --force-confold to keep old, and --force-confnew to keep new configs.

Source: CFE-2360: Make apt_get package module version aware.

Related:

  • 100% non-interactive Debian dist-upgrade
  • How do I ask apt-get to skip any interactive post-install configuration steps?
  • Non-interactive apt upgrade

You need to pass some dpkg options to your commands, for instance:

export DEBIAN_FRONTEND=noninteractive
apt-get update && 
    apt-get -o Dpkg::Options::="--force-confold" upgrade -q -y --force-yes &&
    apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -q -y --force-yes

On a side note, I would recommend using only dist-upgrade, you will eventually end up with broken dependencies if you use upgrade.

Tags:

Ubuntu

Apt Get