Read-only file system. What's wrong? #713

Closed
itsNikolay opened this Issue Feb 5, 2012 · 87 comments

Comments

Projects
None yet
@itsNikolay

If you are not agains I continue after this discussion:
http://stackoverflow.com/questions/9150732/capistrano-deploy-in-virtual-machne

*** [err :: 33.33.33.10] creating symbolic link /vagrant/demoapp/current/log' *** [err :: 33.33.33.10] : Read-only file system and itsnikolay@itsnikolay-VirtualBox:~/vagrant/1vagrant/projects/demoapp$ ssh vagrant@33.33.33.10 'ln -s /vagrant/demoapp/shared/log /vagrant/demoapp/current/log' vagrant@33.33.33.10's password: ln: creating symbolic link/vagrant/demoapp/current/log': Read-only file system
The same error

Anybody has thoughts about the error, probably you met it before?

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Feb 5, 2012

Member

The VirtualBox shared folder filesystem doesn't allow symlinks, unfortunately.

Your only option is to deploy outside of the shared folders.

Member

mitchellh commented Feb 5, 2012

The VirtualBox shared folder filesystem doesn't allow symlinks, unfortunately.

Your only option is to deploy outside of the shared folders.

@mitchellh mitchellh closed this Feb 5, 2012

@schisamo

This comment has been minimized.

Show comment
Hide comment
@schisamo

schisamo Mar 8, 2012

Contributor

Since VirtualBox 4.0 this is supported with a few caveats:

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 Guest Additions support symlinks.

More info in the VBox Guest Additions documentation.

Although this appears to be broken with VirtualBox 4.1.8! 😡

Contributor

schisamo commented Mar 8, 2012

Since VirtualBox 4.0 this is supported with a few caveats:

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 Guest Additions support symlinks.

More info in the VBox Guest Additions documentation.

Although this appears to be broken with VirtualBox 4.1.8! 😡

@itsNikolay

This comment has been minimized.

Show comment
Hide comment
@itsNikolay

itsNikolay Mar 9, 2012

Thanks for answer.
It brings new features in vagrant.

Thanks for answer.
It brings new features in vagrant.

@schisamo

This comment has been minimized.

Show comment
Hide comment
@schisamo

schisamo Mar 9, 2012

Contributor

So I did find a workaround to make this all work on VirtualBox 4.1.8+ again. Basically you need to issue this command:

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

You can do this in the context of Vagrant by adding this to the Vagrant::Config.run block of your Vagrantfile:

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME", "1"]

More information can be found on VirtualBox bug #10085.

Please note the commenter that shares the setextradata trick forgets to tell you the key name requires the SHARE_NAME. I found this out digging through the C code! 😃

Contributor

schisamo commented Mar 9, 2012

So I did find a workaround to make this all work on VirtualBox 4.1.8+ again. Basically you need to issue this command:

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

You can do this in the context of Vagrant by adding this to the Vagrant::Config.run block of your Vagrantfile:

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME", "1"]

More information can be found on VirtualBox bug #10085.

Please note the commenter that shares the setextradata trick forgets to tell you the key name requires the SHARE_NAME. I found this out digging through the C code! 😃

@itsNikolay

This comment has been minimized.

Show comment
Hide comment
@itsNikolay

itsNikolay Mar 9, 2012

Oh, Master!

Oh, Master!

@divoxx

This comment has been minimized.

Show comment
Hide comment
@divoxx

divoxx Apr 12, 2012

I can't make this trick work. Is it still doable? Any other workaround?

divoxx commented Apr 12, 2012

I can't make this trick work. Is it still doable? Any other workaround?

@Bartzy

This comment has been minimized.

Show comment
Hide comment
@Bartzy

Bartzy Apr 12, 2012

@divoxx: Did you replace SHARE_NAME with the name of the Virtualbox share you want this to be enabled for?

Bartzy commented Apr 12, 2012

@divoxx: Did you replace SHARE_NAME with the name of the Virtualbox share you want this to be enabled for?

@clintberry

This comment has been minimized.

Show comment
Hide comment
@clintberry

clintberry May 4, 2012

Does anyone know what the share name is for vagrant by default?

Does anyone know what the share name is for vagrant by default?

@divoxx

This comment has been minimized.

Show comment
Hide comment
@divoxx

divoxx May 4, 2012

Its v-root

divoxx commented May 4, 2012

Its v-root

@clintberry

This comment has been minimized.

Show comment
Hide comment

@divoxx Thanks!

@till

This comment has been minimized.

Show comment
Hide comment
@till

till Jun 9, 2012

Contributor

This works perfectly for symbolic links. Maybe this could be included by default? (cc @mitchellh)

Does anyone have a fix for hardlinks?

Contributor

till commented Jun 9, 2012

This works perfectly for symbolic links. Maybe this could be included by default? (cc @mitchellh)

Does anyone have a fix for hardlinks?

@wesleyvicthor

This comment has been minimized.

Show comment
Hide comment
@wesleyvicthor

wesleyvicthor Jun 19, 2012

Thanks man, this works perfectly!

Thanks man, this works perfectly!

@ZeusTheTrueGod

This comment has been minimized.

Show comment
Hide comment
@ZeusTheTrueGod

ZeusTheTrueGod Aug 28, 2012

Please include this in the default vagrant package or least put a notice somewhere in docs!

Please include this in the default vagrant package or least put a notice somewhere in docs!

@danylevskyi

This comment has been minimized.

Show comment
Hide comment
@danylevskyi

danylevskyi Oct 2, 2012

ZeusTheTrueGod +1

ZeusTheTrueGod +1

@rjmunro

This comment has been minimized.

Show comment
Hide comment
@rjmunro

rjmunro Oct 16, 2012

Just to be clear, the fix for this is to put:

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

in the Vagrantfile (for the default share that gets mounted at /vagrant)

rjmunro commented Oct 16, 2012

Just to be clear, the fix for this is to put:

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

in the Vagrantfile (for the default share that gets mounted at /vagrant)

@jaypea

This comment has been minimized.

Show comment
Hide comment
@jaypea

jaypea Oct 17, 2012

is there a chance that vagrant would change this setting by default?

jaypea commented Oct 17, 2012

is there a chance that vagrant would change this setting by default?

@tsgautier

This comment has been minimized.

Show comment
Hide comment
@tsgautier

tsgautier Oct 27, 2012

anyone have any ideas what to do if the host is windows? I'm on a Mac but some of my colleagues will be using windows :(

anyone have any ideas what to do if the host is windows? I'm on a Mac but some of my colleagues will be using windows :(

@jaypea

This comment has been minimized.

Show comment
Hide comment
@jaypea

jaypea Oct 28, 2012

it works on windows too. vagrant need to be run with administrator priviledges.

jaypea commented Oct 28, 2012

it works on windows too. vagrant need to be run with administrator priviledges.

@volkanunsal

This comment has been minimized.

Show comment
Hide comment
@volkanunsal

volkanunsal Nov 27, 2012

I can't get this fix to work in VirtualBox 4.2.4.

I can't get this fix to work in VirtualBox 4.2.4.

@illepic

This comment has been minimized.

Show comment
Hide comment
@illepic

illepic Dec 3, 2012

Same as @tenaciousflea above me, this appears to not work in VirtualBox 4.2.4 with all Guest Additions updated to 4.2.4.

illepic commented Dec 3, 2012

Same as @tenaciousflea above me, this appears to not work in VirtualBox 4.2.4 with all Guest Additions updated to 4.2.4.

@howardroark howardroark referenced this issue in pypa/virtualenv Dec 4, 2012

Closed

OSError: [Errno 30] Read-only file system #209

@lehrblogger

This comment has been minimized.

Show comment
Hide comment
@lehrblogger

lehrblogger Dec 31, 2012

@rjmunro Thanks for specifying! It was difficult to find documentation on what SHARE_NAME should be, and this worked for me with VirtualBox 4.2.6.

@rjmunro Thanks for specifying! It was difficult to find documentation on what SHARE_NAME should be, and this worked for me with VirtualBox 4.2.6.

@GabKlein

This comment has been minimized.

Show comment
Hide comment
@GabKlein

GabKlein Jan 28, 2013

Thanks man!

Thanks man!

@kahlstrom

This comment has been minimized.

Show comment
Hide comment
@kahlstrom

kahlstrom Jan 29, 2013

Using ...

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

... on Vagrant 1.0.6 with VirtualBox 4.2.6 on a Mac OSX Mountain Lion machine continues to result in failed symlink creation. Backing out and attempting to use the direct VirtualBox command gives no errors and appears to set the permission, but attempting to create symlinks continues to fail.

Are there any additional suggestions in relation to this issue?

Using ...

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

... on Vagrant 1.0.6 with VirtualBox 4.2.6 on a Mac OSX Mountain Lion machine continues to result in failed symlink creation. Backing out and attempting to use the direct VirtualBox command gives no errors and appears to set the permission, but attempting to create symlinks continues to fail.

Are there any additional suggestions in relation to this issue?

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Feb 6, 2013

Member

I'm happy to say I finally made this a default. It'll be released with Vagrant 1.1.

Member

mitchellh commented Feb 6, 2013

I'm happy to say I finally made this a default. It'll be released with Vagrant 1.1.

@AnthonyBRoberts

This comment has been minimized.

Show comment
Hide comment
@AnthonyBRoberts

AnthonyBRoberts Feb 12, 2013

I added this line to the Vagrant::Config.run block of my Vagrantfile:

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

I'm getting a slightly different error now, instead of "read only file system", I get a protocol error.

ln: failed to create symbolic link `local_settings.py': Protocol error

I added this line to the Vagrant::Config.run block of my Vagrantfile:

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

I'm getting a slightly different error now, instead of "read only file system", I get a protocol error.

ln: failed to create symbolic link `local_settings.py': Protocol error

@foetterer

This comment has been minimized.

Show comment
Hide comment
@foetterer

foetterer Feb 13, 2013

Big thanks @schisamo for this hint.
Sounds good @mitchellh :)

Big thanks @schisamo for this hint.
Sounds good @mitchellh :)

@baldurrensch

This comment has been minimized.

Show comment
Hide comment
@baldurrensch

baldurrensch Feb 14, 2013

This trick

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

totally did it for me! Thanks.

This trick

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

totally did it for me! Thanks.

@SalmanPK

This comment has been minimized.

Show comment
Hide comment

@schisamo Thanks bro!

@brugnara

This comment has been minimized.

Show comment
Hide comment
@brugnara

brugnara Mar 5, 2013

You saved my day. Many thanks for "config.vm.customize [...]" trick.

brugnara commented Mar 5, 2013

You saved my day. Many thanks for "config.vm.customize [...]" trick.

@vdeparday

This comment has been minimized.

Show comment
Hide comment
@vdeparday

vdeparday Mar 8, 2013

I have the same issue as @kahlstrom
On a OS X Lion 10.8.2, with Vagrant 1.0.6, VirtualBox 4.2.6 and a ubuntu server guest, this is not working:
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

Symlink inside the share /vagrant are still in red and are not working

I have the same issue as @kahlstrom
On a OS X Lion 10.8.2, with Vagrant 1.0.6, VirtualBox 4.2.6 and a ubuntu server guest, this is not working:
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

Symlink inside the share /vagrant are still in red and are not working

@corydolphin

This comment has been minimized.

Show comment
Hide comment
@corydolphin

corydolphin Mar 9, 2013

This issue still persists when using Windows 8x64, Vagrant 1.0.6 and Virtualbox 4.2.6 and 4.2.8.
It appears that even after reloading the vm

C:\Program Files\Oracle\VirtualBox>VBoxManage getextradata :id ENU
MERATE
No value set!

Weirdly, running the VboxManage command to set the extra data fails as well:

VBoxManage setextradata :id VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root

VBoxManage.exe: error: Failed to create the VirtualBox object!
VBoxManage.exe: error: Code CO_E_SERVER_EXEC_FAILURE (0x80080005) - Server execu
tion failed (extended info not available)
VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or
failed to start.

(Command found: https://coderwall.com/p/qklo9w?i=1&p=1&q=&t%5B%5D=!!mine&t%5B%5D=!!bookmarks)

Has anyone found a solution? For now, I will be using some tricks to get node_modules working properly.

This issue still persists when using Windows 8x64, Vagrant 1.0.6 and Virtualbox 4.2.6 and 4.2.8.
It appears that even after reloading the vm

C:\Program Files\Oracle\VirtualBox>VBoxManage getextradata :id ENU
MERATE
No value set!

Weirdly, running the VboxManage command to set the extra data fails as well:

VBoxManage setextradata :id VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root

VBoxManage.exe: error: Failed to create the VirtualBox object!
VBoxManage.exe: error: Code CO_E_SERVER_EXEC_FAILURE (0x80080005) - Server execu
tion failed (extended info not available)
VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or
failed to start.

(Command found: https://coderwall.com/p/qklo9w?i=1&p=1&q=&t%5B%5D=!!mine&t%5B%5D=!!bookmarks)

Has anyone found a solution? For now, I will be using some tricks to get node_modules working properly.

@jrnt30

This comment has been minimized.

Show comment
Hide comment
@jrnt30

jrnt30 Mar 10, 2013

I was able to the sym links working properly with the associated command after reading the blog post you listed. The trick for me was starting the cmd prompt as admin and running VirtualBox GUI as admin.

I'd also like to point out, which I'm fairly sure you know, that the ":id" should be replaced by whatever your Vagrant box's name was created as. The easiest way to find that I know of is to simply open the VirtualBox GUI.

jrnt30 commented Mar 10, 2013

I was able to the sym links working properly with the associated command after reading the blog post you listed. The trick for me was starting the cmd prompt as admin and running VirtualBox GUI as admin.

I'd also like to point out, which I'm fairly sure you know, that the ":id" should be replaced by whatever your Vagrant box's name was created as. The easiest way to find that I know of is to simply open the VirtualBox GUI.

@eleventigers

This comment has been minimized.

Show comment
Hide comment
@eleventigers

eleventigers Apr 6, 2013

vm.customize method does not seem to work in 1.1.5. Is there a equivalent in 1.1.5, really need this to work...

vm.customize method does not seem to work in 1.1.5. Is there a equivalent in 1.1.5, really need this to work...

@foetterer

This comment has been minimized.

Show comment
Hide comment
@foetterer

foetterer Apr 6, 2013

@eleventigers instead of config.vm.customize you need to configure it in the provider block for 1.1.x according to http://docs.vagrantup.com/v2/virtualbox/configuration.html

This means:

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

@eleventigers instead of config.vm.customize you need to configure it in the provider block for 1.1.x according to http://docs.vagrantup.com/v2/virtualbox/configuration.html

This means:

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

This comment has been minimized.

Show comment
Hide comment
@jhofer

jhofer Nov 2, 2014

You have to run VirtualBox as Administrator otherwise you still get the protocoll error

jhofer commented Nov 2, 2014

You have to run VirtualBox as Administrator otherwise you still get the protocoll error

@jberger jberger referenced this issue in TechEmpower/FrameworkBenchmarks Nov 6, 2014

Closed

Vagrant guest cannot create hardlink #1202

@stalal

This comment has been minimized.

Show comment
Hide comment
@stalal

stalal Nov 8, 2014

@trex005 : You're a life saver. The solution worked for me on the following configuration:

Virtualbox 4.3.18
Vagrant 1.6.5
Windows 7 x86

stalal commented Nov 8, 2014

@trex005 : You're a life saver. The solution worked for me on the following configuration:

Virtualbox 4.3.18
Vagrant 1.6.5
Windows 7 x86

@jesalg

This comment has been minimized.

Show comment
Hide comment
@jesalg

jesalg Dec 1, 2014

@trex005 You saved the day! Thank you!

My config:
Virtualbox 4.3.18
Vagrant 1.6.3
Windows 8.1 x64

jesalg commented Dec 1, 2014

@trex005 You saved the day! Thank you!

My config:
Virtualbox 4.3.18
Vagrant 1.6.3
Windows 8.1 x64

@tacoben

This comment has been minimized.

Show comment
Hide comment
@tacoben

tacoben Dec 4, 2014

can anyone show me / point to how to find ANY share name? I dont use the default often, and I suspect that this is hurting me.

tacoben commented Dec 4, 2014

can anyone show me / point to how to find ANY share name? I dont use the default often, and I suspect that this is hurting me.

@iwanwan

This comment has been minimized.

Show comment
Hide comment
@iwanwan

iwanwan Jan 8, 2015

Not work, I try like this on my Vagrantfile

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

it return

vm:
* The following settings shouldn't exist: customize

iwanwan commented Jan 8, 2015

Not work, I try like this on my Vagrantfile

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

it return

vm:
* The following settings shouldn't exist: customize
@curtisblackwell

This comment has been minimized.

Show comment
Hide comment
@curtisblackwell

curtisblackwell Jan 10, 2015

I have the same problem as @iwanwan. @trex005's solution doesn't work for me either.

Running Vagrant 1.6.5 on Mac OS X Yosemite.

I have the same problem as @iwanwan. @trex005's solution doesn't work for me either.

Running Vagrant 1.6.5 on Mac OS X Yosemite.

@PrakashThapa

This comment has been minimized.

Show comment
Hide comment
@PrakashThapa

PrakashThapa Jan 30, 2015

Same Problem for me.

vm:
* The following settings shouldn't exist: customize```

Same Problem for me.

vm:
* The following settings shouldn't exist: customize```
@marcofranssen

This comment has been minimized.

Show comment
Hide comment
@marcofranssen

marcofranssen Aug 11, 2015

Can't get this to work. Is anyone able to help me out?

I have following setup:

Windows 8.1
Vagrant 1.7.4
VirtualBox 5

I have multiple shared folders like this:

config.vm.synced_folder "../webapp", "/srv/webapp", type: "smb"
config.vm.synced_folder "../backend", "/srv/backend", type: "smb"
...
....
...

For the webapp I use nodejs, when I install node packages using npm it tries to create symlinks and fails with the following error.

vagrant@devenvbk:/srv/webapp$ npm install --save-dev gulp
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--save-dev" "gulp"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path ../user-home/cli.js
npm ERR! code ENOTSUP
npm ERR! errno -95

npm ERR! nospc ENOTSUP, symlink '../user-home/cli.js'
npm ERR! nospc This is most likely not a problem with npm itself
npm ERR! nospc and is related to insufficient space on your system.

npm ERR! Please include the following file with any support request:
npm ERR!     /srv/webapp/npm-debug.log

Also tried to manually create a symlink using ln -s but that also fails with following output.

ln: failed to create symbolic link `test': Operation not supported

So it seems the symlinks are not working for me out of the box. Any ideas on what I can try to solve this?

Can't get this to work. Is anyone able to help me out?

I have following setup:

Windows 8.1
Vagrant 1.7.4
VirtualBox 5

I have multiple shared folders like this:

config.vm.synced_folder "../webapp", "/srv/webapp", type: "smb"
config.vm.synced_folder "../backend", "/srv/backend", type: "smb"
...
....
...

For the webapp I use nodejs, when I install node packages using npm it tries to create symlinks and fails with the following error.

vagrant@devenvbk:/srv/webapp$ npm install --save-dev gulp
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--save-dev" "gulp"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path ../user-home/cli.js
npm ERR! code ENOTSUP
npm ERR! errno -95

npm ERR! nospc ENOTSUP, symlink '../user-home/cli.js'
npm ERR! nospc This is most likely not a problem with npm itself
npm ERR! nospc and is related to insufficient space on your system.

npm ERR! Please include the following file with any support request:
npm ERR!     /srv/webapp/npm-debug.log

Also tried to manually create a symlink using ln -s but that also fails with following output.

ln: failed to create symbolic link `test': Operation not supported

So it seems the symlinks are not working for me out of the box. Any ideas on what I can try to solve this?

@jesalg

This comment has been minimized.

Show comment
Hide comment
@jesalg

jesalg Aug 12, 2015

@marcofranssen Try adding this to your Vagrantfile:

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

jesalg commented Aug 12, 2015

@marcofranssen Try adding this to your Vagrantfile:

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

This comment has been minimized.

Show comment
Hide comment
@wangpin34

wangpin34 Aug 13, 2015

Following command works on VirtualBox 4.3.28

VBoxManage setextradata centos-mp_1 VBoxInternal2/SharedFoldersEnableSymlinksCreate/git 1

centos-mp_1 is my vm name, git is my share folder name. After restart the Virtalbox, it works.
By the way, this command could be executed in install dir.

Following command works on VirtualBox 4.3.28

VBoxManage setextradata centos-mp_1 VBoxInternal2/SharedFoldersEnableSymlinksCreate/git 1

centos-mp_1 is my vm name, git is my share folder name. After restart the Virtalbox, it works.
By the way, this command could be executed in install dir.

@marcofranssen

This comment has been minimized.

Show comment
Hide comment
@marcofranssen

marcofranssen Aug 13, 2015

So based on this

config.vm.synced_folder "../webapp", "/srv/webapp", type: "smb"

What is the name of the shared folder?

So based on this

config.vm.synced_folder "../webapp", "/srv/webapp", type: "smb"

What is the name of the shared folder?

@wangpin34

This comment has been minimized.

Show comment
Hide comment
@wangpin34

wangpin34 Aug 13, 2015

@marcofranssen I don't know your share folder but these ../webapp, /srv/webapp are not like names of share folder. Follow is my share folder setting.
myvm
'E:/work/git' is the real dir, and the 'git' is the share folder name. I have executed the command and it works as expected. Don't forget to restart your Virtualbox finally.

VBoxManage setextradata centos-mp_1 VBoxInternal2/SharedFoldersEnableSymlinksCreate/git 1

This solution is not for vagrant - virtualbox. Actually I don't know too much about vagrant. Sorry for any misunderstand.

@marcofranssen I don't know your share folder but these ../webapp, /srv/webapp are not like names of share folder. Follow is my share folder setting.
myvm
'E:/work/git' is the real dir, and the 'git' is the share folder name. I have executed the command and it works as expected. Don't forget to restart your Virtualbox finally.

VBoxManage setextradata centos-mp_1 VBoxInternal2/SharedFoldersEnableSymlinksCreate/git 1

This solution is not for vagrant - virtualbox. Actually I don't know too much about vagrant. Sorry for any misunderstand.

@marcofranssen

This comment has been minimized.

Show comment
Hide comment
@marcofranssen

marcofranssen Aug 14, 2015

Somehow the shared folders created with vagrant don't show up in the Virtualbox UI. Any ideas on how I can get my hands on the shared folder names created using Vagrant?

Somehow the shared folders created with vagrant don't show up in the Virtualbox UI. Any ideas on how I can get my hands on the shared folder names created using Vagrant?

@psychok7

This comment has been minimized.

Show comment
Hide comment
@psychok7

psychok7 Aug 14, 2015

I can't get it to work using:

  config.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--memory", 2048]
      vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
  end

on

Ubuntu 14.04
Vagrant 1.7.4
VirtualBox 4.3.16

I try doing creating the symlink with python 2.7.6 and os.link() but i get a OSError: [Errno 1] Operation not permitted.

Any ideas?

I can't get it to work using:

  config.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--memory", 2048]
      vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
  end

on

Ubuntu 14.04
Vagrant 1.7.4
VirtualBox 4.3.16

I try doing creating the symlink with python 2.7.6 and os.link() but i get a OSError: [Errno 1] Operation not permitted.

Any ideas?

@jskrepnek

This comment has been minimized.

Show comment
Hide comment
@jskrepnek

jskrepnek Aug 19, 2015

Note that symbolic links appear to have been broken in VirtualBox 5 on Windows. See this vagrant issue.

In addition to some combination of the solutions mentioned above, downgrading to VirtualBox 4.3.3 was also required for me to get symbolic links working in shared folders.

Note that symbolic links appear to have been broken in VirtualBox 5 on Windows. See this vagrant issue.

In addition to some combination of the solutions mentioned above, downgrading to VirtualBox 4.3.3 was also required for me to get symbolic links working in shared folders.

nivl4 added a commit to nivl4/habitrpg that referenced this issue Oct 24, 2015

Remove vagrant customization that enables symlinks in /vagrant shared…
… folder, at that is the default behavior of vagrant since 1.1. (hashicorp/vagrant#713 (comment))
@Perni1984

This comment has been minimized.

Show comment
Hide comment
@Perni1984

Perni1984 Dec 17, 2015

I can confirm being able to create and browse symlinks inside the /vagrant shared folder using @trex005 method above on the following configuration:

Host OS: Windows 10
VirtualBox: 5.0.10 r104061
Vagrant: 1.7.4 (self-patched #6493 to re-enable UNC filepath on windows -> this may not be necessary!)

Guest OS: Ubuntu/trusty64

What is not working is creating symlinks inside synced_folders that are synced via smb!

@marcofranssen: you can get the names of the shares via 'net share' on the windows command prompt (as you mentioned correctly they are not shown within virtualbox manager).

Nevertheless using the sharename of an smb share together with

v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/<SMBShareName>", "1"]

does not work as those shares are mounted as cifs shares instead of vboxsf shares (like /vagrant is) inside the guest OS.

Summarizing:
Symlinks for synced_folders that are using vboxsf in the guest OS are working on my system
Symlinks for synced_folders that are using cifs in the guest OS are not working on my system

I can confirm being able to create and browse symlinks inside the /vagrant shared folder using @trex005 method above on the following configuration:

Host OS: Windows 10
VirtualBox: 5.0.10 r104061
Vagrant: 1.7.4 (self-patched #6493 to re-enable UNC filepath on windows -> this may not be necessary!)

Guest OS: Ubuntu/trusty64

What is not working is creating symlinks inside synced_folders that are synced via smb!

@marcofranssen: you can get the names of the shares via 'net share' on the windows command prompt (as you mentioned correctly they are not shown within virtualbox manager).

Nevertheless using the sharename of an smb share together with

v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/<SMBShareName>", "1"]

does not work as those shares are mounted as cifs shares instead of vboxsf shares (like /vagrant is) inside the guest OS.

Summarizing:
Symlinks for synced_folders that are using vboxsf in the guest OS are working on my system
Symlinks for synced_folders that are using cifs in the guest OS are not working on my system

@Perni1984

This comment has been minimized.

Show comment
Hide comment
@Perni1984

Perni1984 Dec 18, 2015

ok, finally got this working on a windows 10 host, without having to enable symlinks outside the vagrant box.

use type "smb" for the synced folder, force smb3 and mfsymlinks as mount options and everything works fast and like a breeze on windows 10:

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

Important: the linux guest must have a kernel version >= 3.18, otherwise mfsymlinks does not work.

ok, finally got this working on a windows 10 host, without having to enable symlinks outside the vagrant box.

use type "smb" for the synced folder, force smb3 and mfsymlinks as mount options and everything works fast and like a breeze on windows 10:

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

Important: the linux guest must have a kernel version >= 3.18, otherwise mfsymlinks does not work.

@pYr0x

This comment has been minimized.

Show comment
Hide comment
@pYr0x

pYr0x Jan 7, 2016

@Perni1984 i tried your solution. unfortunately it is not working for me.

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

and

The error output from the last command was:

stdin: is not a tty
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

i have no passwort for my windows user. so i skip the prompt when i was asking:

default: You will be asked for the username and password to use for the SMB
default: folders shortly. Please use the proper username/password of your
default: Windows account.
default:
default: Username: MYUSERNAME
default: Password (will be hidden):

pYr0x commented Jan 7, 2016

@Perni1984 i tried your solution. unfortunately it is not working for me.

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

and

The error output from the last command was:

stdin: is not a tty
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

i have no passwort for my windows user. so i skip the prompt when i was asking:

default: You will be asked for the username and password to use for the SMB
default: folders shortly. Please use the proper username/password of your
default: Windows account.
default:
default: Username: MYUSERNAME
default: Password (will be hidden):
@Perni1984

This comment has been minimized.

Show comment
Hide comment
@Perni1984

Perni1984 Jan 7, 2016

@pYr0x: reading mount permission denied means for me that mount.cifs cannot connect to the host System.

I suppose you have Windows 10, and I read here on Github that Microsoft made Windows 10 more "secure" by disabling insecure guest Access per default. On the following links you can find an Explanation:
https://techjourney.net/cannot-connect-to-cifs-smb-samba-network-shares-shared-folders-in-windows-10/

I guess there are two ways to solve this Problem:

  1. put a Password to your Default user (I would prefer this one)
  2. allow insecure guest Access as described in the link above.

Important, make sure your the Linux kernel of your guest OS is > 3.18, otherwise you won't have emulated symlink Support.

@pYr0x: reading mount permission denied means for me that mount.cifs cannot connect to the host System.

I suppose you have Windows 10, and I read here on Github that Microsoft made Windows 10 more "secure" by disabling insecure guest Access per default. On the following links you can find an Explanation:
https://techjourney.net/cannot-connect-to-cifs-smb-samba-network-shares-shared-folders-in-windows-10/

I guess there are two ways to solve this Problem:

  1. put a Password to your Default user (I would prefer this one)
  2. allow insecure guest Access as described in the link above.

Important, make sure your the Linux kernel of your guest OS is > 3.18, otherwise you won't have emulated symlink Support.

@jaywhy13

This comment has been minimized.

Show comment
Hide comment
@jaywhy13

jaywhy13 Jan 8, 2016

:( I still can't get it to work for me. I'm trying to share a folder from the VM to my host OS. I'm running Mac OS X It shows up as invalid in Mac OS 10.11.1 with a Ubuntu 14.04 VM.
I have the following in my configuration:

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
    vb.memory = "768"
  end

I've tried both vagrant and v-root. Nothing works. I'm using Vagrant 1.7.4 and VirtualBox 5.0.10

jaywhy13 commented Jan 8, 2016

:( I still can't get it to work for me. I'm trying to share a folder from the VM to my host OS. I'm running Mac OS X It shows up as invalid in Mac OS 10.11.1 with a Ubuntu 14.04 VM.
I have the following in my configuration:

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
    vb.memory = "768"
  end

I've tried both vagrant and v-root. Nothing works. I'm using Vagrant 1.7.4 and VirtualBox 5.0.10

@maoizm

This comment has been minimized.

Show comment
Hide comment
@maoizm

maoizm Jan 27, 2016

@Perni1984 Seems that your solution works only if I run vagrant as Administrator, otherwise I get error message from Vagrant.

Host: Windows 10 x64, Vagrant 1.8.1, Virtualbox 5.0.10
Guest: ubuntu/trusty32

maoizm commented Jan 27, 2016

@Perni1984 Seems that your solution works only if I run vagrant as Administrator, otherwise I get error message from Vagrant.

Host: Windows 10 x64, Vagrant 1.8.1, Virtualbox 5.0.10
Guest: ubuntu/trusty32

@Perni1984

This comment has been minimized.

Show comment
Hide comment
@Perni1984

Perni1984 Jan 27, 2016

@maoizm: you are right, to use smb for the synced Folders, vagrant has to be run as Administrator.
see: https://www.vagrantup.com/docs/synced-folders/smb.html

@maoizm: you are right, to use smb for the synced Folders, vagrant has to be run as Administrator.
see: https://www.vagrantup.com/docs/synced-folders/smb.html

@menasheh

This comment has been minimized.

Show comment
Hide comment
@menasheh

menasheh Jun 29, 2017

I can't believe this issue still persists!

I can't believe this issue still persists!

@juniway

This comment has been minimized.

Show comment
Hide comment
@juniway

juniway Jul 5, 2017

Virtualbox 5.1.22-win.exe
VBoxGuestAdditions_5.1.22.iso

Host: Windows 7
Guest: Arch Linux

On Windows Host, run VirtualBox as Administrator, and then login to the vm Guest OS, and create a symblic link in shared folder in /media/sf_tmp, pops out errors "Failed to create symbolic link 'xxx': Read-only file system"

juniway commented Jul 5, 2017

Virtualbox 5.1.22-win.exe
VBoxGuestAdditions_5.1.22.iso

Host: Windows 7
Guest: Arch Linux

On Windows Host, run VirtualBox as Administrator, and then login to the vm Guest OS, and create a symblic link in shared folder in /media/sf_tmp, pops out errors "Failed to create symbolic link 'xxx': Read-only file system"

@joshco

This comment has been minimized.

Show comment
Hide comment
@joshco

joshco Oct 20, 2017

I found a workaround by using bind mounts in Linux. I'm running into this issue with a node project where npm wants to use symlinks when it installs modules. (and the no-bin-links setting doesnt catch everything)

So I create a node_modules directory in the vagrant user home dir (an actual VM filesystem). Then I mount it on top of the node_modules on the vagrant shared fs.

mount --bind /home/vagrant/spoke_node_modules /vagrant/Spoke/node_modules

I put this in a provision always shell script in my vagrant file

This has a similar effect as if I had symlinked it to the local filesystem. The main drawback is that contents of the node_modules is not visible to the host system.

joshco commented Oct 20, 2017

I found a workaround by using bind mounts in Linux. I'm running into this issue with a node project where npm wants to use symlinks when it installs modules. (and the no-bin-links setting doesnt catch everything)

So I create a node_modules directory in the vagrant user home dir (an actual VM filesystem). Then I mount it on top of the node_modules on the vagrant shared fs.

mount --bind /home/vagrant/spoke_node_modules /vagrant/Spoke/node_modules

I put this in a provision always shell script in my vagrant file

This has a similar effect as if I had symlinked it to the local filesystem. The main drawback is that contents of the node_modules is not visible to the host system.

@jcrben

This comment has been minimized.

Show comment
Hide comment
@jcrben

jcrben Feb 24, 2018

I got this message running macOS host with a Linux guest when I was trying to symlink to another file in the in the shared folder from the guest. Thinking it over, I guess it makes sense that would never really work.

I used a relative path symlink inside the host instead to address it.

Keep the docs in mind on whether symlinks are supported https://www.virtualbox.org/manual/ch04.html#sharedfolders especially (as noted above):

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

jcrben commented Feb 24, 2018

I got this message running macOS host with a Linux guest when I was trying to symlink to another file in the in the shared folder from the guest. Thinking it over, I guess it makes sense that would never really work.

I used a relative path symlink inside the host instead to address it.

Keep the docs in mind on whether symlinks are supported https://www.virtualbox.org/manual/ch04.html#sharedfolders especially (as noted above):

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

@msutar

This comment has been minimized.

Show comment
Hide comment
@msutar

msutar Apr 3, 2018

Worked for me:
https://www.virtualbox.org/ticket/10085#comment:14
with restarting the virtualbox manager

My config :
VirtualBox : 5.1.20
Windows : 7 x64

msutar commented Apr 3, 2018

Worked for me:
https://www.virtualbox.org/ticket/10085#comment:14
with restarting the virtualbox manager

My config :
VirtualBox : 5.1.20
Windows : 7 x64

@sarbull

This comment has been minimized.

Show comment
Hide comment
@sarbull

sarbull Apr 11, 2018

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  
  config.vm.network "forwarded_port", guest: 3000, host: 3000
  config.vm.network "forwarded_port", guest: 4200, host: 4200
  config.vm.synced_folder "./projects", "/home/vagrant/projects", type: "virtualbox"
  
  config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
  end
  
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://10.0.0.1:8080/"
    config.proxy.https    = "http://10.0.0.1:8080"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
  end
end

EDIT:
But still no luck.

sarbull commented Apr 11, 2018

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  
  config.vm.network "forwarded_port", guest: 3000, host: 3000
  config.vm.network "forwarded_port", guest: 4200, host: 4200
  config.vm.synced_folder "./projects", "/home/vagrant/projects", type: "virtualbox"
  
  config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
  end
  
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://10.0.0.1:8080/"
    config.proxy.https    = "http://10.0.0.1:8080"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
  end
end

EDIT:
But still no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment