Vagrant fails to recover if virtual machine is deleted on disk #1848

Closed
thasmo opened this Issue Jun 21, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@thasmo

thasmo commented Jun 21, 2013

When deleting the VM files on the disk directly (e.g. in the Windows explorer) Vagrant prints this error:

Your VM has become "inaccessible." Unfortunately, this is a critical error with VirtualBox that Vagrant can not cleanly recover from. Please open VirtualBox and clear out your inaccessible virtual machines or find a way to fix them.

VirtualBox itself doesn't show the VMs either, so I can not delete the VM anywhere and Vagrant gives this error on every command given - even on "vagrant destroy".

The only way to get this fixed was to delete the ".vagrant" directory.

@lmayorga1980

This comment has been minimized.

Show comment
Hide comment
@lmayorga1980

lmayorga1980 Jun 21, 2013

I guess this is because .vagrant directory contains the ID of the VirtualBox VM.

I guess this is because .vagrant directory contains the ID of the VirtualBox VM.

@thasmo

This comment has been minimized.

Show comment
Hide comment
@thasmo

thasmo Jun 23, 2013

Probably, but Vagrant handles it just fine if the VM is deleted from within VirtualBox directly - I think! But if the VM directory is deleted from the command line or Windows explorer it seems to behave different. Btw. because issues arose with VirtualBox 4.2.14 lately - I'm on 4.2.12 still.

thasmo commented Jun 23, 2013

Probably, but Vagrant handles it just fine if the VM is deleted from within VirtualBox directly - I think! But if the VM directory is deleted from the command line or Windows explorer it seems to behave different. Btw. because issues arose with VirtualBox 4.2.14 lately - I'm on 4.2.12 still.

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Jul 20, 2013

Member

As the error message states: this is a corruption issue and Vagrant can't cleanly just clean up. Sure, Vagrant could PRETEND "oh the VM must not exist anymore." But there are actually many corruption cases where the VM may still actually exist. If Vagrant just ignored it, you could end up losing a lot of disk space over time.

Instead, the proper response is to actually track down the cause of the corruption by opening up Virtualbox, as it says, and fixing it.

Deleting the VM directory will corrupt your VM. VirtualBox wants to delete that itself and maintains state all over the place.

Member

mitchellh commented Jul 20, 2013

As the error message states: this is a corruption issue and Vagrant can't cleanly just clean up. Sure, Vagrant could PRETEND "oh the VM must not exist anymore." But there are actually many corruption cases where the VM may still actually exist. If Vagrant just ignored it, you could end up losing a lot of disk space over time.

Instead, the proper response is to actually track down the cause of the corruption by opening up Virtualbox, as it says, and fixing it.

Deleting the VM directory will corrupt your VM. VirtualBox wants to delete that itself and maintains state all over the place.

@mitchellh mitchellh closed this Jul 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment