Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Vagrant fails to recover if virtual machine is deleted on disk #1848
When deleting the VM files on the disk directly (e.g. in the Windows explorer) Vagrant prints this error:
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.
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.
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.