New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdin: is not a tty #1673
Comments
Yeah this is a known "thing." It is not really a problem because it doesn't really cause a problem. Actually, the reason this error message even appears is due to a bug in Ubuntu not checking whether stdin is a TTY, and just assuming it is. |
thanks for your quick reply ! I won't bother then :) |
Is there any workaround possible to avoid this warning? For some reason it annoys me unnaturally 😄 |
Yea, along with occasional |
Is this also something to not worry about? dpkg-preconfigure: unable to re-open stdin: No such file or directory |
For those looking for a fix, see https://bugs.launchpad.net/ubuntu/+source/xen-3.1/+bug/1167281. I recently built my own box using veewee and replaced:
With:
In file |
Adding this to a shell provisioner should fix it: |
@johnraz , thanks for that 👍 |
@johnraz that worked for me too on one host machine but on another host machine I now get:
|
It's really a nasty hack anyway and I only tried it against ubuntu 12.04 ... Guess you will have to adapt it to whatever distro / version you are using. |
I did say earlier this bug "annoys me unnaturally".. I decided today I wouldn't stop until I understood why this happens. 😄 Unfortunately this entire situation with shells and configuration files ( Vagrant defaults its SSH shell command to On Ubuntu, So it's true that Ubuntu's default However, I don't think the onus is on Ubuntu to implement this change as @mitchellh suggests. Their A better way to fix this would be to avoid using a login shell. I think the only reason Vagrant chooses to use a login shell is so that Honestly, I think there are some problems with the way the base box is built, specifically what happens in
tl;dr: Environment variables and shell configurations are FUBAR. @mitchellh (I believe?) should maybe adjust [1] B. Toxen, Real World Linux Security: Intrusion Prevention, Detection, and Recovery. Upper Saddle River, NJ: Prentice Hall, 2003. http://goo.gl/kmKryu |
Oh, one more thing: for the time being, I'm fixing this by adding this line to my Vagrantfile: config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" This starts bash as a non-login shell, but also tells it to source Some other ways to fix the issue:
|
@bradfeehan : Very interesting findings. Thanks for taking the time to dig this and share it with us. |
@bradfeehan thank you so much for writing this up! I tried |
… Vagrantfile. This supresses the harmless but annoying 'stdin: is not a tty' error that is generated every time a shell script provisioner is run. Thanks @bradfeehan for your comment on this page: hashicorp/vagrant#1673
@bradfeehan Wow, thanks! This bothered me to no end. I was about to go in for the deep dive to sort this out. |
@bradfeehan this worked for me! thanks. |
There's a problem with this workaround that means you don't get I'm going to put up with the message, and solve it a different way when it annoys me too much again. |
If anybody get this error:
Or their vagrant box runs out of memory, remove the |
@phirschybar I was also getting that error message: " tty: extra operand 'mesg' " config.vm.provision :shell,
:inline => "sed -i 's/^mesg n$/tty -s \\&\\& mesg n/g' /root/.profile" Note the double-backslashes before the ampersand. If you don't do that, you end up writing unintended text into /root/.profile, leading to that error message in subsequent provisions. This command is almost perfect, but you still get that 'stdin is not a tty' on your very first provision. To reassure my colleagues when provisioning a box for the first time, I now add the following to my Vagrantfile: #This next bit fixes the 'stdin is not a tty' error when shell provisioning Ubuntu boxes
config.vm.provision :shell,
#if there a line that only consists of 'mesg n' in /root/.profile, replace it with 'tty -s && mesg n'
:inline => "(grep -q -E '^mesg n$' /root/.profile && sed -i 's/^mesg n$/tty -s \\&\\& mesg n/g' /root/.profile && echo 'Ignore the previous error about stdin not being a tty. Fixing it now...') || exit 0;" That prints a reassuring green message right after the scary red 'stdin is not a tty' upon the very first provision. (The only thing I don't like about it is that I used a redundant grep to determine if sed was going to do any work. You can use sed's 'q' command to determine if it did any work, but I'm already in over my Unix head, and couldn't get it to work.) |
I have the same problem, and for me it's an actual problem. Why is there no option to have a TTY during provisioning? The only answer I could imagine is "But provisioning should not be interactive". However, I always run provisioning on a terminal and watch the output. There exist commands which require a TTY, even when they do not actually need to interact with the user — in my case, it was "agda-mode setup" from Agda starting Emacs, mostly just to find it (I'm sure you didn't hear of Agda). Debian package installation also requires a TTY, though that's actually interactive; however, upon finding no TTY, in my setup it still tries to use ncurses and ends up corrupting the terminal settings, requiring to run I'm working this around by provisioning with vagrant ssh -c /vagrant/myscript.sh, but that seems to half-defeat the point of having provisioning. |
@Blaisorblade There is: |
Thanks! But shouldn't it be documented under both of Also, while this setting solves my problem, provisioning does not terminate if I actually use "agda-mode setup", which does use the terminal in strange ways. It's still better, but not perfect. (Also, the same script works fine inside ssh — and enabling keep_color does not help). |
In addition, with config.ssh.pty the default shared folder is mounted under I also tried adding :binary => true to the provisioning configuration, but it didn't help. |
I experienced the same as @Blaisorblade, seems like a bug to me. Breaks a lot things like provisioning that requires mounted folders in a known /tmp location. |
I didn't understand, how is this closed if I have still the same issue? Is the workaround a kind configuration? Is there documentation? |
ubuntu 14.10 as guest, The workaround of @johnraz works:
|
I'm getting the issue on: Vagrant 1.8.5
I re-wrote the /root/.profile editing snippet because it was broken for me:
The error only occurs once while provisioning now. |
@liquidice That's probably a different issue. See #7155 |
@Ajedi32 As I said, I run that code I provided above on initial provision, and the problem only happens once on initial provision now, instead of every time. |
This is happening for me as well. I have attached the log file: vagrant.log.tar.gz. Here are the annoying messages that appear when I run
Vagrantfile:# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# ansible control center
config.vm.define "acs" do |acs|
acs.vm.box = "boxcutter/ubuntu1604"
acs.vm.hostname = "acs"
acs.vm.network "private_network", ip: "192.168.33.10"
acs.vm.provision "shell", inline: "sed -i 's/us.archive.ubuntu/au.archive.ubuntu/g' /etc/apt/sources.list && apt-get update && apt-get install ansible -y"
end
end Host OS: Ubuntu 16.04 CC: @mitchellh |
mount -t devtmpfs none /home/chroot/dev |
I'm running into an issue with apt-get update if I use the fix-no-tty solution. Essentially, apt-get just stalls and does nothing. Edit: It might just be apt-get hanging... |
@berdon You sure apt-get isn't waiting for console input? Then it might do different things on a terminal or not (even failing on a non-terminal). That's surprising for |
I believe the issue was unrelated to Vagrant and more likely related to IPv6 issues and apt-get. I ran across a StackExchange post suggesting disabling IPv6 for updates and upgrades. This seems to have fixed the issue: Pre-Config shell script: echo "Disabling IPv6"
sudo cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf
sudo sysctl -p Post-Config shell script: # sudo apt-get -qq -y update
echo "Resetting IPv6"
mv /etc/sysctl.conf.bak /etc/sysctl.conf |
Little hack on Vagrant file to remove "is not a tty" messages according to: hashicorp/vagrant#1673
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hello
I run Vagrant version 1.2.2 on Mac OS 10.8.3.
When I set up a multi VM environment with lucid64 boxes, which I provision either with shell or puppet, I always get the following error when provisionning
Example :
Thanks
Geoffroy
The text was updated successfully, but these errors were encountered: