#
a5ad360f |
| 23-Oct-2024 |
Mateusz Piotrowski <0mp@FreeBSD.org> |
rc: Remove rc_fast_and_loose
The rc_fast_and_loose variable allowed rc(8) to start services by sourcing them into rc's own shell environment. Normally, each rc service script is started by being sou
rc: Remove rc_fast_and_loose
The rc_fast_and_loose variable allowed rc(8) to start services by sourcing them into rc's own shell environment. Normally, each rc service script is started by being sourced into its own subshell instead. The feature was meant to speed up rc(8) by avoiding the extra forking necessary to spawn subshells.
In practice, the feature has been broken for a long time now. One of the reasons is that some rc service scripts call the exit builtin to return non-zero error codes, which not only terminates the service subshell but also rc(8) when rc_fast_and_loose is enabled. For example, a system running any of the supported FreeBSD releases with rc_fast_and_loose=yes would abort rc(8) as early as rc.d/hostid, due to an "exit 0".
Fixing rc_fast_and_loose support would require rewriting some rc scripts to support being sourced directly into rc(8) process. This would muddy the code base and also would prove difficult to maintain long term as this is simply not how rc(8) users write scripts. The potential performance benefits are unlikely to be significant even for use cases such as Morello under qemu.
Instead, remove support for rc_fast_and_loose completely from rc(8) and inform users about the change.
PR: 282255 Reviewed by: brooks, christos, mhorne Approved by: christos (mentor), markj (mentor) MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D47264
show more ...
|
#
401516db |
| 20-Sep-2024 |
Mateusz Piotrowski <0mp@FreeBSD.org> |
rc.subr: Consistently use an absolute path for sysrc
MFC after: 2 weeks Approved by: christos
|
Revision tags: release/13.4.0 |
|
#
4269d1a2 |
| 11-Sep-2024 |
R. Christian McDonald <rcm@FreeBSD.org> |
rc.subr: fix typo "save_dot" -> "safe_dot"
Reviewed by: sjg Approved by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org
rc.subr: fix typo "save_dot" -> "safe_dot"
Reviewed by: sjg Approved by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46644
show more ...
|
#
b5f6beef |
| 10-Sep-2024 |
R. Christian McDonald <rcm@FreeBSD.org> |
rc.subr: ensure run_rc_script return code is not masked by DebugOff
Ensure that run_rc_script returns the true return code of the rc command and not the return code of DebugOff
Reviewed by: sjg App
rc.subr: ensure run_rc_script return code is not masked by DebugOff
Ensure that run_rc_script returns the true return code of the rc command and not the return code of DebugOff
Reviewed by: sjg Approved by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46626
show more ...
|
#
6502c60c |
| 03-Aug-2024 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Move fetch of DEBUG_SH from kenv to rc
We only need to check kenv for DEBUG_SH once. We also need to export DEBUG_SH to be useful.
Sponsored by: Juniper Networks, Inc.
Reviewed by: imp Differentia
Move fetch of DEBUG_SH from kenv to rc
We only need to check kenv for DEBUG_SH once. We also need to export DEBUG_SH to be useful.
Sponsored by: Juniper Networks, Inc.
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D46219
show more ...
|
#
af1b0aa5 |
| 18-Jun-2024 |
Eugene Grosbein <eugen@FreeBSD.org> |
rc.subr: improve description for ${name}_offcmd
Clarify that ${name}_offcmd is for method start.
MFC after: 3 days
|
#
2d08f6b5 |
| 14-Jun-2024 |
Alexander Leidinger <netchild@FreeBSD.org> |
rc.subr: add some sanity checks for service jails
Add some sanity checks when service jails are used in jails: - children.max > 0 - children.max - children.cur > 0
The nesting is too deep at thos
rc.subr: add some sanity checks for service jails
Add some sanity checks when service jails are used in jails: - children.max > 0 - children.max - children.cur > 0
The nesting is too deep at those places to have a sane formatting, so no line wrapping at the usual column. If someone has a better idea how to format this: feel free to go ahead.
show more ...
|
#
a70ecfb1 |
| 14-Jun-2024 |
Alexander Leidinger <netchild@FreeBSD.org> |
rc.subr: add new sysv option for service jails
Clarify that the "sysvipc" svcj option inherits from the host / parent. Add "sysvipcnew" which creates a new SysV namespace for the service jail. Sanit
rc.subr: add new sysv option for service jails
Clarify that the "sysvipc" svcj option inherits from the host / parent. Add "sysvipcnew" which creates a new SysV namespace for the service jail. Sanity check that only one of them is used.
show more ...
|
#
c2db3a0c |
| 02-Jun-2024 |
Eugene Grosbein <eugen@FreeBSD.org> |
rc.subr(8): fix debugging message after previous commit
Fixes: 32a579e4fc69a65e8901111ad5f65ec56a97dfab
|
#
32a579e4 |
| 02-Jun-2024 |
Eugene Grosbein <eugen@FreeBSD.org> |
rc.subr(8): introduce ${name}_offcmd
New variable ${name}_offcmd may be used to supply commands executed if named service is not enabled. Previously start_precmd could be used for such a task but no
rc.subr(8): introduce ${name}_offcmd
New variable ${name}_offcmd may be used to supply commands executed if named service is not enabled. Previously start_precmd could be used for such a task but now rc.subr(8) does not call it if a service is not enabled.
Fix devd startup script to use it instead of start_precmd.
PR: 279198 MFC after: 2 weeks Reported by: Dmitry S. Lukhtionov Tested by: Dmitry S. Lukhtionov
show more ...
|
Revision tags: release/14.1.0 |
|
#
f13275cf |
| 28-May-2024 |
Alex Samorukov <samm@freebsd.org> |
export $autoboot var when running from $boottrace_cmd
At the moment, if bootrace profiling is enabled, autoboot is not exported to the rc scripts. This causes fsck to not check the root filesystem.
export $autoboot var when running from $boottrace_cmd
At the moment, if bootrace profiling is enabled, autoboot is not exported to the rc scripts. This causes fsck to not check the root filesystem. To fix this, pass _boot, rc_fast and autoboot to the boottrace process to mimic what diretly sourcing the rc.d scripts.
PR: 278993 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1261
show more ...
|
#
11333dd5 |
| 24-May-2024 |
Franco Fichtner <franco@opnsense.org> |
rc: improve NAME_setup handling
Reload is used for service reconfiguration as well and lacks a NAME_prepend-like mechanism so it makes sense to extend the NAME_reload hook into this action.
precmd
rc: improve NAME_setup handling
Reload is used for service reconfiguration as well and lacks a NAME_prepend-like mechanism so it makes sense to extend the NAME_reload hook into this action.
precmd may use configuration checks and blocks setup from doing its designated work (e.g. nginx). In moving the invoke of the setup script in front allows us to provide custom scripts for config file generation and fixing prior to precmd checking configuration integrity.
Also introduce _run_rc_setup to separate the launcher from the main one. Let it run correctly in the case of restart_precmd and block further execution as would be the case in start due to the internal plumbing of restart being split into calling stop and start afterwards.
Differential-Revsiion: https://reviews.freebsd.org/D36259 Signed-off-by: Franco Fichtner <franco@opnsense.org> Reviewed by: imp, oshogbo Pull Request: https://github.com/freebsd/freebsd-src/pull/1258
show more ...
|
#
2efbd480 |
| 22-May-2024 |
Alexander Leidinger <netchild@FreeBSD.org> |
rc: add service jails framework
This takes a rc.d-service and starts it in a jail which shares the same root-path as the host (or parent jail) and may inherit the network from the host (or parent ja
rc: add service jails framework
This takes a rc.d-service and starts it in a jail which shares the same root-path as the host (or parent jail) and may inherit the network from the host (or parent jail). Per service there is the possibility to specify some arguments which give more permissions (e.g. netv4, netv6, sysvipc...). Reviewed by: bcr (man page) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D40370
show more ...
|
#
dc501a9e |
| 22-May-2024 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Allow DEBUG_SH=rc:all to debug all rc.d
Usually a bad idea but there are exceptions to every rule. Allso debugging all rc.d scripts or all with a given arg.
|
Revision tags: release/13.3.0 |
|
#
b75bb996 |
| 12-Feb-2024 |
Simon J. Gerraty <sjg@FreeBSD.org> |
rc.subr add Exists so we can find sed
SED=`Exists -x /usr/bin/sed /rescue/sed`
avoids adding /rescure to $PATH, and allows use of sed before /usr is mounted (if a separate filesystem).
Reviewed by
rc.subr add Exists so we can find sed
SED=`Exists -x /usr/bin/sed /rescue/sed`
avoids adding /rescure to $PATH, and allows use of sed before /usr is mounted (if a separate filesystem).
Reviewed by: jlduran_gmail.com Differential Revision: https://reviews.freebsd.org/D43826
show more ...
|
#
15483f96 |
| 10-Feb-2024 |
Simon J. Gerraty <sjg@FreeBSD.org> |
rc.subr avoid noise if /usr not mounted
basename, sed and tty are all in /usr/bin and not available until /usr is mounted.
basename and tty we can replace with a function, but sed is more important
rc.subr avoid noise if /usr not mounted
basename, sed and tty are all in /usr/bin and not available until /usr is mounted.
basename and tty we can replace with a function, but sed is more important. Fix o_verify to just use shell builtins, and rc_trace should avoid trying to set RC_LEVEL until sed is available.
show more ...
|
#
aa3b7a2f |
| 09-Feb-2024 |
Simon J. Gerraty <sjg@FreeBSD.org> |
/etc/rc add trace debug and verify
Debugging boot issues can be helped by logging each rc.d script as it is run and being able to selectively enable/disable set -x debug.sh provides an elaborate fra
/etc/rc add trace debug and verify
Debugging boot issues can be helped by logging each rc.d script as it is run and being able to selectively enable/disable set -x debug.sh provides an elaborate framework for debugging shell scripts.
For secure systems, we want to be paranoid about what we read during boot.
dot() simply reads (.) arg file if it exists vdot() if mac_veriexec is active, ignore unverified files otherwise behaves much the same as dot() safe_dot() in safe_eval.sh allows reading an untrusted file; limiting the input to simple variable assignments.
In load_rc_config allow caller to provide an option to indicate how to handle its arg: -v use vdot() -s use sdot() which will try to use vdot() and fallback to safe_dot() The default is to read using dot()
rc_run_scripts() encapsulate the running of rc.d scripts so that we can easily call it more than twice.
We vdot local.rc.subr to pick up extensions (like run_rc_scripts_final) and overrides.
We also allow rc.subr.local or rc.conf to set rc_config_xtra eg (rc_config_xtra=XXX for historic compatibility)
rc use set -o verify around the reading in of rc.subr This has no effect if mac_veriexec is not active, but if it is; ensures rc.subr has not been tampered with.
Reviewed by: imp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D43671
show more ...
|
#
f06fda7f |
| 18-Nov-2023 |
Jens Schweikhardt <schweikh@FreeBSD.org> |
Spaces to tabs for consistency. No content change.
|
Revision tags: release/14.0.0 |
|
#
ba793728 |
| 01-Jul-2023 |
Daniel Tameling <tamelingdaniel@gmail.com> |
rc.subr: don't require service to be enabled for `status`
For a service that sets an rcvar, there is a check whether it has been enabled before the actual command is executed. If the check fails, on
rc.subr: don't require service to be enabled for `status`
For a service that sets an rcvar, there is a check whether it has been enabled before the actual command is executed. If the check fails, one gets a message to enable it and the returned exit status is 0. However, this is usually undesirable for the status command, which is a) supposed to check whether the service is running anyway and b) returns a non-zero exit code if that is not the case. Thus, skip the check for the status command.
PR: 272282 Reviewed by: emaste MFC after: 3 days
show more ...
|
#
d0b2dbfa |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
#
f05948d4 |
| 11-May-2023 |
Enji Cooper <ngie@FreeBSD.org> |
cpuset(8): move to /bin/
Summary: This change moves /usr/bin/cpuset to /bin/cpuset so it is more readily available on hosts where the /usr partition might not be mounted at the time / has been mount
cpuset(8): move to /bin/
Summary: This change moves /usr/bin/cpuset to /bin/cpuset so it is more readily available on hosts where the /usr partition might not be mounted at the time / has been mounted.
Remove some complexity from rc.subr(8) since /bin is assumed to always be present if/when / is mounted.
MFC after: 2 weeks MFC with: 0661f93892a2, 271d552379af
Test Plan: - Test out rc.subr change. - Confirm that the installation logic does what's needed.
Relnotes: yes (moving cpuset may impact strict file permissions/mode checking) Reviewers: kevans Subscribers: imp Differential Revision: https://reviews.freebsd.org/D40057
show more ...
|
#
5ac2a874 |
| 15-Jul-2023 |
Doug Rabson <dfr@FreeBSD.org> |
/etc/rc.subr: rename sysctl.conf.d to sysctl.kld.d
This better reflects the intent that this directory is indexed by kld name and removes a conflict with D32128 which aims to split sysctl.conf.
Rev
/etc/rc.subr: rename sysctl.conf.d to sysctl.kld.d
This better reflects the intent that this directory is indexed by kld name and removes a conflict with D32128 which aims to split sysctl.conf.
Reviewed by: kevans imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D41043
show more ...
|
#
09267cc1 |
| 21-Jun-2023 |
Doug Rabson <dfr@FreeBSD.org> |
/etc/rc.subr: add support for kld sysctl variables
For kernel modules loaded by scripts in /etc/rc.d and /usr/local/etc/rc.d, if there is a file in /etc/sysctl.conf.d named <kld name>.conf, then thi
/etc/rc.subr: add support for kld sysctl variables
For kernel modules loaded by scripts in /etc/rc.d and /usr/local/etc/rc.d, if there is a file in /etc/sysctl.conf.d named <kld name>.conf, then this will be loaded using the sysctl(8) utility. For instance, sysctl variable changes for the pf kernel module would be placed in the file /etc/sysctl.conf.d/pf.conf.
PR: 272129 Reviewed by: imp freebsd_igalic.co MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D40886
show more ...
|
#
46f35bf2 |
| 11-May-2023 |
Enji Cooper <ngie@FreeBSD.org> |
rc.subr(8): delete debug cpuset helper
Summary: The intention of the original author (I assume) was to add this logic for testing. This removes the debug statement so it no longer shows up in calls
rc.subr(8): delete debug cpuset helper
Summary: The intention of the original author (I assume) was to add this logic for testing. This removes the debug statement so it no longer shows up in calls to `status`.
MFC after: 2 weeks MFC with: 0661f9389
Reviewers: kevans
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D40055
show more ...
|
#
4e9041a7 |
| 11-May-2023 |
Enji Cooper <ngie@FreeBSD.org> |
rc.subr(8): run `trailing-whitespace-fixer`
This change deletes benign trailing whitespace from rc.subr, making future non-stylistic changes easier to spot.
MFC after: 1 week
|