Vagrant: Read-only file system. What's wrong?

Created on 5 Feb 2012  ·  88Comments  ·  Source: hashicorp/vagrant

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 [email protected] 'ln -s /vagrant/demoapp/shared/log /vagrant/demoapp/current/log' [email protected]'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?

Most helpful comment

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! :smiley:

All 88 comments

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

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

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! :rage:

Thanks for answer.
It brings new features in vagrant.

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! :smiley:

Oh, Master!

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

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

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

Its v-root

@divoxx Thanks!

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

Does anyone have a fix for hardlinks?

Thanks man, this works perfectly!

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

ZeusTheTrueGod +1

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)

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

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 :(

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

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

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

@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.

Thanks man!

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?

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

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

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

This trick

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

totally did it for me! Thanks.

@schisamo Thanks bro!

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

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

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.

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.

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...

@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

@lixef great, thank you!

Hi all,
I am using version 1.21 and added the following code to my Vagrantfile:
config.vm.provider :virtualbox do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
Unfortunately, I still get the Protocol Error, when creating symlinks. Do I miss anything?
Thanks

Can you try like this:

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

unfortunately, still no luck, same error

Any help would be appreciated

The share name has changed in 1.1 and above to vagrant-root instead of v-root.

Try:

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

still the same result, I canot create symlinks.

just checking: do I need to substitute :id with anything, or can I leave it
like that?

On Wed, Apr 24, 2013 at 4:44 PM, Robert (Jamie) Munro <
[email protected]> wrote:

The share name has changed in 1.1 and above to vagrant-root instead of
v-root.

Try:

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


Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/713#issuecomment-16935265
.

Hi,
me again. I do not want to get a pain, but at the moment, I cannot work with python virtualenvs, which makes vagrant unusable for me. So are there any further options? And again: is ":id" supposed to be substituted with some real value or will that be done by vagrant automatically.
Thanks
Juergen

@schacki, for whatever it's worth, my Vagrantfile looks like this:

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

(I did not substitute ":id" with a real value.)

still no luck

Just wondering if there has been any progress on this front. I actually just learned about vagrant today after getting very frustrated with my own virtualbox configurations. I was really hoping this was going to be one of the issues I'd be able to avoid.

I only started using it lately, and am quite impressed. Even the shared folders worked out of the box - but only with read access and so far, I could not find anything to fix that ...

Alright guys, I did all of the following and then symlinks started working :
1) Added these lines to my config :
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
end
(Notice how I used the mounted name, and not the share name)
(Yes, I know this is supposed to default correctly but it was not working for me)
2) ran this command in an admin command prompt on windows :
fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
3) REBOOT HOST MACHINE
4) 'vagrant up' from an admin command prompt

Please, PLEASE someone try to reproduce to make sure this works. with the hundreds of other attempted solutions over many hours I can't be certain there was not something else contributing to the WIN.

@trex005 your solution works for me, even without restarting the host machine, and without running vagrant up from admin prompt.
On Windows 8x64 Vagrant 1.22

@trex005 you just made my day, I got it working by following 1-4 ( @wcdolphin shortcut did not work for me)

Now I am wondering,
a) Is there now a way do get the final solution working without admin prompt?
b) Is this a general problem (if so, why are only a few people affected) or is it a very special case (if so, what is so special from all the other machines/setups that seem to be working)
c) Should that be added to the docs somewhere?

Thanks a lot
juergen

@trex005 Thanks very much, your solution worked! (without the reboot part)

@xiankai: which version of vagrant and vbox do you use? i still get error:
ln: failed to create symbolic link `./dir': Read-only file system

@Remownz using Vagrant 1.2.2 and VirtualBOx 4.2.16. Hope that helps!

@xiankai : made my day, thank you!

The only way I make it work for my case is by running Vagrant as administrator.
VirtualBox: 4.2.18 r88780
Windows 7
Vagrant 1.3.5

I am running vagrant from git-bash, I opened git-bash as administrator. Make sure no virtual box processes are running, like: VBoxSVC.exe, if yes kill all VBox related processes.

SharedFoldersEnableSymlinksCreate && fsutil did not help, I tried with and without them no difference. I am not using VBox 4.3.2 because it did not work with vagrant 1.3.5.

Hope this helps somebody.

Thank You Iaithshadeed! first answer that worked!

Windows 7

Also running vagrant from git-bash.

Any pointers on how to get this working for Vagrant running on Mac/Linux?

@keithxm22 It may sound daft but also check that your guest additions match
the version of virtualbox you are using, I banged my head against a wall
for a while with that one!

On 25 February 2014 20:23:27 Keith Mascarenhas [email protected]
wrote:

Any pointers on how to get this working for Vagrant running on Mac/Linux?


Reply to this email directly or view it on GitHub:
https://github.com/mitchellh/vagrant/issues/713#issuecomment-36053527

@paulfurley @keithxm23 You can use the vagrant-vbguest plugin to check that automatically.

@trex005

Thanks for your solution. Worked for me on the following configuration:

Vagrant 1.4.3
VirtualBox 4.3.8
Windows 8.1 x64
Like @schacki, the "shortcut" posted by @wcdolphin did not work for me.

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

@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

@trex005 You saved the day! Thank you!

My config:
Virtualbox 4.3.18
Vagrant 1.6.3
Windows 8.1 x64

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.

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

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.

Same Problem for me.

``````
vm:

  • The following settings shouldn't exist: customize```
    ``````

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?

@marcofranssen Try adding this to your Vagrantfile:

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

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.

So based on this

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

What is the name of the shared folder?

@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.

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?

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?

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.

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

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.

@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: 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.

:( 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

@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: 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

I can't believe this issue still persists!

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"

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.

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

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

# -*- 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.

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

ken-colvin picture ken-colvin  ·  78Comments

sebastian-alfers picture sebastian-alfers  ·  124Comments

p0deje picture p0deje  ·  82Comments

starrychloe picture starrychloe  ·  117Comments

crashev picture crashev  ·  116Comments