Virtualbox VM (spawned by Vagrant) running, but inaccessible. What now

vagrantvirtual-machinesvirtualbox

I have a Virtualbox VM running Ubuntu that was started by Vagrant, on an OSX host.

At some point, my ssh session to the guest stopped responding. I tried vagrant halt from a terminal window on the host (OS X). The shutdown process seemed to also hang and shutting down the Oracle VM VirtualBox Manager doesn't shut down the VMs themselves.

When running desktop guest OSes, closing the GUI window presents several options for shutting down the guest, but I don't know how to do the equivalent when the guest is running headless.

Is there a way in either Vagrant or VirtualBox to force the running VM to shutdown?

Best Answer

Try using the VBoxManage command:

VBoxManage list runningvms

Which gives you the name of the VM you want to shut down. For example:

"rails_1366055054" {8144df4b-941f-40d6-ba5f-6e83d398ffd3}

To shut down this VM, you run

VBoxManage controlvm "rails_1366055054" poweroff

Note that this advice only applies when using the VirtualBox provider.