Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I destroy a VM when I deleted the .vagrant file?

I deleted the directory that contained the .vagrant file. When I up a new VM it's complaining about ports being in use. So how do I destroy a VM without having it's .vagrant file?

like image 928
Pickels Avatar asked Mar 14 '13 12:03

Pickels


People also ask

How do I force destroy vagrant?

Command: vagrant destroy [name|id] This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process. After running this command, your computer should be left at a clean state, as if you never created the guest machine in the first place.

How do I delete vagrant files?

You can remove the Vagrantfile by typing rm Vagrantfile at the command line, but it is not clear what you are trying to achieve. The vagrant init command will initialise a new virtual box by creating a default Vagrantfile. Since you already have one, it looks like you may already have run the vagrant init command.


1 Answers

The following VirtualBox commands might help. If poweroff doesn't work, try unregistervm.

$ VBoxManage list runningvms $ VBoxManage controlvm <uuid> poweroff $ VBoxManage unregistervm <uuid> 

Source: https://support.cloud.engineyard.com/entries/21449637-I-deleted-Vagrantfile-vagrant-and-or-the-app-directory-before-halting-the-VM-Now-ey-local-up-errors-

Shell script to stop all running vms:

VBoxManage list runningvms | awk '{print $2;}' | xargs -I vmid VBoxManage controlvm vmid poweroff 
like image 168
Pickels Avatar answered Sep 28 '22 11:09

Pickels