Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get vagrant destroy to work

Tags:

vagrant

I just deleted a large directory that I no longer needed. Unfortunately, it had a number of vagrant instances that I neglected to halt and destroy first within it and I'm having trouble getting them to go away now.

If I run "vagrant global-status", I receive four results, all have the name "default", three use hyperv and one uses virtualbox (not sure why I have a virtualbox instance at all), all but the virtualbox is running, and all in directories that no longer exist.

I just opened up the hyper-v manager and none of these instances actually exist.

If I attempt to use "vagrant destroy" against any of the ids in the global-status output, I get the following error:

There are errors in the configuration of this machine. Please fix the following errors and try again: 

vm: 
* A box must be specified

If I look in the "vagrant box list" command, it yields a single named box, but I don't appear to be able to do anything with it as I'll get the same error as above when I attempt to remove it.

What can I do to 1) get rid of the last of the directories that wouldn't delete since vagrant appears to be using the files and 2) clear out these entries that shouldn't be here anymore from the vagrant global-status command?

Thanks!

like image 887
Whit Waldo Avatar asked Sep 03 '14 11:09

Whit Waldo


People also ask

How do I force vagrant destroy?

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 check my vagrant status?

Command: vagrant status [name|id] This will tell you the state of the machines Vagrant is managing. It is quite easy, especially once you get comfortable with Vagrant, to forget whether your Vagrant machine is running, suspended, not created, etc. This command tells you the state of the underlying guest machine.

How do I update my vagrant box?

Command: vagrant box update This command updates the box for the current Vagrant environment if there are updates available. The command can also update a specific box (outside of an active Vagrant environment), by specifying the --box flag. Note that updating the box will not update an already-running Vagrant machine.

How do I use vagrant?

Command: vagrant up [name|id] This command creates and configures guest machines according to your Vagrantfile. This is the single most important command in Vagrant, since it is how any Vagrant machine is created. Anyone using Vagrant must use this command on a day-to-day basis.


1 Answers

To clean Vagrant's global status, use the --prune flag.

I'm not sure why you don't see the Hyper-V machines in your Hyper-V manager though.

like image 113
m1keil Avatar answered Sep 29 '22 15:09

m1keil