My Environment:
- OS: win8.1
- Vagrant: 1.6.3
- Virtual Box: 4.3.12r93733
- Vagrant OS: laravel/Homestead flavor
The situation: I have noticed that after a "vagrant suspend" and computer restart(The next day's work) when I run "vagrant up" all the files in the .vagrant directory get deleted during the "up" process and a new VBox instance is created. This means that I lose all my previous config such as DB, npm installs and mounts. Yes the lost config is mostly all available through saved scripts, but this is a real pain to do every time!
My current Fix: Currently each time this occurs I need to run "VBoxManage list vms" to retrieve the correct ID. I then "vagrant suspend" the new unwanted instance, delete it from the Oracle VM VirtualBox Manage, paste the old ID into the "id" file within ".vagrant" and run "vagrant up" again. This time it works!
I have checked the id file each time before running "vagrant up" and the correct id is in there. I have also tried "vagrant resume" but that has made no difference.
The Vagrantfile and config file are almost standard what comes with the Homestead package. The only change I have made is within the Vagrantfile to allow symlinks (this is a work around for an entirely separate issue with NODE, npm and windows limits to 260 char directory paths). Here is the extra bit I added for this dir length issue.
config.vm.provider "virtualbox" do |vb|
# SEE https://github.com/fideloper/Vaprobash/issues/183
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
end
What am I doing wrong? Why is Vagrant creating a new VM instance every time?
UPDATE:
I have discovered that the issue is something to do with running the CLI (I generally use cygwin) and Oracles VBox manager with administrator privileges. I have also discovered that some of my VM's are saved under C:\cygwin64\home... I can use those when running the cygwin terminal as admin. And I can see them in Oracle VirtualBox Manager if I run that as admin also. Other VM's are stored in C:\Users.... and I can see those when running oracle VBox manager as my normal user (who has admin privileges).
I am still a little confused how this has all happened.