Jean Valjean
Jean Valjean

Reputation: 23

Unable to 'vagrant ssh' after successful provisioning

Using vagrant 1.2.7 with virtualbox 4.2.16 on OS X 10.8.4

sudo vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- /vagrant

vagrant ssh

VM must be created before running this command. Run `vagrant up` first.

But, as shown above it booted and ready for use.

I enabled 'gui' mode, and the vb is running but unable to ssh from host.

I noticed that the vb adapter is 'NAT'ing'. Should I switch to 'bridge'?. Also, when running :

#VBoxManage list runningvms

I get nothing, like there were no vbs running, but it is.

Any help greatly appreciated!

Thanks

Upvotes: 1

Views: 5964

Answers (2)

Wesley Smith
Wesley Smith

Reputation: 19571

Mine was a GIT issue. I did:

$ vagrant up

// some time later 
$ git add .
$ git commit -m "in progress"
$ git checkout develop  

// some time later 

$ vagrant ssh 

and got

VM must be running to open SSH connection. Run vagrant up to start the virtual machine.

After a few minutes of vigorous head scratching, I realized that the commit and checkout had effectively removed the vagrant cache file from the directory.

$ git checkout original-branch fixed my issue. It may be obvious to others, but it took me a minute to realize in the heat of the moment.

Upvotes: 0

Tom McQuarrie
Tom McQuarrie

Reputation: 1147

Came across this question while trying to find a solution to my own problem. It appears that vagrant is tied to the user it is launched under. In your code above, you use sudo vagrant up which runs vagrant as root. You're then running vagrant ssh as another lower level user, so vagrant can't see a running vm. Either use sudo for both or neither.

Upvotes: 4

Related Questions