Debian or Raspbian: nfs-kernel-server not starting portmapper is not running … (warning) rpcbind.target
Here is my first try, but it doesn’t work for me. It just reset the configs. So if you messed it up, try this first.
apt-get purge rpcbind nfs-kernel-server nfs-common apt-get install nfs-kernel-server
Now check the service startup dependencies by command below. And make sure you find
rpcbind before nfs service.
systemctl list-dependencies nfs-kernel-server.service
If it is not, unfortunately you should try purge and install them again as mentioned above, which should fixes the dependency issue and will also remove the config files, like
/etc/exports. Backup it in advance if necessary!
Next, I have a look into
/etc/init.d/nfs-kernel-server and find its start level is 2 3 4 5. However,
rpcbind have differenct run level, I change it to the same, i.e. 2 3 4 5.
# Have a look at these files' runlevel /etc/init.d/nfs-kernel-server /etc/init.d/nfs-common /etc/init.d/rpcbind
This is the runlevel of
### BEGIN INIT INFO # Provides: nfs-kernel-server # Required-Start: $remote_fs nfs-common $portmap $time # Required-Stop: $remote_fs nfs-common $portmap $time # Should-Start: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Kernel NFS server support # Description: NFS is a popular protocol for file sharing across # TCP/IP networks. This service provides NFS server # functionality, which is configured via the # /etc/exports file. ### END INIT INFO
Then try to
update-rc.d the changed init scripts with defaults. First try fails. The trick is to remove and add them again.
update-rc.d -f rpcbind remove update-rc.d rpcbind defaults update-rc.d -f nfs-common remove update-rc.d nfs-common defaults update-rc.d -f nfs-kernel-server remove update-rc.d nfs-kernel-server defaults
After that, check the order of the services. It should be rpcbind, nfs-common, and nfs-kernel-server.
Reboot the server, it works for me now! Cheers!