Why won't Vagrant ssh into my virtual box when I use `Vagrant Up` on Windows 7 command line?
Solution 1
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:
- This guy had some useful troubleshooting information.
- Vagrant Docs for Vagrantfiles
- Vagrant Docs for Vagrantfile SSH Timeout
- Vagrant Docs for Debugging
- Hours of Troubleshooting (Keep Smilin')
Solution 2
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).
Hopefully this helps someone out!
Related videos on Youtube
Nick
A fledgling programmer at a small university with a struggling program. void modGPA(int stackOverflow) { if (GPA < 4.0) GPA = stackOverflow system.out.println("Your GPA is: " + GPA); } Your GPA is: 4.0
Updated on June 04, 2022Comments
-
Nick almost 2 years
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"
-
Terry Wang about 11 yearsBased on the debug info: 1. either NAT port forwarding rule is NOT working or 2. Your host (Windows) is NOT able to connect localhost port 2222 (firewall?). Check.
-
-
Bianca about 11 yearsThank you for the set VAGRANT_LOG=INFO. This is gold!
-
gkd about 10 yearsSame kind of problem exists with me as well, When I run "vagrant up" command it shows default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Error: Connection timeout. Retrying...