Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am building a provisioning script for a ubuntu vagrant vm, on a ubuntu host, both 12.10 64bit When installing the following packages:

sudo apt-get -y install php5-xsl graphviz php-pear unison

I get the warning:

dpkg-reconfigure: unable to re-open stdin: No file or directory

have tried searching but results are throwing up every other error with apt-get possible, can't find out how to supress the warning above. The installs work, but the warning above is causing error lines in the vagrant up stdout.

Anybody any idea what could be the cause or how to suppress the warning

share|improve this question

I got the error message to go away by putting the following in my provisioning script, prior to any apt-get calls:

export DEBIAN_FRONTEND=noninteractive

This makes debconf use a frontend that expects no interactive input at all, preventing it from even trying to access stdin.

share|improve this answer
This is the correct answer. Most config management applications (SaltStack, Puppet, etc) leverage this for non-interactive package installs. – notpeter May 4 '15 at 19:25
Correct answer, I second that. – stefgosselin May 31 '15 at 17:54
up vote 22 down vote accepted

The answer was to set the perl:locale's as per this:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

This solves the issue, but does add unwanted time to the vagrant up provisioning.

share|improve this answer
This alone did not work for me. I still got the warning until I implemented @kenorb's 70debconf commenting-out fix for preconfigure. – Brian Aug 31 '15 at 21:18
My question is: Is it fine to ignore these warnings? @Coombesy – Marco Prins Sep 23 '15 at 7:07
@MarcoPrins Yes, you can safely ignore warnings like "stdin: is not a tty" or "dpkg-preconfigure: unable to re-open stdin: No such file or directory". One of numerous confirmations around can be found, e.g. here – mloskot Nov 1 '15 at 18:22

Bash redirection works fine for stdout and stderr.

To redirect the error stream, use the following:

sudo apt-get -y install php5-xsl graphviz php-pear unison 2> /dev/null

To redirect both stdout (messages that are not errors/warnings) and stderr both, use:

sudo apt-get -y install php5-xsl graphviz php-pear unison &> /dev/null

That is a shortcut available in bash for this:

sudo apt-get -y install php5-xsl graphviz php-pear unison > /dev/null 2>&1


sudo apt-get -y install php5-xsl graphviz php-pear unison 1> /dev/null 2>&1

Below, we can clearly see that file descriptor 1 is stdout, 2 stderr, 3 stdin.

$ ls -l /dev/std*
lrwxrwxrwx 1 root root 15 Apr 18 19:03 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Apr 18 19:03 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Apr 18 19:03 /dev/stdout -> /proc/self/fd/1

So for what you are saying you want to do, you should only need the very first command I gave.

share|improve this answer
I want to be able to echo the normal stdout from apt-get. But you may have me on the right track... i'll try sending just the stderr to the bit-bucket - cheers edit: we both commented at the same time lol - cheers (again) – Daithí Apr 19 '13 at 1:34
I edited the post. See the very last line. – BullShark Apr 19 '13 at 1:45

Run this command:

cat /etc/apt/apt.conf.d/70debconf 

to see if you've this file. If so, the solution is to comment out the DPkg line which prevents pre-configuring all packages with debconf before they are installed.

So add these commands to your provision file:

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

Otherwise if you don't care about this file, simply remove it:

sudo rm -v /etc/apt/apt.conf.d/70debconf

Here are few other commands to consider, but I don't think they do anything useful:

sudo dpkg-preconfigure -f noninteractive -p critical
sudo dpkg --configure -a
share|improve this answer
This is what finally worked for me on OSX Yosemite Vagrant and Ubuntu 14.04. – Brian Aug 31 '15 at 21:13
You may still need to change the shell Vagrant uses. – ToothlessRebel Sep 2 '15 at 19:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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