Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to destroy orphaned vagrant boxes #6132

Closed
hesco opened this issue Aug 12, 2015 · 3 comments
Closed

Unable to destroy orphaned vagrant boxes #6132

hesco opened this issue Aug 12, 2015 · 3 comments

Comments

@hesco
Copy link

hesco commented Aug 12, 2015

Running this:

vagrant global-status | grep 'virtualbox running' | awk '{ print $1 }' | xargs vagrant destroy

fails to clean up orphaned boxes on this laptop.
Four months into this job, working with this client's laptop,
I seem to have accumulated a number of orphaned vagrant boxes
made visible by running global-status.

But repeated attempts seem unable to clean out the cruft.

How do I regain control of the machine and clean up after the
inadvertent power losses, etc.

I am in the habit these days of suspending, but usually destroying the running vagrant boxes
in each live shell when I put the host machine to sleep for the night. Even so global-status lists seven vagrant boxes with status 'running'. My theories of how the cruft accumulated relate to shells which died or were exited inadvertently. Or perhaps when I put the machine to sleep across a lunch break or a meeting. But I have not tested these theories.

Would it be safe to rm -rf ~/vagrant.d/data and trust that vagrant will rebuild what I need?
It appears that the data is derived from: ~/.vagrant.d/data/machine-index/index

-- Hugh Esco

@sethvargo
Copy link
Contributor

HI @hesco

I am sorry you are having issues. As indicated in the global status docs, the status is a cache. You probably need to run vagrant global-status --prune. Does that help?

@tersmitten
Copy link

Nice tip. I have the same problem.

@sethvargo
Copy link
Contributor

Hi there,

I am going to close this issue due to lack of response. As I said above, the global-status is a cache; it does not mean the machine still exists, just that it once existed. You can use the --prune command to clear the cache.

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants