Robert Basic's blog

Enable UDP for NFS on Fedora

by Robert Basic on July 03, 2017.

Recently bringing up Vagrant boxes started acting up when mounting the NFS shared folders. This is the error message I get:

==> 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 /var/www

Stdout from the command:

Stderr from the command:

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

For some reason NFS doesn’t like UDP on my machine, but as far as I know, UDP is the default in Vagrant.

This can be changed by telling Vagrant to not use UDP for synced folders, by adding nfs_udp: false:

  config.vm.synced_folder "./application", "/var/www", type: "nfs", nfs_udp: false

But as this is something only I have experienced in my team so far, “fixing” it on a project level seems like a bad choice. And when the next project comes, I’ll probably have the same problem all over again.

Digging a bit deeper, I’ve came across this ServerFault answer, which says that since nfs-utils version 2.1.1 UDP support for NFS is disabled by default.

The solution is to edit /etc/sysconfig/nfs and add --udp to RPCNFSDARGS:


Restarting the NFS server and Vagrant mounts the shared folders without problems again!

Happy hackin’!

Tags: fedora, nfs, udp.
Categories: Development, Software.

Thanks for reading! If you require help on a PHP project of any kind, let's talk!

To get notified when I write a new blog post or make a new screencast, subscribe:

Recent posts