How to Enable NFS v2 on Ubuntu 18.04LTS?

I use nfs to copy files from an Ubuntu development machine to an embedded system board. The embedded board uses an older kernel and Linux which is not practical to update. It uses NFS v2 but Ubuntu 18.04LTS has NFS v2 disabled. The process works fine on an older Ubuntu 14.04LTS machine with v2 enabled.

How do I go about enabling NFS v2 on Ubuntu 18.04LTS?

There is a bug in config file. Here are the steps to force and enable NFS version 2 on Ubuntu Linux 18.04 LTS

Step 1 - Edit /etc/default/nfs-kernel-server

Run

sudo vi /etc/default/nfs-kernel-server

Find line

RPCNFSDCOUNT=8

Update/edit as follows to enable NFSv2 on Ubuntu Linux:

RPCNFSDCOUNT="8 -V 2"

Save and close the file.

Step 2 - Restart the NFS service

Simply run:

sudo systemctl restart nfs-kernel-server.service

Step 3 - Verify that NFSv2 has been enabled

Type

cat /proc/fs/nfsd/versions
+2 +3 +4 +4.1 +4.2

+2 means it is enabled. Another option is to run the following to make sure version 2 is enabled:

rpcinfo -p localhost | fgrep nfs
rpcinfo -p SERVER_NAME_IP_HERE | fgrep nfs

Screenshot from 2019-12-04 08-22-07

1 Like

Thank you Vivek! This completely fixed my problem on the updated development system.

I am curious, where did you find these RPCNFSDCOUNT parameters documented? Even having your answer in hand my searching has not turned up anything yet.

I deal with this kind of issues everyday. I had similar problem last year but for another config option (not related to version). I went through startup config source code file and it reads and passed RPCNFSDCOUNT to rpc.mountd. Apart reading source code, I also read man pages. HTH

1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki