Symlinks with Vagrant + VirtualBox

26 Dec

This was a very thorny issue for me early on, back when I was trying to update DocHub, which was powered by npm modules. The static HTML files it came packaged with were sufficient, but I wanted the LATEST versions. npm install tries to put files locally and symlink them, which Vagrant made a huge boo-boo about when my console erupted with error messages from npm. I eventually gave up in favor of zeal, which is godly amounts of awesome for an offline documentation browser.

A year later or so, I had to get symlinks to work again – this time while I was trying puppet-rspec. For some arcane reason, it needs to symlink a directory back to the original directory containing the code to be tested. Instead of referencing the files relatively in the code. Of course. This time though, I had better luck – I chanced upon a fix that actually worked!

https://github.com/mitchellh/vagrant/issues/713#issuecomment-17296765

Below are the steps I took personally (cribbled from the above link, of course)

1) Added these lines to my config :
config.vm.provider “virtualbox” do |v|
v.customize [“setextradata”, :id, “VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant”, “1”]
end
2) ran this command in an admin command prompt on windows, while in the C:\Windows\system32

 

fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
3) open a new command line, vagrant halt if necessary followed by vagrant up

 

This solution really needs more love than being hidden away behind a github issue comment. So here it is!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: