Univention Bugzilla – Bug 45101
NFS server not (re)started with systemd
Last modified: 2018-06-22 15:56:49 CEST
The listener module services/univention-nfs/nfs-shares.py contains this:
202 def postrun():
203 »···initscript = '/etc/init.d/nfs-kernel-server'
204 »···listener.run(initscript, ['nfs-kernel-server', 'start'], uid=0)
205 »···listener.run(initscript, ['nfs-kernel-server', 'reload'], uid=0)
with systemd that does not work, as systemd unit nfs-kernel-server.serice is delegated to the SysV-init script /etc/init.d/nfs-kernel-server, which exists with 0 when not share is defines:
74 if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' $export_files
150 log_warning_msg "Not starting $DESC: no exports."
systemd then considers the unit as started:
>root@dc0:/# /etc/init.d/nfs-kernel-server status
>● nfs-kernel-server.service - LSB: Kernel NFS server support
> Loaded: loaded (/etc/init.d/nfs-kernel-server)
> Active: active (exited) since Mo 2017-06-19 16:14:31 CEST; 1 months 8 days ago
> Process: 25163 ExecReload=/etc/init.d/nfs-kernel-server reload (code=exited, status=0/SUCCESS)
>Jul 28 16:27:36 dc0 nfs-kernel-server: Not starting NFS kernel daemon: no exports. ... (warning).
>Jul 28 16:27:36 dc0 systemd: Started LSB: Kernel NFS server support.
So line 204 does nothing and the service remains not started and the reload in line 205 goes to nirvana.
Also note that `/etc/init.d/nfs-kernel-server status` is bogus here: It returns the status of the *systemd unit*, but does *not* call the init script to check for any *nfsd* process!
CHANGES WITH systemd-229:
* "systemctl reload-or-try-restart" has been renamed to "systemctl
try-reload-or-restart" to clarify what it actually does: the "try"
logic applies to both reloading and restarting, not just restarting.
The old name continues to be accepted for compatibility.
r81559 | Bug #45101 NFS: Fix /etc/exports generation
r81558 | Bug #45101 NFS: Fix pickling
r81557 | Bug #45101 NFS: Merge duplicate file code
r81556 | Bug #45101 NFS: Remove useless gobal declaration
r81554 | Bug #45101 NFS: Start NFS server for first NFS share
r81561 | Bug #32272,Bug #33254,Bug #45101,Bug #25446 NFS. YAML
There was a broken test case in 53_samba-common which checked the generated /etc/exports. I moved the test case into 49_nfs and fixed it.
r81584: move nfs test from samba section into nfs section
r81585: Fix and move nfs options test
What I tested:
Added a share. -> OK
Deleted a share and readded one. -> OK
Reboot -> OK
YAML -> OK
Deleting the last share does not stop the nfs server any more. I don't think that is a problem.