Using NFS with vagrant doesn't work

user156888 picture user156888 · Nov 23, 2014 · Viewed 7k times · Source

I have the following in my Vagrantfile:

config.vm.network :private_network, ip: "10.0.0.103"
config.vm.synced_folder ".", "/vagrant/", type: "nfs"

doing vagrant up on a fresh box yields:

==> 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 -o 'vers=3,udp' 10.0.0.1:'/Users/wayne/app' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: access denied by server while mounting 10.0.0.1:/Users/wayne/app

I then need to vagrant reload and it seems to work... But surely I shouldn't have to do this?

[updated: log output]

INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o 'vers=3,udp' 10.0.0.1:'/Users/wayne/sonatribe' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: requested NFS version or transport protocol is not supported
>
 INFO ssh: Execute: mount -o 'vers=3,udp' 10.0.0.1:'/Users/wayne/sonatribe' /vagrant (sudo=true)
 INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o 'vers=3,udp' 10.0.0.1:'/Users/wayne/sonatribe' /vagrant

Stdout from the command:



Stderr from the command:

stdin: is not a tty
mount.nfs: requested NFS version or transport protocol is not supported

Answer

Oleksandr Fedorov picture Oleksandr Fedorov · Mar 11, 2016

For Linux I do this in the host machine:

systemctl stop nfs-kernel-server.service
systemctl disable nfs-kernel-server.service
systemctl enable nfs-kernel-server.service
systemctl start nfs-kernel-server.service