5

I have attempted to install nfs on my Pi3 running Raspbian

I have installed:-

sudo apt-get install rpcbind nfs-kernel-server

Added to /etc/exports

/var/www    *(rw,fsid=0,sync)
/home   *(rw,sync,no_subtree_check)

Run sudo exportfs

I have enabled:-

sudo systemctl enable rpcbind.service
sudo systemctl enable nfs-kernel-server

I can mount on a Ubuntu machine with:-

sudo mount -v -o noatime -t nfs 10.1.1.41:/home/pi ~/test

Unfortunately when I reboot Raspbian the nfs-kernel-server.service does not start.

systemctl status nfs-kernel-server.service
● nfs-kernel-server.service - LSB: Kernel NFS server support
   Loaded: loaded (/etc/init.d/nfs-kernel-server)
   Active: active (exited) since Tue 2017-03-07 23:09:48 AEDT; 1 day 14h ago
  Process: 527 ExecStart=/etc/init.d/nfs-kernel-server start (code=exited, status=0/SUCCESS)

and I need to manually restart with:-

sudo systemctl restart nfs-kernel-server.service

I have seen a few reports of similar problems by others, but none with solutions.

2
  • 2
    Did you look at /var/log/kern.log and /var/log/daemon.log for messages regarding nfs/nfsd?
    – ridgy
    Mar 10, 2017 at 9:48
  • According to your output, the service does start and run successfully, exiting with "SUCCESS": Process: 527 ExecStart=/etc/init.d/nfs-kernel-server start (code=exited, status=0/SUCCESS) Mar 10, 2017 at 14:30

2 Answers 2

4

This is a known problem in Debian and not even specific to the Pi. The problem goes way back to the time when Debian changed from the init system to systemd. The dependencies between nfs-kernel-server and rpcbind are not correctly defined. Debian/Raspbian still runs the old init.d scripts. The simpliest way out for me was to insert a

start)
sleep 30   # this line is to be inserted!
export_files="/etc/export"

in /etc/init.d/nfs-kernel-server. It was in line #63 on my system. The hint came from https://discourse.osmc.tv/t/nfs-kernel-server-wont-start-on-boot/5936/7. I had the problem on a Beagleboneblack and the sleep statement solved it for me.

2
  • Thanks, it explains nfs-kernel-server[502]: Not starting: portmapper is not running however the sleep did not fix it.
    – Milliways
    Apr 26, 2017 at 6:19
  • perhaps you can have a look into the systemd units and can fix it? From what I read you seem to be a guy with the necessary knowledge and the time? ;-) Apr 26, 2017 at 16:09
0

To cleanup this old post.

The Jessie systemd service had a known bug, but this is now fixed.

The only thing you have to do under Stretch is install nfs-kernel-server - this now seems to have a proper systemd service, and rpcbind is now included by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .