Nfs not starting properly

Having had some issues with playback of files from a locally mounted NFS-share (on /mnt/media) I came across the below. Not sure if this is a problem, but it bothers me.
After a reboot this shows up in the journal:

Nov 25 17:36:43 osmc kernel: FS-Cache: Netfs 'nfs' registered for caching
Nov 25 17:36:43 osmc nfs-common[163]: Starting NFS common utilities: statd
Nov 25 17:36:43 osmc nfs-common[163]: Not starting: portmapper is not running ... (warning).
Nov 25 17:36:47 osmc systemd[1]: Starting LSB: RPC portmapper replacement...
Nov 25 17:36:47 osmc systemd[1]: Started LSB: RPC portmapper replacement.

which seems very unfortunate. Because when I do systemctl restart nfs-common, this gets added:

Nov 25 17:41:03 osmc sudo[946]: osmc : TTY=pts/0 ; PWD=/home/osmc ; USER=root ; COMMAND=/bin/systemctl restart nfs-common
Nov 25 17:41:03 osmc nfs-common[949]: Stopping NFS common utilities: idmapd statd.
Nov 25 17:41:03 osmc kernel: Installing knfsd (copyright (C) 1996
Nov 25 17:41:03 osmc nfs-common[958]: Starting NFS common utilities: statd idmapd.

So, by default idmapd doesn’t get started because portmapper starts after nfs-common. This could potentially cause problems for some people. Not sure if it affects my issues, as they tend to be sporadic. But, it might be something you might want to look into.
Hope this helps.

P.S. Pending a fix in OSMC/Kodi I plan on restarting the nfs-common service after reboot using a cron job to reanimate idmapd.

This is a known issue.

It stems from systemd not being able to cope properly with legacy init.d boot scripts (*) and it starts the nfs server before it starts rpc and therefore nfs server doesn’t work.

You can either add a delay (sleep 20) to the init.d script for nfs-kernel or you can add a sleep/restart nfs statement to /etc/rc.local/ by adding the following lines just above exit(0)

sleep 20
systemctl restart nfs-common

(*) Many would argue that this is the other way round, but who’s fault it is is rather a moot point: nfs-server is fundamentally broken in debian whoeve’s fault it is.

1 Like

Thanks. Will try that.

nfs-server is fundamentally broken in debian whoeve’s fault it is.

This is a pity as I was also planning on building a Raspbian based fileserver. Guess I’ll have to look into Arch for that then.

EDIT: adjusting the init.d script didn’t work. Systemd just waits for that to finish before it starts the port mapper :confused: But the rc.local was succesful. :slight_smile: Thanks again.

It’s broken in every distribution which uses systemd.

[quote=“Mausy5043, post:3, topic:20460”]But the rc.local was succesful. :slight_smile:

Glad you got it working.

@#%^&%&^$%@$#@ systemd :rage: