creating symbolic link: Protocol error
Asked Answered
I

9

38

I have created linux (Centos) on my virtual box. When I ssh to it and I try to create symbolic link (on my shared folder with full access):

ln -s path/folder/example myFolder

I get error:

ln: creating symbolic link `myFolder': Protocol error

Is there any reason or solution to this?

Immunogenic answered 27/7, 2013 at 7:11 Comment(2)
Were you able to resolve this issue? I am also seeing similar issue root@57856515e02b:/artifacts/test/install/lib# ln -s /usr/share/tcltk/tcl8.5 /artifacts/test/install/lib/ ln: failed to create symbolic link '/artifacts/test/install/lib/tcl8.5': Protocol errorMalonylurea
For me, running as admin wasn't enough, but here was my answer: https://mcmap.net/q/410408/-ln-failed-to-create-symbolic-link-protocol-error-in-vagrantRoo
A
26

It's a problem with the host filesystem. Check the permissions on the host folder are adequate and the the host filesystem supports symlinks.

Amphicoelous answered 27/7, 2013 at 7:20 Comment(4)
The host system is windows 7. Is there any solution to enable it?Immunogenic
Bad solution for this is to create symlinks in windows 7 by using mklink. Example: mklink /D myFolder path/folder/exampleImmunogenic
from which API/layer does the Protocol error message come from here?Demobilize
whatever app you used to launch your VM, VBox, or vagrant or ... you have to run the app as an administratorBroadfaced
D
35

Right click on your command prompt and "Run as Administrator" (or whatever program you're using to make those symlinks needs to be run as adminstrator).

Downturn answered 24/10, 2013 at 19:37 Comment(8)
Actually, protocol errors in creating symlinks are common to virtual boxes running on windows. Running the shell as an admin generally corrects the issue.Buddha
I had a similar issue but when you run the VM as administrator you'll be able to create symbolic links. For more information also have a look at: https://mcmap.net/q/410409/-correct-way-to-setup-virtualbox-4-3-to-use-symlinks-on-guest-for-meteorBannerman
Can you explain what you need to do to "Right click"? Is that a particular escape sequence in the SSH session?Rayshell
@TobySpeight they mean right-click the icon/shortcut/whatever in Windows that launches the command prompt.Underlayer
@alexw, what does Windows have to do with any of this?Rayshell
OP says that their host OS is windows 7.Underlayer
This should have been the accepted solution. However the host is launching the VM, it has to done as an administratorBroadfaced
Im having this problem in windows 10, running the cmd as admin tried halting and much moreHarwilll
C
30

Here is the solution in a ticket on virtualbox.org : https://www.virtualbox.org/ticket/10085#comment:32 (Note: Execute "whoami /priv" in console with Administrative privileges)

I have done some Windows research on this bug.

If your user is of the Administrator type (rather than a Standard account), there's no way to run VB with symlinks working without the UAC prompt.

If you have a Standard user account (or if you are willing to switch your account to Standard and create a separate Admin account), the solution exists. You will, however, need admin privileges to accomplish several of the steps (not necesarrily for your user account).

  1. Run the Local Security Policy (Win+R, type "secpol.msc", confirm UAC). Then navigate to "Local Policies->User Rights Assignment".
  2. Find the permission called "Create symbolic links" and double-click it. Add your user to the list of objects having this permission. Or you can add the "Users" group. Log off and log on. You can check the success by running in console:

    whoami /priv
    

    If you see the privilege SeCreateSymbolicLinkPrivilege enabled, you've done well.

  3. Make sure your user has proper access to the shared folder on host system.

  4. As mentioned here earlier, execute

    VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1
    

    in a console from the C:\Program Files\VirtualBox folder. Don't forget to substitute VM_NAME with the name of your VM and SHARE_NAME with the name of the shared folder (as it appears in the VM settings).

  5. You're done.

If you happen to own one of the "lesser" version of windows (e.g. 7 Home), you don't have the "secpol.msc" utility. See How do I grant SeCreateSymbolicLink on Windows Vista Home edition for help.

Covenantee answered 30/8, 2016 at 3:12 Comment(3)
Thanks, use secpol.msc and gave myself privs. Worked perfectly.Virgule
It works, thanks! Small note though: if whoami /priv lists your privilege as "Disabled" - don't worry, it just means something else (social.technet.microsoft.com/Forums/ie/en-US/…) . If it is listed, it works for your user.Imprecate
Thank you. This helped me to solve my symlinking problem in the Drupal VM.Spurrier
A
26

It's a problem with the host filesystem. Check the permissions on the host folder are adequate and the the host filesystem supports symlinks.

Amphicoelous answered 27/7, 2013 at 7:20 Comment(4)
The host system is windows 7. Is there any solution to enable it?Immunogenic
Bad solution for this is to create symlinks in windows 7 by using mklink. Example: mklink /D myFolder path/folder/exampleImmunogenic
from which API/layer does the Protocol error message come from here?Demobilize
whatever app you used to launch your VM, VBox, or vagrant or ... you have to run the app as an administratorBroadfaced
L
4

As I understand, Windows VirtualBox hosts doesn't support links (from https://www.virtualbox.org/manual/ch04.html#sharedfolders)

Starting with version 4.0, VirtualBox shared folders also support symbolic links (symlinks), under the following conditions:

The host operating system must support symlinks (i.e. a Mac, Linux or Solaris host is required).

Currently only Linux and Solaris Guest Additions support symlinks.

For security reasons the guest OS is not allowed to create symlinks by default. If you trust the guest OS to not abuse the functionality, you can enable creation of symlinks for "sharename" with:

VBoxManage setextradata "VM name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/sharename 1

Language answered 10/9, 2017 at 3:12 Comment(0)
K
3

I solved this issue by changing the local security policy in my windows. Search for local security policy and open it then on the left-hand side select Local Policies -> User Rights Assignments -> Create Symbolic Links

  • Click on Add User or Group
  • Type in everyone in the select user/group prompt.
  • Reboot your system

It should work.

Kamakura answered 18/8, 2022 at 5:32 Comment(0)
C
1

By default VirtualBox VM disables creation of symbolic links.

Oracle VM VirtualBox shared folders support symbolic links under the following conditions:

  • The host operating system must support symlinks. For example, a Mac OS X, Linux, or Oracle Solaris host is required.
  • Currently only Linux and Oracle Solaris Guest Additions support symlinks.
  • For security reasons the guest OS is not allowed to create symlinks by default.

To enable creation of symlinks for a shared folder you should do:

  1. Run this command on your host (where {VM_name} is the name of VM and {share_folder_name} is the name of shared directory):
$ VBoxManage setextradata "{VM_name}" VBoxInternal2/SharedFoldersEnableSymlinksCreate/{share_folder_name} 1

In my case it looks like:

$ VBoxManage setextradata "ubuntu16" VBoxInternal2/SharedFoldersEnableSymlinksCreate/shared 1
  1. Reboot the VM.

More information you can find here:

https://docs.oracle.com/cd/E97728_01/E97727/html/sharedfolders.html https://www.virtualbox.org/ticket/18572?cversion=0&cnum_hist=2

Conscientious answered 10/11, 2019 at 23:5 Comment(0)
B
0

find the cmd.exe file. Right click on the cmd.exe . Select "Run as Administrator" menu option. It should work perfectly.

Bechtel answered 20/12, 2016 at 9:26 Comment(2)
You seem confused; why would you expect a CentOS box to have a cmd.exe, and how do you expect "Right click" to be performed in an SSH session?Rayshell
This answer is referring to the host OS. You missed the part where OP stated they are on Windows.Iquique
P
0

Basically you need to again tell VirtualBox to enable symlinks. Here's the complete solution

Have this in your vagrant file,

config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/Folder_Name", "1"]
end

I recommended comment out any sync folder and let default ./(at host) synced at /vagrant(at guest). This will make sure your shared folder(Folder_Name) name is always vagrant as mentioned here https://www.vagrantup.com/docs/synced-folders/. Also, you won't face issues with ssh

If the symlink protocol error returns after restart or still persists run

VBoxManage setextradata "VM_Name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/Folder_Name 1

vagrant halt
vagrant up

vagrant ssh

Usually, VBoxManagee is located at C:\Program Files\Oracle\VirtualBox\

Verify working of symlink by going to /vagrant and running

touch test.txt && ln -s test.txt test1.txt

PS: I have tried this on Windows Home which has limited accessibility to security settings

Petrous answered 20/5, 2020 at 1:39 Comment(0)
F
0

I observed the same error in virtual box ( Lubuntu running in Windows 10). Issue got resolved by running "Oracle VM Virtualbox" using 'Run As Administrator' option.

Feune answered 2/2, 2022 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.