I want to use Vagrant to provide a common development environment to my team. The hosts are completely different:
Inside of the VM we want to run Linux.
So far, everything is fine.
Now our idea was that each developer shall be able use the IDE of their choice, and hence we have introduced a synced folder that shares the source code between the host and the VM. This basically, works as well … except for symbolic links.
Inside of our source code we actually do have a few symbolic links, which is not a problem within the Linux inside the VM, but on Windows as host this causes problems. The only thing that we can not do is get rid of the symbolic links, so we need another way to deal with this.
So far, we have tried a number of options:
symlink has no referent
(one error per symbolic link).I can not imagine that we are the only or the first persons on this planet to experience problems with multi-platform hosts and symbolic links within the shared folder.
How can you solve this issue, so that we can keep symbolic links, but still use different host operating systems?
Vagrant automatically syncs files to and from the guest machine. This way you can edit files locally and run them in your virtual development environment. By default, Vagrant shares your project directory (the one containing the Vagrantfile) to the /vagrant directory in your guest machine.
By default, Vagrant stores its boxes after downloading in the directory defined by VAGRANT_HOME environment variable. As a result, On Mac OS X and Linux: ~/. vagrant.
Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the "works on my machine" excuse a relic of the past.
The accepted answer is no good. The question describes an issue with synced folders, not shared folders. The proposed solution would have no effect on an rsynced (not shared) folder. And even if the OP was using a shared folder, the accepted answer's suggestion is something that had already been integrated into vagrant as of 1.1, released 15 months before the OP posted the question (not to mention VirtualBox's shared folders are abysmally slow).
I encountered this same issue: on OS X, I got the symlink has no referent
rsync error. I was personally able to solve it by adding particular rsync args to my vagrantfile
:
config.vm.synced_folder ".", "/var/www", type: "rsync", rsync__args: ["--verbose", "--archive", "--delete", "-z"]
I also opened this issue on vagrant's github to point out something that appears to be wrong with their default value for rsync__args
(specifically, that one of the default args, --copy-links
, seems to be breaking another, --archive
, at least as far as copying broken symlinks is concerned).
Virtualbox does not allow symlinks on shared folders for security reasons. To enable symlinks the following line needs to be added to the vm provider config block in the Vagrantfile:
config.vm.provider "virtualbox" do |v| v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] end
Additionally, on windows vagrant up needs to be executed in a shell with admin rights. No workarounds necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With