1

So I am writing a script that changes various aspects of an Ubuntu 16.04.4 machine and one of the tasks is upgrading all packages. To do this I useapt-get -y upgrade. (-y for auto yes on dialogue and provide automation) This works fine and is automated for nearly all packages but once every so often I will get the interaction pane depicted below.

I'm assuming there is no easy way to handle and answer these dialogues in a uniform way across all packages but is there a way to disable such an interaction and provide a truly automated, interaction-free upgrade?

David Foerster
  • 36,890
  • 56
  • 97
  • 151

1 Answers1

3

You can do a couple of things for avoiding this. Setting the DEBIAN_FRONTEND variable to noninteractive and using -y flag. For example:

export DEBIAN_FRONTEND=noninteractive
apt-get -yq install [packagename]

If you need to install it via sudo, use:

sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install [packagename]

(source)

David Foerster
  • 36,890
  • 56
  • 97
  • 151