24

How can i disable totally the prompts that appear while installing a Debian package, i've used all the options that i've found but there are some packages that are still prompting.

I'm using this command:

apt-get -y --allow-unauthenticated --force-yes -o DPkg::Options::="--force-overwrite" -o DPkg::Options::="--force-confdef" install x11-common

Why the x11-common package is still prompting? how can i get rid of these prompts?

Thanks in advance

--Victor

Edit: just to clarify, the prompts are not "yes/no" prompts, are open questions in a coloured screen (typical two color screen) but i want to set the default option of these questions

4 Answers 4

44

Select a new front end by setting your env.

DEBIAN_FRONTEND=noninteractive apt-get -y install x11-common

I use this all the time in automating package installation with cfengine.

2
  • +1 This is the right answer
    – lynxman
    Aug 17, 2011 at 9:47
  • 1
    In some strange cases such as when you need to use this inside chroot non interactively you can use DEBIAN_FRONTEND=noninteractive sudo -E chroot . echo "something" Sep 4, 2016 at 4:49
8

Not having manually install x11-common, I am not sure what questions you are being asked. But if they are coming from debconf, then you should be able to pre-answer the questions with debconf-set-selections.

2
  • This is the solution, thanks. I've get the properties with debconf-get-selections and set them previously with the debconf-set-selections and no more prompts appeared
    – victorgp
    Dec 9, 2010 at 18:33
  • Even with selections set some packages may still ask questions depending on the priority. But I do recommend setting selections where possible. Setting the frontend to noninteractive is the magic "don't ask me anything no matter what" flag.
    – bahamat
    Jun 30, 2013 at 6:04
4

You need to dpkg-reconfigure debconf and tell it to "Ignore questions with a priority less than: Critical".

This doesn't get you out of answering critical questions.

2

To disable the prompts globally for reconfiguring all packages with debconf, just comment out the second line from /etc/apt/apt.conf.d/70debconf file.

Or if you're provisioning VM, add these commands to your provision script:

sudo ex +"%s@DPkg@//DPkg" -cwq /etc/apt/apt.conf.d/70debconf
sudo dpkg-reconfigure debconf -f noninteractive -p critical

You may also try the same way how Travis CI does it:

sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install some_package

For some other packages, like ttf-mscorefonts-installer (which is dependent on language-pack-en), the above seems to not work, so try:

echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install -y language-pack-en
1
  • 2
    --force-yes is a VERY scary and not recommended way to blast through prompts. Don't be surprised if you end up with a broken and possibly irrecoverable system someday.
    – dragon788
    Apr 18, 2018 at 20:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .