ehough / docker-nfs-server

A lightweight, robust, flexible, and containerized NFS server.
https://hub.docker.com/r/erichough/nfs-server/
GNU General Public License v3.0
669 stars 221 forks source link

rpcbind.target need to be disabled and stopped before start nfs-server container #73

Closed jeffguorg closed 2 years ago

jeffguorg commented 2 years ago

rpc.statd is found to be started automatically by default on CentOS 7 hosts and is blocking nfs-server from starting.

normally nfs-server starts a rpc.statd when it prints starting rpc.nfsd on port 2049 with 8 server thread(s)

+ echo '----> starting rpc.nfsd on port 2049 with 8 server thread(s)'
----> starting rpc.nfsd on port 2049 with 8 server thread(s)
+ /usr/sbin/rpc.nfsd --tcp --udp --port 2049 --nfs-version 4.2 --no-nfs-version 2 8 --debug
rpc.nfsd: knfsd is currently down
rpc.nfsd: Writing version string to kernel: -2 +3 +4 +4.1 +4.2

but sometimes it prints

----> starting rpc.statd on port 32765 (outgoing from port 32766)
+ /usr/sbin/rpc.nfsd --tcp --udp --port 2049 --nfs-version 4.2 --no-nfs-version 2 8
Statd service already running!

and the container fails to start

there is no [nfsd] process and i tried systemctl disable --now rpc-statd. but it doesn't help. finally i found that i need to completely disable the whole rpcbind.target

systemctl disable --now rpcbind.target

and then it works like a charm

I have not tested, but the target status still shows that it is enabled? maybe i misunderstood this.

systemctl status rpcbind.target
● rpcbind.target - RPC Port Mapper
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.target; static; vendor preset: enabled)
   Active: inactive (dead) since Wed 2022-04-13 14:02:08 CST; 15min ago
     Docs: man:systemd.special(7)

Apr 13 14:02:08 master1 systemd[1]: Stopped target RPC Port Mapper.

anyway i masked the target to prevent it from starting again

systemctl mask rpcbind.target
Created symlink from /etc/systemd/system/rpcbind.target to /dev/null.

it is not a bug but rather a problem about system configuration, thus i'm closing it immediately. i put it here in case somebody has similar problem. wish it could help someone else