Bug 296544 - /etc/rc.d/statd and /etc/rc.d/lockd do not honor rpc_statd_flags and rpc_lockd_flags settings in /etc/rc.conf
Summary: /etc/rc.d/statd and /etc/rc.d/lockd do not honor rpc_statd_flags and rpc_lock...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 15.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-rc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-07-05 20:12 UTC by Jim Pirzyk
Modified: 2026-07-07 01:02 UTC (History)
1 user (show)

See Also:


Attachments
Moving the rc_flags variable assignment (303 bytes, patch)
2026-07-05 20:12 UTC, Jim Pirzyk
no flags Details | Diff
same patch but for /etc/rc.d/lockd (346 bytes, patch)
2026-07-05 20:13 UTC, Jim Pirzyk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Pirzyk freebsd_committer freebsd_triage 2026-07-05 20:12:59 UTC
Created attachment 272517 [details]
Moving the rc_flags variable assignment

Upgraded a NFS server from 14.4-RELEASE to 15.1-RELEASE and rpc.lockd and rpc.statd stopped responding to remote machines.  The reason they stopped responding is the port they were talking on was not the predefined port I had listed in the firewall rules and added to the rpc_*_flags variables in /etc/rc.conf

This is my setup:

rpc_lockd_enable="YES"
rpc_lockd_flags="-p 701"
rpc_statd_enable="YES"
rpc_statd_flags="-p 645"

On a freshly installed 15.1-RELEASE, it would startup them w/o the -p <PORT> options.

    100024    1   udp    901  status
    100024    1   tcp    901  status
    100021    0   udp    858  nlockmgr
    100021    0   tcp    865  nlockmgr
    100021    1   udp    858  nlockmgr
    100021    1   tcp    865  nlockmgr
    100021    3   udp    858  nlockmgr
    100021    3   tcp    865  nlockmgr
    100021    4   udp    858  nlockmgr
    100021    4   tcp    865  nlockmgr

pirzyk@qube:/etc/rc.d
21>p|g statd
root       2436   0.9  0.1 276288   3012  -  Ss   17:22     0:00.00 /usr/sbin/rpc.statd

Found that the rpc_{statd|lockd}_flags was set right before the run_rc_command call, but in the /etc/rc.d/mountd script, it is set in the *_precmd() subroutine.  Moved the call to set rc_flags= in both scripts to the *_precmd() subroutine and now it is working as expected:

pirzyk@qube:/etc/rc.d
101>p|g -E 'statd|lockd'
root       8777   0.0  0.1  14200   2988  -  Ss   15:06      0:00.00 /usr/sbin/rpc.lockd -p 701
root       8891   0.0  0.1 276288   3016  -  Is   15:06      0:00.00 /usr/sbin/rpc.statd -p 645
Comment 1 Jim Pirzyk freebsd_committer freebsd_triage 2026-07-05 20:13:37 UTC
Created attachment 272518 [details]
same patch but for /etc/rc.d/lockd
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2026-07-06 04:40:38 UTC
^Triage: this does not reflect the current content of these files.

On my machine I have:

: ${lockd_flags:="${rpc_lockd_flags}"}
: ${statd_flags:="${rpc_statd_flags}"}

for the lines you are trying to modify here.

This change was done by netchild@FreeBSD.org 2026-06-27 13:44:33 +0000.
Comment 3 Jim Pirzyk freebsd_committer freebsd_triage 2026-07-06 13:05:31 UTC
Hi Mark,

I am not saying those lines don't exist, what I am saying is they are not in the right location anymore for what ever reason.

as for the leading : (colon) I am not sure that is an artifact of how you are formatting the contents or is that in the file itself.

If the latter, then I would ask why didn't the freebsd-update -r 15.1-RELASE upgrade process not update the /etc/rc.d/statd and /etc/rc.d/lockd files from what was in 14.4-RELEASE (-p7).

If the former (i.e. a formatting style issue), then what I did was just move the location of where rc_flags got set into the {statd|lockd}_precmd() routine.
Comment 4 Jim Pirzyk freebsd_committer freebsd_triage 2026-07-06 13:10:44 UTC
Oh and yes these are older files, the id lines show this:

(statd) # FreeBSD History: src/etc/rc.d/nfslocking,v 1.11 2004/10/07 13:55:26 mtm Exp

(lockd) # FreeBSD History: src/etc/rc.d/nfslocking,v 1.11 2004/10/07 13:55:26 mtm
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2026-07-07 00:55:11 UTC
(In reply to Jim Pirzyk from comment #3)
the colon?

Please see the following commits:

https://cgit.freebsd.org/src/commit/libexec/rc/rc.d/lockd?id=d05d60e958bca778ea193932facb026c48d7ca0b
https://cgit.freebsd.org/src/commit/libexec/rc/rc.d/statd?id=d05d60e958bca778ea193932facb026c48d7ca0b

That's what's in those files right now.  Committed by netchild@ on
2026-06-27 13:44:33 +0000.

That's what you need to rebase your diff against.
Comment 6 Jim Pirzyk freebsd_committer freebsd_triage 2026-07-07 01:02:45 UTC
Um, the diff is against the 14.4-RELEASE-p7 version.  If freebsd-update didn't replace that version with what was shipped with 15.1, it is mot my job to rebase the patch against something that failed.