8

I have a vagrant box with Linux inside under Windows 10 (VirtualBox 5.1.4, Vagrant 1.8.5). I'm working with the Git Bash as normal user. Inside the vagrant box I cannot create a symlink:

c:/path/to/my/vagrant-project/ vagrant up + vagrant ssh
/home/vagrant/my-shared-folder/ $ ln -s /any/path/to/linux/box/folder my-symlink-name
/home/vagrant/my-shared-folder/ $ ln: creating symbolic link `my-symlink-name': Protocol error

Under Windows 7 it was working with: How do I create a link in Windows 7 home premium as a regular user?

So, has anything changed under Windows 10?

4
  • What happens when you issue that ln -s command? Do you get any error messages?
    – das-g
    Aug 19, 2016 at 12:20
  • I just added the error message to my question. I found out, that I have to start the Git Bash as administrator to get this running. Is there a way to extend the normal user with "create symlink permissions"? Aug 22, 2016 at 10:35
  • Nothing has changed in the symbolic links part of Windows 10. Sep 10, 2016 at 12:44
  • For me, running as administrator was not enough, and I still got "Protocol error" when trying to create symlinks. Here was what worked: stackoverflow.com/a/60741351/470749
    – Ryan
    Mar 18, 2020 at 14:18

3 Answers 3

2

I was struggeling a long time with the same issue. Make sure that:

  • The VirtualBox Option "SharedFoldersEnableSymlinksCreate" is active for each Folder *1)
  • You MUST run the GitBash as "Admin" user because it seems that Usermanagement in Windows just allows the symlink creation for "Admin" users *2)

    1. You can do it manually from Windows command line (setextradata via VBoxManager) or via the Vagrantfile like

      virtualbox.customize ['setextradata', :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant", '1']  
      
    2. Right click on GitBash icon and run as Administrator

      German version of "Run as Administrator"

    Afterwards you should be able to log into the vagrant box and create symlinks inside shared folders which showup in Windows explorer as .symlink files.

2
  • To my knowledge /vagrant in "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant" specifies the shared folder in which symlinks are allowed. v-root specifies the root of the vm. Furthermore symlinks are activated by default for v-root.
    – velop
    Aug 31, 2017 at 12:25
  • 2
    I use both these steps, and still have symlink failures when doing npm install for certain packages.
    – UpTheCreek
    May 23, 2019 at 8:52
0

There's already thread describing How to create a Symbolic Link on Windows 10.

I'm just quickly describing it once again. First Create a junction:

junction "C:\Documents and Settings\UserName\My Documents\My Dropbox\My Games" "C:\Documents and Settings\UserName\My Documents\My Games"

Create a directory symbolic link using mlink:

mklink /D "C:\Documents and Settings\UserName\My Documents\My Dropbox\My Games" "C:\Documents and Settings\UserName\My Documents\My Games"

Security settings to create a symbolic link can be granted here:

Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment\

You can also download the junction and create by using the commands.

1
  • this doesn't work for symlinks as described above Aug 22, 2016 at 9:08
0

If the symbolic links are created in the host (Windows) operating system using mklink with option /d and relative paths, then they are synced into the guest machine, also while running vagrant without admin privileges or any extra rights.

mklink /D somelink ..\..\some\relative\path

Vagrant: 1.9.1, VirtualBox: 5.0.32

PS: mklink still requires admin privileges

2
  • "This is not a solution to the original question" - If it is not an answer to the question that was asked, then why are you submitting it as an answer, to the question that was asked? Please take into considering that commentary should never be submitted as an answer.
    – Ramhound
    Jan 24, 2017 at 15:01
  • I wouldn't have known it was an answer to this question, since you literally indicated, it wasn't an answer to the question.
    – Ramhound
    Jan 25, 2017 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .