The Problem
Attempting to start the NFS (nfs-server.service) on CentOS/RHEL 7 fails as follows:
# systemctl status nfs-server.service
nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
'-order-with-mounts.conf
Active: inactive (dead)
Mar 09 16:17:10 hostname systemd[1]: Dependency failed for NFS server and services.
Mar 09 16:17:10 hostname systemd[1]: nfs-server.service: Job nfs-server.service/start failed with result 'dependency'.
The following is also reported to the system log – /var/log/messages:
Mar 9 16:47:34 hostname systemd[1]: nfsdcld.service: Job nfsdcld.service/start failed with result 'dependency'. Mar 9 16:48:23 hostname systemd[1]: proc-fs-nfsd.mount: Directory /proc/fs/nfsd to mount over is not empty, mounting anyway. Mar 9 16:48:23 hostname mount[1889835]: mount: /proc/fs/nfsd: nfsd already mounted on /proc/fs/nfsd. Mar 9 16:48:23 hostname systemd[1]: proc-fs-nfsd.mount: Mount process exited, code=exited status=32 Mar 9 16:48:23 hostname systemd[1]: proc-fs-nfsd.mount: Failed with result 'exit-code'. Mar 9 16:48:23 hostname systemd[1]: nfsdcld.service: Job nfsdcld.service/start failed with result 'dependency'.
The Solution
The nfs-server.service requires and mounts procfs filesystem /proc/fs/nfsd. If filesystem /proc/fs/nfsd is already mounted i.e. not previously umounted, the nfs-server.service fails to start as described.
Follow the stpes outlined below to resolve the issue.
1. Manually unmount /proc/fs/nfsd:
# umount /proc/fs/nfsd
2. Start the NFS service:
# systemctl start nfs-server.service