lucky
lucky

Reputation: 513

vagrant failed to connect VM

I am running vagrant up command to connect to a VM and while running this command I get below mentioned error.

I tried several steps as to run it with gui mode ON, but GUI mode itself does not open anything.

while running this command an separate command promt opens and gets closed on its own. And after that I get below error. Can you anyone please give me some idea how can I fix this issues..

details: OS : windows 7 steps followed are: 1. vagrant box add box1 c:/vmBoxFolder - runs fine 2. vagrant init box1 - runs fine 3. vagrant up - Fails

host file entries: 127.0.0.1 localhost ::1 localhost

ERROR :

C:\blog>vagrant up
[default] VM already created. Booting if its not already running...
[default] Running any VM customizations...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] Cleaning previously set shared folders...
[default] Creating shared folders metadata...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] Failed to connect to VM!
Failed to connect to VM via SSH. Please verify the VM successfully booted
by looking at the VirtualBox GUI.

thanks, lucky.

Upvotes: 4

Views: 6494

Answers (1)

Nick
Nick

Reputation: 477

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')

Upvotes: 3

Related Questions