This question already has an answer here:

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?

marked as duplicate by David Foerster, karel, Fabby, Eric Carvalho, waltinator May 31 '18 at 19:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I do get that but I am deploying this script under the precondition that no user is ever going to be interacting with the output so that -y flag is necessary frankly what I desire ~90% of the time. – Jake Lawrence May 30 '18 at 17:44

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]


  • Welcome to Ask Ubuntu! There's another and more important reason to include the relevant parts of linked resources than convenience in line: the linked resource may change or vanish in a way that invalidates the answer. Link-only answers are discouraged and usually deleted in review for that reason on Stack Exchange. – David Foerster May 30 '18 at 19:02

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