Opened 3 months ago

Closed 3 months ago

#15454 closed defect (fixed)

bootscripts: issues with nfs-server

Reported by: ken@… Owned by: Bruce Dubbs
Priority: normal Milestone: 11.0
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

I previously reported that shutting down the nfs-server script reported that nfsd was not running. The server works fine, the report comes from

      log_info_msg "Stopping NFS nfsd..."
      # nfsd needs HUP.  Can't use killproc for kernel process.
      killall -HUP nfsd
      evaluate_retval

Trying to report 'status' similarly says it is not running.

I'm confirming that nfsd processes do exist with

ps aux | grep nfsd | grep -v grep

which shows 8 processes while the box is up.

Wondering if this is caused by a change in the kernel (bootscript worked in old 5.10) or perhaps in nfs.

Attachments (1)

nfs-server2 (3.3 KB ) - added by Bruce Dubbs 3 months ago.
Test rewrite of nfs-server boot script.

Download all attachments as: .zip

Change History (13)

comment:1 by Bruce Dubbs, 3 months ago

Confirmed. Trying to figure it out.

comment:2 by ken@…, 3 months ago

The status option was also broken in BLFS-10.1

For the error message when shutting down, it seems to be related to some kernel change.

On 10.1 I have 5.10.7, also 5.12.8, both with nfs-utils-2.5.2 - both shutdown or reboot without the error message.

On 11.0rc I had 5.13.10 and nfs-uils-2.5.4 with the error message. Copied the 5.10.17 config and built 5.10.17 on 11.0-rc (don't try that on a production system, the version is vulnerable). That combination reboots without an error message.

comment:3 by Bruce Dubbs, 3 months ago

Looking at systemd's nfs-server.service

ExecStartPre=-/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd

ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

ExecReload=-/usr/sbin/exportfs -r

For stop we have

/sbin/exportfs -au
killproc /sbin/rpc.statd
killall -HUP nfsd           Probably should try /usr/sbin/rpc.nfsd 0
killproc /sbin/rpc.mountd
rm -f /var/run/rpc.statd.pid

For status we need

statusproc /sbin/rpc.mountd
statusproc /sbin/rpc.statd

But I don't know about nfsd. For me I have:

root        73     2  0 Jul20 ?        00:00:00 [nfsiod]
root       681     2  0 Jul20 ?        00:00:00 [nfsd]
root       682     2  0 Jul20 ?        00:00:00 [nfsd]
root       683     2  0 Jul20 ?        00:00:00 [nfsd]
root       684     2  0 Jul20 ?        00:00:00 [nfsd]
root       685     2  0 Jul20 ?        00:00:00 [nfsd]
root       686     2  0 Jul20 ?        00:00:02 [nfsd]
root       687     2  0 Jul20 ?        00:00:28 [nfsd]
root       688     2  0 Jul20 ?        00:01:27 [nfsd]

We could write a script to parse these.

comment:4 by ken@…, 3 months ago

I confirm I've got the same items (nfsiod, nfsd) running.

by Bruce Dubbs, 3 months ago

Attachment: nfs-server2 added

Test rewrite of nfs-server boot script.

comment:5 by Bruce Dubbs, 3 months ago

Ken, see if the attached script works for you.

comment:6 by ken@…, 3 months ago

The status works nicely.

When shutting down or rebooting I get 4 messages for stopping the various parts of nfs, the third (nfsd) still reports that it failed but the reboot or shutdown continues.

comment:7 by Bruce Dubbs, 3 months ago

It must not be returning 0 as a status. Looking at the source it appears that it is doing:

if ((error = nfssvc_threads(count)) < 0)

xlog(L_ERROR, "error starting threads: errno %d (%m)", errno);

return (error != 0);

Can you check your logs to see if that message shows up?

When I tested, I did not try to reboot, but I did try:

/etc/init.d/nfs-server2 stop and then /etc/init.d/nfs-server2 and everything seemd to work.

in reply to:  7 comment:8 by ken@…, 3 months ago

Replying to Bruce Dubbs:

It must not be returning 0 as a status. Looking at the source it appears that it is doing:

if ((error = nfssvc_threads(count)) < 0)

xlog(L_ERROR, "error starting threads: errno %d (%m)", errno);

return (error != 0);

Can you check your logs to see if that message shows up?

Sounds bizarre (its shutting down) but yes;

Aug 25 01:18:51 leshp klogd: [  157.443816] nfsd: last server has exited, flushing export cache
Aug 25 01:18:51 leshp rpc.nfsd: error starting threads: errno 2 (No such file or directory)
Aug 25 01:18:51 leshp rpc.mountd[901]: Caught signal 15, un-registering and exiting.

comment:9 by Bruce Dubbs, 3 months ago

Lets try this:

log_info_msg "Stopping NFS nfsd..."
      /usr/sbin/rpc.nfsd 0
      log_success_msg2

Which unconditionally prints OK and ignores the return value.

in reply to:  9 comment:10 by ken@…, 3 months ago

Replying to Bruce Dubbs:

Lets try this:

log_info_msg "Stopping NFS nfsd..."
      /usr/sbin/rpc.nfsd 0
      log_success_msg2

Which unconditionally prints OK and ignores the return value.

I like things which unconditionally print OK, rather like Peril Sensitive Sunglasses (hhg2g). Works for me (tested by shutting down).

comment:11 by Bruce Dubbs, 3 months ago

Owner: changed from blfs-book to Bruce Dubbs
Status: newassigned

comment:12 by Bruce Dubbs, 3 months ago

Resolution: fixed
Status: assignedclosed
Fixed at blfs-bootscripts commit 37ee2c3d9d0e73962c15235d83c9b5298d9a5e44
and      blfs             commit df5a81553dcea151fe2022e28c4d00ef7b0d61df
Note: See TracTickets for help on using tickets.