I have a FreeBSD Vagrant box that looks like this:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/freebsd-10.0"
config.vm.network "private_network", ip: "10.0.1.10"
config.vm.synced_folder '.', '/vagrant', :nfs => true, id: "vagrant-root"
end
However, if it tries to run in a directory path with too long a name it fails:
==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -t nfs '10.0.1.1:/Users/petersouter/projects/reallylongpathnameover88characterssothatmountfswillfail12345678910111213141516' '/vagrant'
Stdout from the command:
Stderr from the command:
mount_nfs: 10.0.1.1:/Users/petersouter/projects/reallylongpathnameover88characterssothatmountfswillfail12345678910111213141516: File name too long
Is there a way to resolve this other than copying the directory to one with a shorter name? Can I update FreeBSD stuff so it can accept larger file names?
FreeBSD limits the length of mount point names to 88 chars. The reasons for this are somewhat esoteric, but has to do with aligning a memory structure on page boundaries[1].
You can patch the mount binary to use a larger limit or to remove it all together[2] but this may cause crashes. I have successfully removed the check (also for vagrant with nfs) and had it work without problems, but do so at your own risk. I did not do a full buildworld but rebuilt only the mount_nfs binary with the patch from the second link.
As a final note, I eventually decided that vagrant with nfs is too buggy and switched to using rsync shared folders instead.
[1] http://www.secnetix.de/olli/FreeBSD/mnamelen.hawk
[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=167105