Bug 1066959 - nfs-server.service needs to be started twice
Summary: nfs-server.service needs to be started twice
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: nfs-utils
Version: 20
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Steve Dickson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1119225 1258133
TreeView+ depends on / blocked
 
Reported: 2014-02-19 11:40 UTC by Andrew
Modified: 2015-08-29 12:55 UTC (History)
13 users (show)

Fixed In Version: nfs-utils-1.3.0-2.2.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-01 14:15:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andrew 2014-02-19 11:40:43 UTC
Problem: it's not enough to issue 'systemctl start nfs-server.service' once to bring up NFSD. It's necessary to do it twice to bring NFS to work.

Seems like it doesn't wait for nfsd kernel module init when the latter is unloaded initially. Preloading nfsd.ko fixes the problem.
Reproduces for me.

I've disabled NFS-related services by default, but it must not affect the case, I think.

Example is below. Note 'Function not implemented' error.
umount and 'modprobe -r' are there to reset system to the initial state.



# lsmod | grep -c nfsd
0

# systemctl start nfs-server.service
Job for nfs-server.service failed. See 'systemctl status nfs-server.service' and 'journalctl -xn' for details.

# systemctl status nfs-server.service
nfs-server.service - NFS Server
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
   Active: failed (Result: exit-code) since Wed 2014-02-19 13:23:26 EET; 6s ago
  Process: 3400 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=1/FAILURE)
  Process: 3397 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=1/FAILURE)
  Process: 3365 ExecStartPost=/usr/libexec/nfs-utils/scripts/nfs-server.postconfig (code=exited, status=0/SUCCESS)
  Process: 3350 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
  Process: 3495 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
  Process: 3490 ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
 Main PID: 3350 (code=exited, status=0/SUCCESS)

Feb 19 13:23:26 localhost exportfs[3495]: exportfs: 192.168.56.101:/mnt/oth/export: Function not implemented
Feb 19 13:23:26 localhost systemd[1]: nfs-server.service: control process exited, code=exited status=1
Feb 19 13:23:26 localhost systemd[1]: Failed to start NFS Server.
Feb 19 13:23:26 localhost systemd[1]: Unit nfs-server.service entered failed state.

# lsmod | grep -c nfsd
5

# killall -0 nfsd
nfsd: no process found

# systemctl start nfs-server.service

# killall -0 nfsd

# systemctl status nfs-server.service
nfs-server.service - NFS Server
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
   Active: active (exited) since Wed 2014-02-19 13:24:44 EET; 14s ago
  Process: 3400 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=1/FAILURE)
  Process: 3397 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=1/FAILURE)
  Process: 3537 ExecStartPost=/usr/libexec/nfs-utils/scripts/nfs-server.postconfig (code=exited, status=0/SUCCESS)
  Process: 3521 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
  Process: 3519 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
  Process: 3517 ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
 Main PID: 3521 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Feb 19 13:24:44 localhost systemd[1]: Starting NFS Server...
Feb 19 13:24:44 localhost systemd[1]: Started NFS Server.

# systemctl stop nfs-server.service

# umount /proc/fs/nfsd

# modprobe -r nfsd

# killall -0 nfsd
nfsd: no process found

# lsmod | grep -c nfsd
0

# modprobe nfsd

# systemctl start nfs-server.service

# killall -0 nfsd

# systemctl status nfs-server.service
nfs-server.service - NFS Server
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
   Active: active (exited) since Wed 2014-02-19 13:26:33 EET; 9s ago
  Process: 3595 ExecStartPost=/usr/libexec/nfs-utils/scripts/nfs-server.postconfig (code=exited, status=0/SUCCESS)
  Process: 3580 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
  Process: 3576 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
  Process: 3573 ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
 Main PID: 3580 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Feb 19 13:26:33 localhost systemd[1]: Started NFS Server.

Comment 1 Andrew 2014-02-19 11:43:54 UTC
Sorry, forgot this. SW versions:
nfs-utils-1.2.9-3.0.fc20.x86_64
libnfsidmap-0.25-7.fc20.x86_64
systemd-208-9.fc20.x86_64
kernel 3.12.10-300.fc20.x86_64

Comment 2 Steve Dickson 2014-02-23 19:37:46 UTC
I'm thinking this a more a systemd issued than an nfs-utils problem.... reassigning...

Comment 3 Zbigniew Jędrzejewski-Szmek 2014-02-24 01:23:00 UTC
(In reply to Steve Dickson from comment #2)
> I'm thinking this a more a systemd issued than an nfs-utils problem....
> reassigning...
The following patch works for me:

Order nfs-server.service after /proc/fs/nsfd and /var/lib/nfs/rpc_pipefs

diff --git usr/lib/systemd/system/nfs-server.service etc/systemd/system/nfs-server.service
index 8d05584..1f7bef5 100644
--- usr/lib/systemd/system/nfs-server.service
+++ etc/systemd/system/nfs-server.service
@@ -2,6 +2,7 @@
 Description=NFS Server
 Requires=proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount rpcbind.service
 Requires=nfs-idmap.service nfs-mountd.service nfs-rquotad.service
+After=proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount rpcbind.service
 After=network.target named.service nfs-lock.service
 
 [Service]

Comment 4 Simone Tiraboschi 2015-01-16 15:27:52 UTC
I just checked nfs-utils-1.3.0-2.4.fc20.x86_64.rpm and the issue seams to be still there.

[stirabos@t440s nfs]$ cat /usr/lib/systemd/system/nfs-server.service
[Unit]
Description=NFS Server
Requires=proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount rpcbind.service
Requires=nfs-idmap.service nfs-mountd.service nfs-rquotad.service
After=network.target named.service nfs-lock.service

[Service]
Type=oneshot
RemainAfterExit=yes
StandardError=syslog+console
EnvironmentFile=-/etc/sysconfig/nfs
ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT
ExecStartPost=-/usr/libexec/nfs-utils/scripts/nfs-server.postconfig
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -f
ExecReload=/usr/sbin/exportfs -r

[Install]
WantedBy=nfs.target
Also=nfs.target

It's still missing 'After=proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount rpcbind.service' and so the issue.
It seams to be OK on nfs-utils-1.3.1-4.1.fc21.x86_64.rpm for Fedora 21.

Comment 5 Pavel Raiskup 2015-02-20 11:14:36 UTC
Right, still in f20.

'exportfs -r' (in ExecStartPre) fails if the nfs module is not loaded:

    # lsmod | grep nfs
    # ... EMPTY ...

Then, 'service nfs start' does exportfs -r:

    # exportfs  -r
    exportfs: server:/some/dir: Function not implemented
    exportfs: server:/some/other/dir: Function not implemented

How reproducible:
  This happens only after fresh system installation and system update.
  Then:
      # yum install nfs-utils
      # # put something under /etc/exports.d
      # systemctl start nfs-server

Comment 6 Fedora End Of Life 2015-05-29 10:58:50 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Pavel Raiskup 2015-06-01 14:15:33 UTC
OK in F21 & F22.  NFS modules are loaded into kernel automatically
after package installation (did not try to look where exactly, making
it clear here in bugzilla would be really fine ;)).  However,
no need to do 'service nfs-server start' twice, no need to keep this
opened.


Note You need to log in before you can comment on or make changes to this bug.