8

According to Red Hat docs 'rpcbind' is not required any more:

Because protocol support has been incorporated into the v4 protocol, NFSv4 has no interaction with the portmap, rpc.lockd, and rpc.statd daemons. NFSv4 listens on the well-known TCP port 2049, which eliminates the need for portmap interaction. The mounting and locking protocols have been incorporated into the V4 protocol which eliminates the need for interaction with rpc.lockd and rpc.statd. The rpc.mountd daemon is still required on the server, but is not involved in any over-the-wire operations.

however I'm not able to start NFS demon when 'rpcbind' service is not running:

# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
                                                           [FAILED]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
                                                           [FAILED]

I've disabled NFS v2 and v3:

# grep -v "^#" /etc/sysconfig/nfs
MOUNTD_NFS_V2="no"
MOUNTD_NFS_V3="no"
RPCNFSDARGS="-N 2 -N 3"

Could you please confirm what services are required/essential on server and client from these listed below (basically I would like to disable services which are not needed):

# rpm -ql nfs-utils | grep 'init.d'
/etc/rc.d/init.d/nfs
/etc/rc.d/init.d/nfslock
/etc/rc.d/init.d/rpcgssd
/etc/rc.d/init.d/rpcidmapd
/etc/rc.d/init.d/rpcsvcgssd
HTF
  • 3,050
  • 14
  • 49
  • 78
  • Did you configure your firewall to allow nfs ? – user9517 Aug 14 '13 at 13:01
  • Yes, I can mount NFS exports on client but I wonder why I still need to use `rpcbind` with v4 – HTF Aug 14 '13 at 14:03
  • 3
    NFSv4 doesn't require rpcbind. But there are clients and tools around which still depend on that information, for example 'showmount'. Additionally, Linux nfsd uses /proc/fs/nfsd/portlist file to communicate port number to rpcbind, and this file somehow depends on running rpcbind process. – kofemann Aug 15 '13 at 07:08
  • I can verify this problem on Debian 7 with kernel 3.3.2 by adding `-N 2 -N 3` to `rpc.nfsd` in the start script and getting the same error "unable to set any sockets for nfsd" – Tankman六四 Jun 28 '19 at 08:08

3 Answers3

10

This was a bug in NFS server kernel module. It was patched in December 2013.

Starting with kernel 3.14, rpcbind is no longer required to run in-kernel NFS server.

(assuming that server is configured to use only NFSv4 and higher)

http://lxr.free-electrons.com/source/net/sunrpc/svc.c?v=3.14#L966

You can find more information about that change in this thread:

http://www.spinics.net/lists/linux-nfs/msg41053.html

Therefore, your configuration:

MOUNTD_NFS_V2="no"
MOUNTD_NFS_V3="no"
RPCNFSDARGS="-N 2 -N 3"

should now work without rpcbind.

When you use only NFSv4, none of these services are required:

/etc/rc.d/init.d/nfslock
/etc/rc.d/init.d/rpcgssd
/etc/rc.d/init.d/rpcidmapd
/etc/rc.d/init.d/rpcsvcgssd
starfry
  • 561
  • 1
  • 7
  • 13
0

The quoted documentation from RedHat was wrong and got fixed by Bug 521215: rpc.mountd still must be used to setup NFSv4, but strictly speaking it is not required to be running after that.

  • nfs: Server for all versions of NFS: v2, v3, v4, v4.1
  • rpcbind/portmapper: Server, strictly only for NFS <= v3. But also for NFS v4 as the Linux Kernel NFS server tries to register itself and fails to start if rpcbind is not running.
  • rpc.mountd: Server, strictly only for NFS <=3. But also for NFS v4 as the Linux Kernel uses it to check, if the connecting client is allowed to connect.
  • nfslock: Server only for NFS <= v3
  • rpc.idmapd: Optional Server (and older Clients) for NFS v4
  • rpc.quotad: Server for using disk quota
  • rpc.statd: Server only for NFS <= v3

When using Kerberos (sec=krb/krb5i/krb5p) the following services are required:

  • rpc.gssd: Client
  • rpc.svcgssd: Server

Please note that even they carry rpc. in their name, they use the Linux kernel internal mechanism rpc_pipef for communication between the Linux kernel and the user space helper; so rpcbind AKA portmapper is not needed for them.

pmhahn
  • 96
  • 7
-3

Check rpcbind service. If it stopped working start and then try starting nfs service.

service rpcbind start
service nfs start
peterh
  • 4,914
  • 13
  • 29
  • 44
  • This answer is very low quality. OP has stated rpcbind was not required since nfsv4. The question has already been answered : it was a kernel bug. – bgtvfr Aug 14 '17 at 14:41