1

I am getting this error with this line in my Vagrantfile during vagrant up, until I comment it out.

The setting is documented here:

http://docs-v1.vagrantup.com/v1/docs/config/vm/share_folder.html

Not sure why the following documented paramenter causes an error

config.vm.share_folder "puppetdir", "/etc/puppet", "/vagrant/mypuppetdir"

Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The following settings don't exist: share_folder

The latest virtualbox and latest vagrant. everything else works fine.

yAnTar
  • 4,269
  • 9
  • 47
  • 73
johnshen64
  • 3,734
  • 1
  • 21
  • 17

3 Answers3

3

On Vagrant 1.1+ you should use config.vm.synced_folder, the docs you are looking at are for older versions. Please refer to the updated documentation for more info: http://docs.vagrantup.com/v2/synced-folders/basic_usage.html

fgrehm
  • 785
  • 6
  • 5
1

Shared Folders has been renamed to Synded Folder since 1.1.

In your Vagrantfile you should be using the following

  config.vm.synced_folder "../data", "/vagrant_data"

  # by default enabled, uncomment to disable
  # config.vm.synced_folder ".", "/vagrant", disabled: true

NOTE: By default, Vagrant will share your project directory (the directory where Vagrantfile resides) to /vagrant.

  config.vm.synced_folder ".", "/vagrant", disabled: true

More flexible example

  vagrant_data = File.expand_path("../vagrant_data", __FILE__)
  Dir::mkdir(vagrant_data) unless FileTest::directory?(vagrant_data)
  config.vm.synced_folder "vagrant_data", "/vagrant_data"

Take a look at this for more information => shared folders VS synced folders

Community
  • 1
  • 1
Terry Wang
  • 13,840
  • 3
  • 50
  • 43
0

Extending from https://github.com/mitchellh/vagrant/issues/936#issuecomment-7179034

if you need to mount a volume as a user that doesn't exist when the vm boots you can get there like so:

# Vagrantfile line

config.vm.synced_folder "host_folder", "/svr/fake_mount_folder", id: "whatever_name"
# ...
config.vm.provision "shell", inline: <<-SHELL
  # ...
  # In my case a package installed a user with UID 110, GID 116
  mount -t vboxsf -o uid=110,gid=116 whatever_name /media/actual_mounted_folder
  # ...
SHELL
ThorSummoner
  • 16,657
  • 15
  • 135
  • 147