Vagrant: Vagrant up results in mount.nfs: Connection timed out

Created on 20 Nov 2019  ยท  5Comments  ยท  Source: hashicorp/vagrant

I have looked at quite a few solutions that somehow does not fix my problem.
I have given Full Disk Access to /sbin/nfsd as well as /sbin/mount
I have disabled System Integrity Protection

System/App Versions
Catalina 10.15.1
Vagrant 2.2.6
VirtualBox 6.0.14 r133895

Here is the error message:

==> mysite: Exporting NFS shared folders...
==> mysite: Preparing to edit /etc/exports. Administrator privileges will be required...
==> mysite: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp 192.168.33.1:/System/Volumes/Data/Users/myname/Git/mysite.com/src /var/www/mysite
Stdout from the command
Stderr from the command:
mount.nfs: Connection timed out

Here is my /etc/exports

#VAGRANT-BEGIN: 501 51443dd7-0e88-4076-8bb8-4575ec96048d
/System/Volumes/Data/Users/myname/Git/mysite.com /System/Volumes/Data/Users/myname/Git/mysite.com/src -alldirs -mapall=501:20 192.168.33.3
#VAGRANT-END: 501 51443dd7-0e88-4076-8bb8-4575ec96048d

Here is my Vagrantfile portion for mounting my folder

if (/darwin/ =~ RUBY_PLATFORM) != nil
config.vm.synced_folder ".", ansible_configs['project_root'], type: "nfs"
config.vm.synced_folder "./src", ansible_configs['project_src'], type: "nfs"
else
config.vm.synced_folder ".", ansible_configs['project_root'], type: "nfs", :linux__nfs_options => ["rw","no_root_squash","no_subtree_check"]
config.vm.synced_folder "./src", ansible_configs['project_src'], type: "nfs", :linux__nfs_options => ["rw","no_root_squash","no_subtree_check"]
end

And here is my config variables

project_name: mysite
project_root: /home/vagrant/sync
project_src: /var/www/mysite

host_name: mysite.local
doc_root: "{{project_src}}/html"

# build file config
client_name: mysite-01

ssh_user: myname
ssh_key_path: /Users/{{ ssh_user }}/.ssh/id_rsa

# create new project and download abt core
# set to false after initial project has been created
create_project: false

Any advice or guidance on what direction to take at this point is very much appreciated.

hosdarwin providevirtualbox synced-foldernfs

Most helpful comment

Hi @socalheel , and thanks for opening an issue with Vagrant!

We are looking at a few issues surrounding NFS mount points on macOS Catalina. If it's possible, one workaround until we can get a fix shipped is to add the nfs_export: false option to each NFS mount and manually edit /etc/exports to suit your needs.

For example, with the follow Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise32"
  config.vm.network "private_network", ip: "192.168.33.3"
  config.vm.synced_folder ".", "/home/vagrant/sync", type: "nfs", nfs_export: false
  config.vm.synced_folder "./src", "/var/www/mysite", type: "nfs", nfs_export: false
end

/etc/exports should have the full path to each shared folder on its own line:

/System/Volumes/Data/Users/myname/Git/mysite.com -alldirs -mapall=501:20 192.168.33.3
/System/Volumes/Data/Users/myname/Git/mysite.com/src -alldirs -mapall=501:20 192.168.33.3

This ties into the workaround that @JensBourgeois mentioned.

Hope this helps. Also, can you please tell me what guest you're using?

Thanks!

All 5 comments

I had the same problem, was caused by 2 exports on the same line. Removing one of them and copying the folder over manually fixed the problem for me.

See: https://github.com/hashicorp/vagrant/issues/10961#issuecomment-555777091

Hi @socalheel , and thanks for opening an issue with Vagrant!

We are looking at a few issues surrounding NFS mount points on macOS Catalina. If it's possible, one workaround until we can get a fix shipped is to add the nfs_export: false option to each NFS mount and manually edit /etc/exports to suit your needs.

For example, with the follow Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise32"
  config.vm.network "private_network", ip: "192.168.33.3"
  config.vm.synced_folder ".", "/home/vagrant/sync", type: "nfs", nfs_export: false
  config.vm.synced_folder "./src", "/var/www/mysite", type: "nfs", nfs_export: false
end

/etc/exports should have the full path to each shared folder on its own line:

/System/Volumes/Data/Users/myname/Git/mysite.com -alldirs -mapall=501:20 192.168.33.3
/System/Volumes/Data/Users/myname/Git/mysite.com/src -alldirs -mapall=501:20 192.168.33.3

This ties into the workaround that @JensBourgeois mentioned.

Hope this helps. Also, can you please tell me what guest you're using?

Thanks!

Hi all, I've just merged a PR into the master branch that makes the change: https://github.com/hashicorp/vagrant/issues/11216. It should be fixed in the next release.

Closing this as the change went out with Vagrant 2.2.7 -- if anyone sees additional issues with NFS mounts on macOS Catalina, please open a new issue. Thanks!

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefanScherer picture StefanScherer  ยท  3Comments

rrzaripov picture rrzaripov  ยท  3Comments

Cbeck527 picture Cbeck527  ยท  3Comments

barkingfoodog picture barkingfoodog  ยท  3Comments

hesco picture hesco  ยท  3Comments