VVV: how to fix error "default: stdin: is not a tty" when using vagrant up

This is what i get when i run “vagrant up”. i already do everything, line “sudo service mysql restart || true”, vagrant hault, vagrant provision, sudo apt-get update, etc. but it doesn’t work. please help me, i just want to update my mysql from 5.5 to 5.6 because i’m using laravel framework and the system i’m working on today is required to use mysql version 5.6.

Bringing machine ‘default’ up with ‘virtualbox’ provider… ==> default: Importing base box ‘laravel/homestead’… ==> default: Matching MAC address for NAT networking… ==> default: Checking if box ‘laravel/homestead’ is up to date… ==> default: A newer version of the box ‘laravel/homestead’ is available! You currently ==> default: have version ‘0.2.0’. The latest is version ‘0.2.1’. Run ==> default: vagrant box update to update. ==> default: Setting the name of the VM: Homestead_default_1418261939885_87172 ==> default: Clearing any previously set network interfaces… ==> default: Preparing network interfaces based on configuration… default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports… default: 80 => 8000 (adapter 1) default: 3306 => 33060 (adapter 1) default: 5432 => 54320 (adapter 1) default: 22 => 2222 (adapter 1) ==> default: Running ‘pre-boot’ VM customizations… ==> default: Booting VM… ==> default: Waiting for machine to boot. This may take a few minutes… default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying… default: Warning: Remote connection disconnect. Retrying… ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM… ==> default: Setting hostname… ==> default: Configuring and enabling network interfaces… ==> default: Mounting shared folders… default: /vagrant => /home/sedp/Homestead default: /home/vagrant/Projects => /home/sedp/Projects ==> default: Running provisioner: shell… default: Running: inline script ==> default: stdin: is not a tty ==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCiivZdJRmsEDj0PtfecSxl3g/HOAsmQXh7K4x0LQB5NKONbpO0leFRFJ2lV+iGMasqA45tfF9jGSIxmGsMfmg6VOVkUZ2EWk6tURFfM5FW3DgeL9CLcG4OhTHLyA9AcTHH0BvVml2OWYeXyfM5J8rURbaURZF1qKtjuR2r/JfF1HK0fhgjgnPMfBgkEt77XXMYSfDYxOSY9IhXEr8uNzXRjBWVmB1PNERoOCmodfANjClL8ptbguT+jYgUIFxDbpvm87plT4LzCCo+otoLSgCF+k51mwf0/Y3/IvhuskKdfSEYomRdBVCy19sY5c75oh5f471OFMfAehtFoOYdiRw7 bantonricker07@gmail.com ==> default: Running provisioner: shell… default: Running: inline script ==> default: Running provisioner: shell… default: Running: inline script ==> default: stdin: is not a tty ==> default: Running provisioner: shell… default: Running: inline script ==> default: stdin: is not a tty ==> default: * Restarting nginx nginx ==> default: …done. ==> default: php5-fpm stop/waiting ==> default: php5-fpm start/running, process 1966 ==> default: Running provisioner: shell… default: Running: inline script ==> default: stdin: is not a tty ==> default: * Restarting nginx nginx ==> default: …done. ==> default: php5-fpm stop/waiting ==> default: php5-fpm start/running, process 2021 ==> default: Running provisioner: shell… default: Running: inline script ==> default: stdin: is not a tty ==> default: * Restarting nginx nginx ==> default: …done. ==> default: php5-fpm stop/waiting ==> default: php5-fpm start/running, process 2076 ==> default: Running provisioner: shell… default: Running: inline script ==> default: stdin: is not a tty ==> default: php5-fpm stop/waiting ==> default: php5-fpm start/running, process 2109

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 27 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Insert this line in Vagrantfile, was resolved for me.

config.ssh.shell = “bash -c ‘BASH_ENV=/etc/profile exec bash’”

Still the same problem for me too, this fixes the issue:

    config.vm.provision "fix-no-tty", type: "shell" do |s|
      s.privileged = false
      s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
    end

config.ssh.shell = “bash -c ‘BASH_ENV=/etc/profile exec bash’”

did it. Thanks

There is a simple fix for the issue (assuming you don’t really need a TTY); essentially you need to remove the mesg n command from /root/.proflle. You can copy and paste exactly what you need from an explanation I published on my site.

In a nutshell, inserting the following line into a Vagrantfile breaks the vagrant ssh command (when used in combination with --command option for instance, which I’ve experienced personally)

config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"

See https://github.com/mitchellh/vagrant/issues/1673#issuecomment-158742618

There is also the possibility to set config.ssh.pty to true in the Vagrantfile but there seems to be other side-effects:

config.ssh.pty = true

See https://github.com/mitchellh/vagrant/issues/1673#issuecomment-34521728 and http://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html

On the contrary, the next provisioning script provided by @twisty7867 seems to fix the issue without visible regression as far as I can tell from a very restricted usage.

config.vm.provision "fix-no-tty", type: "shell" do |s|
    s.privileged = false
    s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end

See http://foo-o-rama.com/vagrant--stdin-is-not-a-tty--fix.html

@thierrymarianne thanks for your “fix-no-tty”-snipped. Works very well. Even on OSX.

@nkasvosve 's solution worked for me, just added that line in the Vagrantfile, inside the loop "Vagrant.configure(2) do |config|. Thank you!