Client cannot mount: “mount.nfs4: Protocol not supported”

nfs4

I am running nfs4 only on both server and client. I am not sure what I changed recently, but I can no longer mount an exported file system which I used to be able to mount. I have just upgraded the client machine from Fedora 31 to 32… but I swear nfs was still working immediately after the upgrade.

At the client end I do:

  # mount /foo
  mount.nfs4: Protocol not supported

The /etc/fstab has not been changed. There is nothing already mounted at /foo. I get the same result issuing mount.nfs4 by hand.

Using wireshark at the client I can see absolutely nothing being sent to the nfs server (or being received from same). Using tcpdump I can see nothing at the server end, from before the client is rebooted to after the attempts to mount. So I'm guessing this is a client issue ?

I can see nothing in the logs. I have failed to find anything to wind up the logging level for client-side mounting.

Can anyone point me at ways to discover what the client is doing (or not doing) ?


As requested…

dmesg mentions of nfs|NFS:

[    7.987799] systemd[1]: Starting Preprocess NFS configuration convertion...
[    7.993220] systemd[1]: nfs-convert.service: Succeeded.
[    7.993342] systemd[1]: Finished Preprocess NFS configuration convertion.
[   12.484481] RPC: Registered tcp NFSv4.1 backchannel transport module.

And fstab on the client:

foo:/ /foo nfs4 noauto,sec=sys,proto=tcp,clientaddr=xx.xx.xx.xx,port=1001  0 0

The client has more than one IP. The server wishes to obscure the fact that it offers nfs. To make that easier it does nfs4 only. FWIW netstat on the server gives (edited for clarity):

Prot  R-Q S-Q  Local Address      Foreign Address  State    PID/Program
tcp    0   0   xx.xx.xx.xx:1001   0.0.0.0:*        LISTEN   -
tcp    0   0   0.0.0.0:111        0.0.0.0:*        LISTEN   1/systemd
tcp    0   0   0.0.0.0:1002       0.0.0.0:*        LISTEN   815/rpc.statd

I thought nfs4 required just the one port… but systemd seems to wake up port 111 anyway. There is also rpc.statd.

The configuration of the server used to work… Also, the client is not sending anything to the server at all on any port !

And the exports on the server:

/ bar(fsid=0,no_subtree_check,sec=sys,rw,no_root_squash,insecure,crossmnt)

Where bar is in the server's \etc\hosts file.

I did showmount -e foo on the client:

clnt_create: RPC: Program not registered

Wireshark tells me that the client poked the server on port 111 asking for MOUNT (100005) Version 3 tcp and received 'no' response. The poke for udp received the same answer. Since the server is configured nfs4 only, I guess this is not a surprise ? I note that showmount does not ask for Version 4… but I don't know if you'd expect it to ?

Best Answer

OK... so I downloaded the source and started poking around with strace.

The problem was that I had been over-enthusiastic in /etc/nfsmount.conf, specifically:

  1. for nfs4 it is a mistake to set any of these:

     mounthost
     mountaddr 
     mountvers
     mountproto
    

    in /etc/nfsmount.conf to anything at all (that includes setting mountvers=4 and setting mountproto=tcp).

    If (like me) you are stupid enough to do this, the code sets errno=EPROTONOSUPPORT and returns an error... as if socket() had failed. [The error reporting mechanics don't seem to be aware of this, and reports the error in a 'default' manner, using strerror().]

  2. it is also a mistake to set mounvers in /etc/nfsmount.conf.

    Again, if (like me) you are stupid enough misspell mountvers and put mounvers=4 in /etc/nfsmount.conf, you will get:

    # mount.nfs4 -v -o noauto,sec=sys,proto=tcp,port=1001 foo:/ /foo
    mount.nfs4: timeout set for Fri Sep 11 16:24:09 2020
    mount.nfs4: trying text-based options 'sec=sys,proto=tcp,port=1001,mounvers=4,vers=4.2,addr=xx,clientaddr=xx'
    mount.nfs4: mount(2): Invalid argument
    ....
    

    ...which is I guess to be expected.

Ah well, I had nothing better to do for a couple of days :-(