Why can't I create soft link on vboxsf file system?

23

20

ln -s keeps saying me that file system is read-only, however it is not.

ice@distantstar:~/virt 
➜ touch file
ice@distantstar:~/virt 
➜ rm file
ice@distantstar:~/virt 
➜ ln -s ~/.bashrc ~/virt/.bashrc
ln: failed to create symbolic link `/home/ice/virt/.bashrc': Read-only file system
ice@distantstar:~/virt 
➜ mount | grep virt
none on /home/ice/virt type vboxsf (rw,nodev,relatime)
ice@distantstar:~/virt 
➜ cat /etc/fstab | grep virt
VIRT    /home/ice/virt  vboxsf rw   0   0

defhlt

Posted 2012-07-08T16:02:24.573

Reputation: 900

Answers

33

In Virtual Box 4.1.8, creating symlinks using a guest-OS in a shared folder has been disabled for security reasons.

For more information, check out this ticket: VirtualBox Ticket 10085 Disabled Symlinks To re enable, you can try running this command:

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

where SHARE_NAME is the name of your Shared Folder.

Alternatively you can downgrade to 4.1.6 and that should fix the issue.

protoss1210

Posted 2012-07-08T16:02:24.573

Reputation: 446

1This does not work on Virtual box 5 – Musa Haidari – 2016-04-07T05:56:39.100

Worked for me on Virtualbox 5.2. Needed to run VB as admin though. – Lqueryvg – 2017-11-23T12:07:15.257

where should I run this command. I'm on windows 10. shall I run this command using powershell? – ARUN – 2018-03-14T12:01:44.433

Didn't worked for me using VirtualBox 5.2.8 on Windows 7 running a Debian Stretch, running VB as Admin, having restarted VB entirely – snoob dogg – 2018-05-14T05:00:54.393

Ok. Thank you. Now I have ln: failed to create symbolic link \/home/ice/virt/.bashrc': Protocol error` – defhlt – 2012-07-10T10:59:26.940

Well, my bad. I was trying to create link to file in the guest OS's filesystem. which makes no sense, obviously. Vice versa it works: ln -s ~/virt/file ~ – defhlt – 2012-07-10T11:10:13.980

2Very good solution, but this is reported to not to work anymore in recent 4.2 releases. Whenever I'm creating a symbolic link on a shared folder (independent of the destitnation) I get ln: failed to create symbolic link 'linkname': Protocol error It's just sad this hasn't been addressed properly. Any new work around verified to work in 4.2.6+? – gertvdijk – 2013-02-12T14:46:13.463

3@gertvdijk if you're running a Windows host, you may want to run VirtualBox as administrator, it needs special privileges to be able to create Windows-style symlinks. – Ezequiel Muns – 2013-02-28T13:28:56.163

2Don't forget once you have run this command to restart your virtual box machine – Jason – 2014-04-27T00:46:44.270