Problem with raspberry pi (debian) and nfs-kernel-server.
Systemd apparently starts the nfs-kernel-server before rpcbind
has completed starting.
Solution that works for me:
The relevant nfs services are enable and started.
1. Make sure that nfs-kernel-server gets started at boottime.
# systemctl enable nfs-kernel-server.service
After a reboot, nfs is not registered.
# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
2. Create a service that is called after the portmapper is started.
2a. Create a script that runs the start a couple of times.
cd /usr/local/bin/
# echo #!/bin/bash > nfs_kernel_start.sh
# echo service nfs-kernel-server restart >> nfs_kernel_start.sh
# chmod +x /usr/local/bin/nfs_kernel_start.sh
2b. Create the service
Create the following file and content:
/etc/systemd/system/nfs_kernel_start.service
[Unit]
After=nfs_kernel_start.service
[Service]
ExecStart=/usr/local/bin/nfs_kernel_start.sh
[Install]
WantedBy=multi-user.target
Set the correct permissions.
# chmod 644 /etc/systemd/system/nfs_kernel_start.service
3. Enable the service and start it.
# systemctl enable nfs_kernel_start.service
# systemctl start nfs_kernel_start.service
# rpcinfo -p
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049
100227 3 tcp 2049
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
(snipped)