mitchellh/vagrant — Issue #785: NFS mount failures on OSX
Author: adamsussman
Created: 2012-03-07 22:04:38+00:00
State: open

On OSX, the way vagrant write to /etc/exports is wrong for certain combinations of paths.

Suppose the following configuration:

config.vm.share_folder "foo", "/mymounts/foo", "/foo", :nfs=>true
config.vm.share_folder "foobar", "/mymounts/bar", "/foo/bar", :nfs=>true

This will produce a broken /etc/exports file (broken for OSX anyway) that looks like:

# VAGRANT-BEGIN: 31449f2c-7a8e-4a69-bc1e-77c2dbf4ab92
"/foo" 192.168.42.3 -mapall=502:20
"/foo/bar" 192.168.42.3 -mapall=502:20
# VAGRANT-END: 31449f2c-7a8e-4a69-bc1e-77c2dbf4ab92

This results in permission denied failures when the vagrant image tries to mount both nfs paths. On OSX, subpaths must be combined on the same line as their root in the exports file. Thus, /etc/exports needs to look like:

# VAGRANT-BEGIN: 31449f2c-7a8e-4a69-bc1e-77c2dbf4ab92
"/foo" "/foo/bar" 192.168.42.3 -mapall=502:20
# VAGRANT-END: 31449f2c-7a8e-4a69-bc1e-77c2dbf4ab92