[Bug 284262] nfsd fails to start with nfsv4_server_only but without rpcbind/mountd

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 22 Jan 2025 15:32:55 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284262

            Bug ID: 284262
           Summary: nfsd fails to start with nfsv4_server_only but without
                    rpcbind/mountd
           Product: Base System
           Version: 14.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: conf
          Assignee: bugs@FreeBSD.org
          Reporter: t@ida2.de

Hi,

I've struggled while setting up an NFS4 only server without rpcbind. While
reading the documentation my impression was:
* nfs4 server does not need rpcbind (turns out to be true)
* nfs4 server does not need mountd (turns out to be partially true)

So I've set up in rc.conf:
nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsv4_server_only="YES"

nfsd fails to start then, see /var/log/daemon.log:
Jan 22 16:20:40 hostname nfsd[10726]: rpcb_set udp failed
Jan 22 16:20:40 hostname nfsd[10726]: rpcb_unset failed

Looking at the start scripts for nfsd and mountd I've noticed:

The nfsd script sets vfs.nfsd.server_max_nfsvers=4 if nfsv4_server_enable is
set, but does nothing more for nfsv4_server_only. I actually guess there should
vfs.nfsd.server_min_nfsvers=4 be set. See:

        if checkyesno nfsv4_server_enable; then
                sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
        elif ! checkyesno nfsv4_server_only; then
                echo 'NFSv4 is disabled'
                sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
        fi

        if ! checkyesno nfsv4_server_only; then
                force_depend rpcbind || return 1
        fi

Then in the mountd script there is it:
        if checkyesno nfsv4_server_only; then
                echo 'NFSv4 only server'
                sysctl vfs.nfsd.server_min_nfsvers=4 > /dev/null
                sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
                rc_flags="${rc_flags} -R"


So these questions arise:
* Why are these settings made in mountd script instead of nfsd script?
* If for a nfsv4_server_only the mountd is only needed to read the exports file
and can be exited afterwards, why should it run as daemon forever afterwards?

-- 
You are receiving this mail because:
You are the assignee for the bug.