How to Prevent Restart Services Prompt When Installing libpq-dev

aptdebiansoftware installation

I want to install libpq-dev on my Vagrant machine. I install it with

$ apt-get install -y libpq-dev

During installation a prompt appears which asks if it's allowed to restart some services automatically. This prompt breaks my Vagrant provision. How can disable this prompt?

prompt

Text:

There are services installed on your system which need to be restarted when
certain libraries, such as libpam, libc, and libssl, are upgraded. Since these
restarts may cause interruptions of service for the system, you will normally be
prompted on each upgrade for the list of services you wish to restart. You can
choose this option to avoid being prompted; instead, all necessary restarts will
be done for you automatically so you can avoid being asked questions on each
library upgrade.

****EDIT ****

Thanks to Patrick's answer and this question I fixed it. Now my Vagrantfile contains:

 sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libpq-dev

Best Answer

Set the environment variable DEBIAN_FRONTEND=noninteractive.

For example:

export DEBIAN_FRONTEND=noninteractive
apt-get install -y libpq-dev

This will make apt-get select the default options.

Related Question