Wagrant resets the .vagrant directory every time I use a stroller

My environment:

  • OS: win8.1
  • Tramp: 1.6.3
  • Virtual Box: 4.3.12r93733
  • Vagrant OS: laravel / Homestead flavor

Situation: I noticed that after a “suspenseful suspension” and a reboot of the computer (work the next day), when I start “roaming”, all the files in the .vagrant directory are deleted during the “up” process and a new instance of VBox is created. This means that I am losing all my previous settings, such as DB, npm installs and installs. Yes, the lost configuration is mainly accessible through saved scripts, but it is a real pain to do it every time!

My current Fix: Currently, every time this happens, I need to run the "VBoxManage list vms" to get the correct identifier. Then I “wander off” a new unwanted instance, delete it from the Oracle VM VirtualBox Manage, insert the old identifier into the "id" file inside the ".vagrant", and start the "tramp" again. This time it works!

I checked the id file every time before running "wandering up" and the correct identifier is there. I also tried a “roaming resume”, but that didn't make any difference.

The Vagrantfile and config file is almost standard, which comes with the Homestead package. The only change I made to Vagrantfile to allow symbolic links (this is around a completely separate issue with NODE, npm and window restrictions for 260 char directory paths). Here is an extra bit that I added for this problem with dir length.

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 does Vagrant create a new instance of the virtual machine every time?

UPDATE:

I found that the problem is related to running the CLI (I usually use cygwin) and the Oracles VBox manager with administrator privileges. I also found that some of my virtual machines are stored in C: \ cygwin64 \ home ... I can use them when starting the cygwin terminal as an administrator. And I see them in Oracle VirtualBox Manager if I run this as an administrator. Other virtual machines are stored in C: \ Users .... and I can see them when running oracle VBox manager as a regular user (who has administrator privileges).

I'm still a little confused how this all happened.

+7
windows vagrant virtualbox laravel
source share
2 answers

I found the answer to my problem, hope this helps others.

The problem was that some VM was sitting in my C: / cygwin64 / home directory, and they belonged to the administrator, they could also be seen only in Orales VirtualBox Manager, if I opened it "as administrator". Other virtual machines were in C: / Users / [username] / virtual virtual machines, they belonged to my user account and could only be visible if I usually opened applications.

I usually opened my Cygwin and therefore could not properly return the virtual machine (still a little confused about why I had to work with the ID every time).

My solution: using this thomthom answer

In the Orales VirtualBox Mangager, I changed the default machine folder (File-> Preferences-> General) to C: / Users / [username] / VirtualBox virtual machines. Then I cloned each of the virtual machines so that they ended up in a new directory. Then I completely deleted the old virtual machine (right click → Delete) that were sitting in the cygwin folder. Then I closed Cygwin and VirtualBox Manager and opened myself again as regular users (VirtualBox Manager did not show anything!)

Finally, I went to a new directory and double-clicked each virtual machine, after which I was added back to the VirtualBox manager, then on the command line I ran the VBoxManage vms list to get the new clone id, copied that id to id in my project (this will be something like PROJECT \ .vagrant \ machines \ default \ virtualbox \ id

Now I can run the rogue "roaming" command with cygwin as a regular user, and everything works fine.

Lesson: Be extremely aware of which user you are starting the initial VM creation, and also very knowledgeable about where the virtual disk manager stores your virtual machines.

+2
source share

I have a very similar problem on Win 7 Professional with the same versions of programs without Vagrant OS: laravel / Homestead flavor (I don't know what it is).

But I have the correct identifier in the .vagrant/machines/xxx/virtualbox/id files. When I use any vagrant command, all files from the .vagrant/machines/xxx/virtualbox/ folder are deleted. But for me, just turn on the virtual machines in VirtualBox and use vagrant suspend and vagrant up .

Here is my Vagran file:

 Vagrant.require_version '>= 1.6.0' SSH_PORT = 22 www, services, upload = {}, {}, {} # WWW SERVER www[:memory] = 768 # MB www[:cpu] = 1 # num. cpu cores www[:cpuTimeCap] = 100 # 1-100 % www[:alias] = 'www' www[:ip] = '10.11.5.35' www[:sshPort] = 58501 www[:vboxName] = 'WWW-name' www[:syncedFolder] = './master-install' www[:box] = 'freebsd9.2' www[:boxUrl] = 'file:///E:/Virtuals/freebsd-9.2-amd64-wunki.box' www[:provisions] = [] www[:provisions] << 'common/install.sh' www[:provisions] << 'master-install/install.sh' www[:provisions] << 'master-install/name-install.sh' services[:memory]...etc. machines = [www, services, upload] Vagrant.configure('2') do |config| machines.each do |machine| config.vm.define "#{machine[:alias]}" do |node| node.vm.box = machine[:box] node.vm.box_url = machine[:boxUrl] node.vm.hostname = machine[:alias] node.vm.network :private_network, :ip => machine[:ip] node.vm.network :forwarded_port, :guest => SSH_PORT, :host => machine[:sshPort], :id => 'ssh', :auto_correct => true node.vm.synced_folder machine[:syncedFolder], "/vagrant", type: "rsync", rsync__exclude: ".git/" node.vm.provider :virtualbox do |vbconf| vbconf.customize ["modifyvm", :id, "--name", machine[:vboxName]] vbconf.customize ["modifyvm", :id, "--memory", machine[:memory]] vbconf.customize ["modifyvm", :id, "--cpus", machine[:cpu]] vbconf.customize ["modifyvm", :id, "--cpuexecutioncap", machine[:cpuTimeCap]] vbconf.customize ["modifyvm", :id, "--natdnsproxy1", "off"] vbconf.customize ["modifyvm", :id, "--natdnshostresolver1", "off"] vbconf.customize ["modifyvm", :id, "--ioapic", "on"] vbconf.customize ["modifyvm", :id, "--chipset", "ich9"] vbconf.customize ["modifyvm", :id, "--usb", "off"] vbconf.customize ["modifyvm", :id, "--audio", "none"] vbconf.customize ["modifyvm", :id, "--nictype1", "virtio"] vbconf.customize ["modifyvm", :id, "--nictype2", "virtio"] vbconf.customize ["modifyvm", :id, "--pae", "on"] vbconf.customize ["modifyvm", :id, "--acpi", "on"] vbconf.customize ["modifyvm", :id, "--firmware", "bios"] end machine[:provisions].each do |provision| node.vm.provision "shell", path: provision end end end end 

ps: this is not the answer, but rather add more information to the problem :)

0
source share

All Articles