Vagrant: on Windows host/Linux guest symbolic link is generated with backslashes

Created on 23 Jul 2015  ·  27Comments  ·  Source: hashicorp/vagrant

I use simple Vagrantfile

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
end

Running

vagrant up
vagrant ssh
cd /vagrant
ln -s /vag/log
ls -l

I see

lrwxrwxrwx 1 vagrant vagrant   0 Jul 22 22:56 log -> \var\log\

Backslashes is a problem here as I understand. This symbolic link is not usable.

VirtualBox 5.0.0
Vagrant 1.7.4

bug hoswindows

Most helpful comment

To fix this issue:

  • Open Local Security Policy
  • Navigate to: Local Policies -> User Rights Assignment
  • Open "Create Symbolic Links"
  • Add your username (or a group you are assigned to)
  • Restart PC

No need to add freeware rinkydink software to your build process.

All 27 comments

Please fix this asap.

Have you a workaround for this? We need this to develop our software

Thanks a lot

VirtualBox 4.8.x
Vagrant 1.7.2

Same here. This is a very critical issue!

If you downgrade to VirtualBox 4.3.30 symlinks works again. I noticed the weird backslashes in version 5.0.0

Windows 10
VitrtualBox 4.3.30
Vagrant 1.7.4

Thanks for pointing this out. Can someone confirm this? For me only version 5 of VirtualBox works on on Windows 10, but with weird backslashes..

We will test this

Host-only nic and symlinks are broken in Virtualbox 5.0.0.

VirtualBox 4.3.30 installs fine on Windows 10, have not had any issues yet.

Hi guys,

Same error here.

How to reproduce:

Install software
-windows 7 Entreprise SP1 64bits
-VirtualBox : 5.0.0 r101573
-Vagrant 1.7.4

Start software
-using windows cmd :

c:\DEV_CODE>mkdir test
c:\DEV_CODE>cd test
c:\DEV_CODE\test>vagrant init hashicorp/precise64
c:\DEV_CODE\test>vagrant up

-logged in the VM :

vagrant@precise64:~$ ln -s /tmp/ toto
vagrant@precise64:~$ ll toto
lrwxrwxrwx 1 vagrant vagrant 5 Aug  5 18:40 toto -> /tmp//

vagrant@precise64:/vagrant$ ln -s /tmp/ toto
vagrant@precise64:/vagrant$ ll toto
lrwxrwxrwx 1 vagrant vagrant 0 Aug  5 18:40 toto -> \tmp\

Issue
The symlink creation no longer works inside shared folder (vagrant is shared by default)

I also find the Filesystem type to be strange in df output

vagrant@precise64:/vagrant$ df
Filesystem                 1K-blocks     Used Available Use% Mounted on
/dev/mapper/precise64-root  82711212  2256852  76312076   3% /
udev                          178072        4    178068   1% /dev
tmpfs                          74852      280     74572   1% /run
none                            5120        0      5120   0% /run/lock
none                          187128        0    187128   0% /run/shm
/dev/sda1                     233191    24966    195784  12% /boot
vagrant                    104857596 78982132  25875464  76% /vagrant

Maybe it is link...

I will try to downgrade to VB < 5 and update the ticket when I have some time.

Thx.

I confirmed it is OK after downgrade to VB 4.3.30

We have a developer with older version 4.3.26. It will work fine too.

Don't know if it's related to this problem, but I think it fits.

I'm using Vagrant 1.7.4 with ubuntu/trusty64 as guest on a Windows 10 host with Virtualbox 5.0.2r102096.

It got the /var/www directory on Ubuntu synced with my host.

I'm doing the following:

cd /var/www/application/htdocs
ln -s ../typo3_src-7.4.0 typo3_src

(the typo3_src-7.4.0 directory, which is my target, is in /var/www/application).

Now I check the content of the directory:

ls -l
lrwxrwxrwx 1 vagrant vagrant 0 Aug 16 13:54 typo3_src -> ..\typo3_src-7.4.0

(which is colored in red).

When I check the symlink directly:

readlink -f typo3_src
/var/www/application/htdocs/..\typo3_src-7.4.0

I am also on Win 10 and downgraded to VB 4.3.30 now.

Creating symlinks does not work for me at all ("protocol error") unless I run the command line "as Administrator" and then vagrant up, basically as described here http://www.ahtik.com/blog/fixing-your-virtualbox-shared-folder-symlink-error/

Is that normal behavior or is there a way to do this without admin rights? Should I create a separate issue?

Virtualbox just released a fix for this issue and it is working now, you need to download and install this test build https://www.virtualbox.org/download/testcase/VirtualBox-5.0.3-102224-Win.exe
Here is the link to the issue: https://www.virtualbox.org/ticket/14335

Running now VB build 102322.

Works yes and no (or I'm making a mistake).

Creating a symlink with relative path

ln -s ../typo3_src-7.4.0 typo3_src

does not work. It produces a protocol error.

Creating a symlink with absolute path

ln -s /var/www/application/typo3_src-7.4.0 typo3_src

does work.

I see the same thing. It was an upgrade from 5.0.2 (pretty sure but not positive) to 5.0.4 where things broke. This is a pretty big issue for me; I have a huge chunk of software that doesn't build because of this. It's way too much software to try and go in and tweak this.

seeing @simonknittel's problem too - with 5.0.4 on linux host and guest relative paths are broken, absolute paths work fine, nothing to do with backslashes as far as i can see though, gives protocol error not permission denied.

its not a vagrant problem though is it, its a virtualbox one.

It seems to be fixed with VBox 5.0.6

I've had problems building Tango on
  VBox 5.0. The issue is also related to symbolic links, on a Linux
  host. Sometimes they work, sometimes they don't. I think they work
  only if the link is in the same directory, but haven't done
  extensive testing. I had to back off to version 4.3.30, which
  seems to work. This is a problem that Oracle seems to know about
  but which is proving a challenge to fix fully.

  On 10/05/2015 04:28 AM, Eugene Mirotin wrote:


  It seems to be fixed with VBox 5.0.6
  —
    Reply to this email directly or view
      it on GitHub.










-- 

David VL

This is a bug with VirtualBox and not Vagrant. Please read other comments to note working VirtualBox versions!

It seems that it still fails on VirtualBox 5.0.10 as well. I guess I will need to rebuild the vagrant box with Packer

for me symbolic link work flawlessly inside synced folders with the following windows host setup:

Host OS: Windows 10 1511
VirtualBox: 5.0.10
Vagrant: 1.7.4

Guest OS: ubuntu/vivid64 (make sure you use a guest linux with kernel version > 3.18!)
VBGuestAdditions: 5.0.10

They key was to use smb for mounting the synced folder, enforcing SMB 3.02 and enabling mfsymlinks:

config.vm.synced_folder "/projectfolder/www", "/var/www", type: "smb", mount_options: ["vers=3.02","mfsymlinks"]

Additionally we should get better speeds with enforcing SMB 3.02 over SMB1 (which is used as default), but I have not made detailed measurements yet. Node.js now works flawlessly and fast inside my boxes.

I found a solution to allow creating symbolic links on a shared folder in linux client when host is windows.
It fixed my yum install issues.
https://blog.puphpet.com/blog/2015/06/25/windows-symlinks/

To fix this issue:

  • Open Local Security Policy
  • Navigate to: Local Policies -> User Rights Assignment
  • Open "Create Symbolic Links"
  • Add your username (or a group you are assigned to)
  • Restart PC

No need to add freeware rinkydink software to your build process.

Thank you @g105b - this resolved the issue completely for me.

If you don't want to change Local Security Policy, you can follow these step to create the symbolic links.

  1. As your current user, run vagrant halt
  2. Open a console with administrator privileges (Right-Click->Run as Administrator) and use this console to run the following commands
  3. vagrant up
  4. vagrant ssh
  5. Now you can create your symbolic links, ;)

Thanks @Sadegh-Ameri, this works for me.

Run VirtualBox as an administrator every time?

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RobertSwirsky picture RobertSwirsky  ·  3Comments

dorinlazar picture dorinlazar  ·  3Comments

tomhking picture tomhking  ·  3Comments

luispabon picture luispabon  ·  3Comments

DreadPirateShawn picture DreadPirateShawn  ·  3Comments