4

I using Virtual box + gem Vagrant
One week before everything works well.
I had packaged my box. And now I've deployed the box again with the same project.

and Capistrano has outputted error:

*** [err :: 33.33.33.10] creating symbolic link `/vagrant/demoapp/current/log'
*** [err :: 33.33.33.10] : Read-only file system

https://gist.github.com/1746250 (error + deploy.rb)

I have set sudo chmod 777 -R 1vagrant/
But it still doestn't work.

What happen?

10
  • Is VM filesystem writeable? Can you manually create /vagrant/demoapp/current/log folder? ( same as /vagrant/demoapp/shared/log) Commented Feb 5, 2012 at 16:18
  • hi again. yes i can vagrant@lucid32:/vagrant/demoapp/shared$ rm -rf log/ vagrant@lucid32:/vagrant/demoapp/shared$ mkdir log mkdir /vagrant/demoapp/current/log cap deploy - Same error
    – itsnikolay
    Commented Feb 5, 2012 at 16:23
  • hmm, could you check this command: ssh [email protected] 'ln -s /vagrant/demoapp/shared/log /vagrant/demoapp/current/log' ? Commented Feb 5, 2012 at 16:34
  • 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 itsnikolay@itsnikolay-VirtualBox:~/vagrant/1vagrant/projects/demoapp$ Yes, the same error.
    – itsnikolay
    Commented Feb 5, 2012 at 16:40
  • So, you can't modify your vm fs via ssh - here is the reason, it's not a capistrano issue. Could you modify VM FS while logged in under [email protected] ? Commented Feb 5, 2012 at 16:45

2 Answers 2

7

There is a workaround to make symlinks in shared folders 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!

1
  • what is the SHARE_NAME ? for example : i have something like this in my vagrantfile : config.vm.synced_folder ".", "/var/www/manager"
    – julio
    Commented Oct 14, 2015 at 16:52
3

Official answer of Vagrant gem's author:

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

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

https://github.com/mitchellh/vagrant/issues/713

Not the answer you're looking for? Browse other questions tagged or ask your own question.