Bug 121440 - rc(8) and rcorder(8) unclear about PROVIDE keyword being mandatory
Summary: rc(8) and rcorder(8) unclear about PROVIDE keyword being mandatory
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-rc (Nobody)
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2008-03-06 20:40 UTC by Michael Ross
Modified: 2025-02-06 23:07 UTC (History)
4 users (show)

See Also:


Attachments
rcorder(8) and rc(8) patch (1.46 KB, patch)
2021-10-01 19:33 UTC, Felix Johnson
felix.the.red: maintainer-approval? (felix.the.red)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Ross 2008-03-06 20:40:00 UTC
rc.d scripts without a PROVIDE keyword are skipped by rc.subr and thus not executed.

rc(8) does not state this clearly, quote:
Each script should contain rcorder(8) keywords, especially an appropriate ``PROVIDE'' 

rcorder(8) is more confusing, as it states, quote:
A file may contain zero ``PROVIDE'' lines


See message 63aggbF26iusnU1@mid.individual.net and followups on news:comp.unix.bsd.freebsd.misc

Fix: 

Rephrase rc(8) to make clear that scripts require a PROVIDE keyword
Rephrase rcorder(8) to make clear that, while rcorder does not require the PROVIDE keyword, the script will not be executed without one.
Comment 1 Giorgos Keramidas freebsd_committer freebsd_triage 2008-03-06 23:20:33 UTC
Responsible Changed
From-To: freebsd-doc->keramida

I was the one who requested that this is logged as a PR, so 
I would get a reminder to handle it, so assign it to me.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2015-03-10 03:05:28 UTC
Release to wild.
Comment 3 unitrunker 2020-08-23 22:54:54 UTC
rc.subr uses grep to look for rc scripts with '^# PROVIDE:'

See "find_local_scripts_new" and "find_local_scripts_old".

Scripts in /usr/local/etc/rc.d/* without the "# PROVIDE:" clause are ignored by /etc/rc.
Comment 4 unitrunker 2020-08-24 04:25:01 UTC
More info here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248865
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2020-09-01 00:32:00 UTC
^Triage: reset stale In Progress status.
Comment 6 Paul Scott 2021-05-30 21:51:01 UTC
I experienced this issue when I added a new service.

My service would start and stop manually, but would not start during boot process. I lost hours of my day figuring out why.

rcorder(8) states: "A file may contain zero `PROVIDE' lines, in which case it provides no conditions."

rc(8) states: "Each script should contain rcorder(8) keywords, especially an appropriate "PROVIDE" entry, and if necessary "REQUIRE" and "BEFORE" keywords.”

To my mind, rcorder(8)'s wording implies PROVIDE is optional, while rc(8)'s wording only suggests the importance of PROVIDE but does not discuss the ramifications of leaving it off as rcorder(8) clearly states may be done.

The solution here is to unambiguously state in rcorder(8) that the rc system (boot time) will steadfastly refuse to start a service that has no PROVIDE entry, even while a manual start will work.
Comment 7 Felix Johnson 2021-10-01 19:33:59 UTC
Created attachment 228335 [details]
rcorder(8) and rc(8) patch

Document that files with zero PROVIDE keywords are ignored by rc;
they are not run during startup.
Comment 8 Felix Johnson 2025-02-06 23:07:29 UTC
Update patch to -current.
Needs review.

https://reviews.freebsd.org/D48876