Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't Vagrant ssh into my virtual box when I use `Vagrant Up` on Windows 7 command line?

Whenever I try to Vagrant Up it will load the box and do most everything right, but because I'm trying to use Puppet to provision this CentOS 6.3 minimal I need SSH to work during Vagrant Up (if I want it as autonomous as possible).

I get the following information from Vagrant's INFO log:

DEBUG virtualbox_4_2:   - [1, "ssh", 2222, 22]
 INFO ssh: Connecting to SSH: 127.0.0.1:2222
 INFO ssh: SSH not up: #<Timeout::Error: execution expired>
 INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "c2e7375d-159f-4014-9bda-ff9914423f4c", "--machinereadable"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: name="Vagrant-Apache-Nick_1360372174"
like image 572
Nick Avatar asked Feb 09 '13 01:02

Nick


2 Answers

During Vagrant Up your Windows system tries to connect to SSH. If you type on your command line:

set VAGRANT_LOG=INFO

You may see it fail and try a couple of times. It looks like this:

INFO ssh: Connecting to SSH: 127.0.0.1:2222

This is happening because the timeout is set to 10. This can be modified by placing the following in your Vagrantfile:

config.ssh.timeout = 300

You can use any number you like but I recommend something above 100.

Sources:

  1. This guy had some useful troubleshooting information.
  2. Vagrant Docs for Vagrantfiles
  3. Vagrant Docs for Vagrantfile SSH Timeout
  4. Vagrant Docs for Debugging
  5. Hours of Troubleshooting (Keep Smilin')
like image 135
Nick Avatar answered Oct 11 '22 15:10

Nick


I know I'm WAY late to this post, but I did have nearly the exact same problem for a full day before I simply removed Hyper-V from Windows and it magically solved my issue.

I guess when I was testing with Docker for Windows (not to be confused with docker-machine) it goofed my Hyper-V somehow. Not 100% sure why this tweaked fixed this issue, but it worked like a charm after Docker for Windows seemed to fubar my VirtualBox (Docker for Windows and Local by FlyWheel / VirtualBox conflict with each other).

enter image description here

Hopefully this helps someone out!

like image 26
K8sN0v1c3 Avatar answered Oct 11 '22 17:10

K8sN0v1c3