6

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!

Whit Waldo
  • 4,806
  • 4
  • 48
  • 70

3 Answers3

6

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.

m1keil
  • 4,515
  • 22
  • 26
  • 1
    This worked for me after removing the VM with the virtual box GUI. Not sure if that is a coincidence or not but wanted to mention it – Welcher Nov 17 '14 at 14:05
  • @Welcher first removing the VM via the VirtualBox UI and then running `vagrant global-status --prune` worked for me. Thanks! – Stetzon Nov 04 '16 at 15:02
0

I wound up uninstalling Vagrant and deleting the directories Vagrant was using. Then I re-installed and there were no more ghost Vagrant instances.

Whit Waldo
  • 4,806
  • 4
  • 48
  • 70
0

I managed to remove the vagrant VM entry from global-status using vagrant destroy <id> after I manually deleted the VM from "Oracle VM VirtualBox". VM was ubuntu 14.04, host was windows 10.

André C. Andersen
  • 8,955
  • 3
  • 53
  • 79