21

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
  • I was suggesting to use -y but seems it doesn't change much. see man apt-get | less +/--force-yes – Valentin Bajrami Jul 24 '14 at 8:25
  • I've tried that optiont too, but that didn't worked either. – OrangeTux Jul 24 '14 at 8:44
21

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.

  • 1
    Doesn't work in this case. – Nigel Horne Jul 8 at 14:42
  • 1
    Please specify what "this case" is. The author of the question has selected this answer as correct. If the answer does not work for you, I recommend you ask a new question and make sure to clarify how your case is different, and that this does not work for you. – Patrick Jul 8 at 18:28
  • It didn't work for me neither. – Felipe Jul 10 at 1:40
7

You should be able to achieve this using debconf-set-selections. From the man page:

debconf-set-selections can be used to pre-seed the debconf database
with answers, or to change answers in the database. Each question will
be marked as seen to prevent debconf from asking the question
interactively.

In order to determine the required input to debconf-set-selections if unknown, you can answer the prompt manually and then inspect the debconf database to find the correct value. To do this, install debconf-utils:

sudo apt-get -y install debconf-utils

which provides the debconf-get-selections command. Then:

sudo debconf-get-selections | grep libssl1.0.0:amd64

to check the values in the database. On my system (Ubuntu, but Debian should be similar) I am not prompted when I apt-get install libpq-dev, and I have this entry:

libssl1.0.0:amd64   libssl1.0.0/restart-services     string

so you should be able to use:

echo 'libssl1.0.0:amd64 libssl1.0.0/restart-services string' | sudo debconf-set-selections

to set the list of services to restart when upgrading libssl to 'none'.

Under Debian, there should be more information about valid values for this line in the questions.dat file under /var/lib/cdebconf. See https://www.debian.org/releases/stable/i386/apbs03.html.en for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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