Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 10 down vote accepted

The answer was to set the perl:locale's as per: http://www.thomas-krenn.com/en/wiki/Perl_warning_Setting_locale_failed_in_Debian

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 sovles the issue but does add unwanted time to the vagrant up provisioning.

share|improve this answer
add comment

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

Or:

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) –  Coombesy Apr 19 '13 at 1:34
    
I edited the post. See the very last line. –  BullShark Apr 19 '13 at 1:45
add comment

Your Answer

 
discard

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.