Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
itsNikolay opened this issue Feb 5, 2012 · 88 comments
Closed

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

itsNikolay opened this issue Feb 5, 2012 · 88 comments

Comments

@itsNikolay
Copy link

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
Copy link
Contributor

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

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

@schisamo
Copy link
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
Copy link
Author

Thanks for answer.
It brings new features in vagrant.

@schisamo
Copy link
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
Copy link
Author

Oh, Master!

@divoxx
Copy link

divoxx commented Apr 12, 2012

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

@bartzy
Copy link

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
Copy link

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

@divoxx
Copy link

divoxx commented May 4, 2012

Its v-root

@clintberry
Copy link

@divoxx Thanks!

@till
Copy link
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
Copy link

Thanks man, this works perfectly!

@AndreyKozlov1984
Copy link

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

@danylevskyi
Copy link

ZeusTheTrueGod +1

@rjmunro
Copy link

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
Copy link

jaypea commented Oct 17, 2012

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

@tsgautier
Copy link

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
Copy link

jaypea commented Oct 28, 2012

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

@volkanunsal
Copy link

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

@illepic
Copy link

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.

@lehrblogger
Copy link

@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
Copy link

Thanks man!

@kahlstrom
Copy link

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
Copy link
Contributor

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

@AnthonyBRoberts
Copy link

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

@felixfyi
Copy link

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

@jesalg
Copy link

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
Copy link

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
Copy link

So based on this

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

What is the name of the shared folder?

@wangpin34
Copy link

@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
Copy link

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
Copy link

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
Copy link

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
… folder, at that is the default behavior of vagrant since 1.1. (hashicorp/vagrant#713 (comment))
@Perni1984
Copy link

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
Copy link

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
Copy link

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
Copy link

@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
Copy link

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
Copy link

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
Copy link

@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
Copy link

I can't believe this issue still persists!

@juniway
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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.

@ghost
Copy link

ghost commented Mar 30, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests