Problem with setting up NFS share

I have an encrypted drive on my main desktop that I want to be able to access from my other devices in my local network. I have installed nfs-utils on both my server and client and tried following the arch wiki for nfs setup and when that didn’t work, I tried stuff from this post:

But on the client, I get this still.

$ showmount -e 192.168.0.182
clnt_create: RPC: Unable to receive

My /etc/exports:

# /etc/exports - exports(5) - directories exported to NFS clients
#
# Example for NFSv3:
#  /srv/home        hostname1(rw,sync) hostname2(ro,sync)
# Example for NFSv4:
#  /srv/nfs4	    hostname1(rw,sync,fsid=0)
#  /srv/nfs4/home   hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
#  /srv/nfs4        *(rw,sync,sec=krb5i,fsid=0)
#  /srv/nfs4/home   *(rw,sync,sec=krb5i,nohide)
#
# Use `exportfs -arv` to reload.
/run/media/nym 192.168.0.0/255.255.255.0(rw,subtree_check)
/home/nym/Documents 192.168.0.0/255.255.255.0(rw,sync,no_root_squash,subtree_check)

What am I doing wrong? I get a lot of search results relating to firewall issues, but I tried the commands in the forum post and it didn’t change anything. I don’t think I installed any firewall other than whatever was there by default.

Couple of things:

  • Which version of the NFS server are you running?
  • Is NFS enabled on the host’s firewall? For example, I use firewalld with the home profile. To allow inbound NFS connections, I had to run:
    sudo firewall-cmd --permanent --zone=home --add-service=nfs
    sudo firewall-cmd --complete-reload
    
  • if using nfsv4-server.service, you’ll need to add insecure to your exported shares.

I was using nfs-server at first while following the arch wiki and then I installed nfsv4 on top when trying out the commands in the forum post. The nfs firewall service was already enabled.

Just now, I tried stopping nfs-server.service and leaving nfsv4 running, and adding insecure to /etc/exports, exportfs -arv, but I still get the “RPC: Unable to receive” error when trying showmount.

Also, does host mean client or server? I added nfs service to firewalld on both computers (both are EndeavorOS)

I also ran

firewall-cmd --set-default-zone=home

on both machines because by default it was set to ‘public’

You only need the firewall settings for NFS on the server (host).

(on the server)
What does sudo exportfs -v return?
What about systemctl status nfsv4-server.service?

Does showmount -e on the server show anything?

sudo exportfs -v shows nothing when run.

$ systemctl status nfsv4-server.service

● nfsv4-server.service - NFSv4 server and services
     Loaded: loaded (/usr/lib/systemd/system/nfsv4-server.service; enabled; preset: disabled)
     Active: active (exited) since Thu 2024-08-29 09:12:17 JST; 25min ago
 Invocation: 886c640228024bcdb264cfc1c522de5d
    Process: 5145 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
    Process: 5147 ExecStart=/usr/sbin/rpc.nfsd -N 3 (code=exited, status=0/SUCCESS)
   Main PID: 5147 (code=exited, status=0/SUCCESS)
   Mem peak: 1.5M
        CPU: 6ms

Aug 29 09:12:17 compy systemd[1]: Starting NFSv4 server and services...
Aug 29 09:12:17 compy systemd[1]: Finished NFSv4 server and services.
$ showmount -e
clnt_create: RPC: Program not registered

Without the --permanent switch, this change will reverted at the next reboot.

What command did you run to export the shares? I always use sudo exportfs -arv.

Which command are you referring to?

I used sudo exportfs -arv as well.

Right now I ran yay on both computers. I think my desktop was behind a version of nfs-utils. I’ll reboot and see what happens.

Did not work. Still get the same error when trying showmount

The firewall-cmd command.

To be honest, I’m running out of things to try.

Did the exportfs command showing anything? Mine gives me

exporting 192.168.0.0/24:/media/vms/shared-files

After rebooting:

$ firewall-cmd --get-default-zone
home
$ sudo firewall-cmd --permanent --zone=home --add-service=nfs
Warning: ALREADY_ENABLED: nfs
success
$ sudo exportfs -arv
exporting 192.168.0.0/255.255.255.0:/home/nym/Documents
exporting 192.168.0.0/255.255.255.0:/run/media/nym

I have a minipc running Adguardhome in the background, do you think that could be an issue? I had an nfs share set up in the past and don’t remember doing anything special for that though.

I doubt it, but you can always comment out its share and try exporting again.

I made some progress I think. After doing this:

$ firewall-cmd --permanent --zone=home --add-service=rpc-bind
success
$ sudo firewall-cmd --reload

now running showmount on the client shows this:

rpc mount export: RPC: Unable to receive; errno = No route to host

So I tried stopping firewalld.service on the server, and then showmount -e shows the export list on the client properly.

After that, I tried mounting with the firewall turned off:

$ sudo mount -t nfs 192.168.0.182:/run/media/nym /run/media/nfs-share -v
mount.nfs: timeout set for Wed Aug 28 22:43:00 2024
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.0.182,clientaddr=192.168.0.156'
mount.nfs: mount(2): Connection refused
mount.nfs: trying text-based options 'addr=192.168.0.182'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.0.182,clientaddr=192.168.0.156'

And then it just continues looping the same messages.

Also, idk why the firewall is an issue, since I have both the nfs and rpc-bind services enabled on it.

In order to mount, I had to make sure to use nfsv4-server.service. The nfs-server service wasn’t working.

As for the firewall thing, I had it off while testing and successfully mounting the nfs share on two different devices. After re-enabling the firewall, my laptop still mounted the nfs share successfully on reboot via fstab. Although, I have a feeling things will break again for whatever reason.

Another day passed, and the NFS share continues to work after multiple reboots of the various devices. Thank you for your help.

1 Like

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