Difficulties getting NFS server to work

Hello, it's me again :slight_smile:

Now I have struggles to export anything via NFS.

I followed the docs (https://openwrt.org/docs/guide-user/services/nas/nfs.server).

The firewall is disabled.

All processes are up, ports are open:

root@nas-backup:/etc/config# ps | grep rpc
 1132 root         0 IW<  [rpciod]
 1337 root      2000 S    /sbin/rpcd -s /var/run/ubus/ubus.sock -t 30
 1536 rpc       1140 S    /usr/sbin/rpcbind -f -w
 2232 root      1004 S    /usr/sbin/rpc.statd -p 32778 -o 32779 -F
 2233 root      1528 S    /usr/sbin/rpc.mountd -p 32780 -F
 3560 root      1108 S    grep rpc
root@nas-backup:/etc/config# ps | grep nfs
 1142 root         0 IW<  [nfsiod]
 2221 root         0 SW   [nfsd]
 2222 root         0 SW   [nfsd]
 2223 root         0 SW   [nfsd]
 2224 root         0 SW   [nfsd]
 2225 root         0 SW   [nfsd]
 2226 root         0 SW   [nfsd]
 2227 root         0 SW   [nfsd]
 2228 root         0 SW   [nfsd]
 3562 root      1108 S    grep nfs
root@nas-backup:/etc/config# netstat -nlpu | grep rpcbind
udp        0      0 0.0.0.0:53591           0.0.0.0:*                           1536/rpcbind
udp        0      0 0.0.0.0:111             0.0.0.0:*                           1536/rpcbind
udp        0      0 :::111                  :::*                                1536/rpcbind
udp        0      0 :::52895                :::*                                1536/rpcbind
root@nas-backup:/etc/config# 

After setting up, trying out and debugging my own exports I simply tried out the loopback example mentioned in the documentation by copying and pasting it straight into the terminal window.

In all cases I get the same thing: The mount command "hangs" and does nothing.

Trying out "vers=3" does not make things better (local on the box it says "unsupported protocol version" though NFS3 should be supported as said in the documentation [or does the mount.nfs command only support Version 4 but the server does it all?], from remote it still hangs).

Do you have any suggestions?

EDIT: When I try out my own setup (from remote) I get

daemon.notice rpc.mountd[2233]: authenticated mount request from 10.1.10.15:910 for /data/serverbackups (/data/serverbackups)

in the logs.

I also played a lot with exporting my disks using /overlay/upper/... because of

If you set up pivot-root or pivot-overlay, use the path on /overlay/ partition, else you cannot export mounted fs.

(what exactly does this mean?) but stopped that after I found out that even the simple loopback example does not work.

OK, NFS seems to be an issue with newer OpenWRT versions and not a functionality which is focused by development.
I found lots of users complaining that NFS stopped working after upgrade or that after a fresh installation they don't get NFS to work. But in the cases I was able to find (also in this forum which in general is a very big help and has a great community as I can tell) no really solution or discussion on those threads took place.
So in the end I gave up and use sshfs instead.
What a pity! I am running two Ubuntu servers and several clients with NFS for years and don't get it to work on my new OpenWRT device.
Perhaps in the next release :wink:

I wanted to actually test a Samba server, but since I saw this problem I decided to use a NFS server.

Fresh compiled "master", loop-device was already selected for testing DM-Crypt so I only added nfs-server and nfs-utils (not sure they are needed).

Works just fine when exporting external usb hard drive or an sd-card (mmc). Untweaked I am getting around 9MB/s so I should look into that. Might be a slow SD-card or the fact that I am using dm-crypt on the external drive.

BUT: file transfer back and forth between OpenWRT as server and my linux box works just fine.

I have no experience with exporting the Overlayfs, but since that didn't change and you had that working before, those settings should be the same as before.

I'm running a NFS server to access a data partition on a SD card resp. USB stick on my OpenWRT routers since 15.X. and never had a problem with NFS.

Just remember: for proper operation the configuration on server and client must fit together.

Thank you for your replies!

@drbrains :
I didn't compile from source but installed the latest release which was available last week (OpenWrt 21.02.0 r16279-5cc0535800). So if it works in the master branch perhaps the next release will fix something?

@Barney :
Keep in mind that I followed the installation and setup instructions for NFS on a fresh system and even the local mount which is mentioned in the doc as a test did not work.
So I don't think there is an incompatible configuration between server and client :slight_smile:

But when anyone has an idea how to fix this issue I would be very thankful :wink:
Per now my backup works using sshfs and so I have no actual use case, but having it up and running is no bad idea in an complete Linux environment :wink:

Simple setup (for demo purposes, not the most secure!)

ssh into your router:

ssh root@192.168.1.1

create a mount point and set rights:

mkdir /tmp/nfsdemo
chmod 1777 /tmp/nfsdemo

edit and save exports file:

vi /etc/exports

Make it look like:

/tmp/nfsdemo *(rw,no_all_squash,insecure,no_subtree_check,fsid=1)

update new exports

exportfs -ra

On another linux box:

sudo mkdir /mnt/nfsdemo
sudo mount -t nfs 192.168.1.1:/tmp/nfsdemo

try to see if it works:

echo test >/mnt/nfsdemo/test.txt

SSH back into the router:

Verify your test file was written and can be read on the router.
cat /tmp/nfsdemo/test.txt

1 Like

I haven't read these instructions, so can't say anything about their correctness.

I've set up many NFS systems (client & server) during the last decades and never had a problem with NFS. It just worked out of the box. But I must admit, that all these systems have been Linux hosts. I have no experience, if one part (either server or client) is a non-Linux host.

So instead of reading OpenWRT's NFS instructions I was guided by my previous Linux NFS experience and I configured the NFS server on the OpenWRT router the same way I did on a Linux host. And it worked.

Maybe, I don't know. But there is definitely something wrong with your NFS configuration (either on the server or the client or both). Otherwise it should work.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.