nfsmount: rpc failed: 2

Posté le mar. 04 avril 2017 dans blog

For those, here on the internet, asking themselves what is this fscking rpc failed: 2 while mounting an NFS, it's possible that the response is here: Your NFS client trying to mount the NFS share will use RPC to communicate with the serveur, il will go like:

> PORTMAP GETPORT(Program: NFS, Version: 3, Proto: TCP)
< PORTMAP Port: 2049
> PORTMAP GETPORT(Program: MOUNT, Version: 3, Proto: TCP)
< PORTMAP Port 49066
> MOUNT MNT(Program Version: 3, Path: /srv/nfsroot/ )
< MOUNT Reply error 2, "remote can't support version \#", Program Version (Minimum): 1, Program Version (Maximum): 2

You can see that the response is "remote can't support version #" and we should have found this solution in the RFC 1831 (RPCv2):

 Given that a call message was accepted, the following is the status
  of an attempt to call a remote procedure.

     enum accept_stat {
        SUCCESS       = 0, /* RPC executed successfully             */
        PROG_UNAVAIL  = 1, /* remote hasn't exported program        */
        PROG_MISMATCH = 2, /* remote can't support version #        */
        PROC_UNAVAIL  = 3, /* program can't support procedure       */
        GARBAGE_ARGS  = 4, /* procedure can't decode params         */
        SYSTEM_ERR    = 5  /* errors like memory allocation failure */
     };

So the problem is you client asking for a NFS version greater that your server runs... but if your server is running NFS v3, check a ps aux | grep \[r\]pc.mountd\ for: root 1411 0.0 0.0 18808 1036 ? Ss Apr15 0:00 /usr/sbin/rpc.mountd --manage-gids --no-nfs-version 3 Did you catch the --no-nfs-version 3? If your server is compiled with NFSv3 support, drop the --no-nfs-version 3 in your configuration and it should work!

Enjoy!