invoke-rc.d(8)
๐ invoke-rc.d โ a Gen Z field guide ๐
okay so this is the invoke-rc.d page from the Debian GNU/Linux manual section 8 (that's the "admin commands" section, iykyk). buckle up bestie, because this little script runner is lowkey the main character of Debian's service management and you're gonna learn every single thing about it ๐ซถ
โจ SYNOPSIS โจ
invoke-rc.d [--quiet] [--force] [--try-anyway] [--disclose-deny]
[--query] [--no-fallback] name action [init script parameters...]
invoke-rc.d [--help]
๐ธ DESCRIPTION ๐ธ
so invoke-rc.d is basically a generic interface (a lil middle-man, a vibe coordinator, if you will) that executes System V style init script actions โ you know, /etc/init.d/name โ while obeying runlevel constraints and any local policies your sysadmin has set up. it does not just rawdog the script. it checks first. very responsible. ๐
literally all access to init scripts done by Debian packages' maintainer scripts should go through invoke-rc.d. all of it. no exceptions. that's the rule, periodt.
this manpage documents only the usage and behavior of invoke-rc.d. for a whole discussion of the System V style init script arrangements, please see init(8). and if you want even more info on invoke-rc.d, it lives in the section on runlevels and init.d scripts of the Debian Policy Manual. slay ๐
๐ INIT SCRIPT ACTIONS ๐
the standard actions are: start, stop, force-stop, restart, try-restart, reload, force-reload, and status. those are the canon ones, the iconique ones โจ
other actions are accepted, but they can cause problems to policy-rc.d (peep the INIT SCRIPT POLICY section below) โ so warnings get generated if the policy layer is active. it's giving "we'll allow it but we're judging you a little" ๐
please note that not all init scripts will implement all the actions listed above, and that the policy layer may override an action to another action(s), or even deny it entirely. so like. manage your expectations bestie ๐ญ
any extra parameters will be passed to the init script(s) being executed. they go straight through, no notes.
if an action must be carried out regardless of any local policies, use the --force switch. (but read the warning below first. i'm serious. ๐)
๐ OPTIONS ๐
--helpโ displays usage help. the classic. the goat.--quietโ quiet mode, no error messages are generated. shhh ๐คซ--forceโ tries to run the init script regardless of policy and init script subsystem errors. use of this option in Debian maintainer scripts is severely discouraged. like, severely. don't do it. i'm begging ๐--try-anywayโ tries to run the init script if a non-fatal error is detected. a lil "eh, let's see what happens" energy.--disclose-denyโ returns status code101instead of status code0if the init script action is denied by the policy layer. being honest about being told no ๐--queryโ returns one of the status codes100-106. does not run the init script, and implies--disclose-denyand--no-fallback. purely vibes-checking, no action taken.--no-fallbackโ ignores any fallback action requests by the policy layer. > warning: this is usually a very bad idea for any actions other thanstart. like genuinely. do not.--skip-systemd-nativeโ exits before doing anything if a systemd environment is detected and the requested service is a native systemd unit. this is useful for maintainer scripts that want to defer systemd actions todeb-systemd-invoke(1p). teamwork makes the dream work ๐ซถ
๐ฆ STATUS CODES ๐ฆ
should an init script be executed, invoke-rc.d always returns the status code returned by the init script. init scripts should not return status codes in the 100+ range (which is reserved in Debian and by the LSB). so don't. ๐ฅ
the status codes returned by invoke-rc.d proper are:
0โ Success. either the init script was run and returned exit status0(note that a fallback action may have been run instead of the one given in the command line), or it was not run because of runlevel/local policy constrains and--disclose-denyis not in effect.1 - 99โ reserved for init.d script, usually indicates a failure. ๐ญ100โ init script ID (name) unknown. this means the init script was not registered successfully throughupdate-rc.dor that the init script does not exist. she's not on the guest list.101โ action not allowed. the requested action will not be performed because of runlevel or local policy constraints. denied, bestie ๐102โ subsystem error. init script (or policy layer) subsystem malfunction. also, forced init script execution due to--try-anywayor--forcefailed. ๐103โ syntax error.104โ action allowed. init script would be run, but--queryis in effect. so close, yet so far.105โ behavior uncertain. it cannot be determined if action should be carried out or not, and--queryis in effect. the vibe check was inconclusive ๐106โ fallback action requested. the policy layer denied the requested action, and supplied an allowed fallback action to be used instead. the plot twist โจ
๐ INIT SCRIPT POLICY ๐
invoke-rc.d introduces the concept of a policy layer โ a whole extra check-y bestie used to verify if an init script should be run or not, or if something else should be done instead. this layer has various uses, the most immediate ones being:
- avoiding that package upgrades start daemons out-of-runlevel ๐
- and that a package starts or stops daemons while inside a chroot jail. (jail. literally. no cap.)
the policy layer has the following abilities:
- deny or approve the execution of an action;
- request that another action (called a fallback) is to be taken, instead of the action requested in
invoke-rc.d's command line; - or request multiple actions to be tried in order, until one of them succeeds (a multiple fallback). ๐ฅ
invoke-rc.d itself only pays attention to the current runlevel โ it will block any attempts to start a service in a runlevel in which the service is disabled. other policies are implemented with the use of the policy-rc.d helper, and are only available if /usr/sbin/policy-rc.d is installed in the system. no helper, no extra policies. simple as that.
๐ FILES ๐
/etc/init.d/*โ System V init scripts./usr/sbin/policy-rc.dโ init script policy layer helper (not required). optional icon./etc/rc?.d/*โ System V runlevel configuration.
โญ NOTES โญ
invoke-rc.d special cases the status action, and returns exit status 4 instead of exit status 0 when it is denied. that's it. that's the note. ๐
๐ BUGS ๐
see <http://bugs.debian.org/sysv-rc> and <http://bugs.debian.org/init-system-helpers>. go report the bugs, bestie, they want to hear from you ๐ซถ
๐ฅ SEE ALSO ๐ฅ
- Debian Policy manual
/etc/init.d/skeletonupdate-rc.d(8)init(8)/usr/share/doc/init-system-helpers/README.policy-rc.d.gz
๐ AUTHOR ๐
Henrique de Moraes Holschuh
License: GNU General Public License v2 or Later (GPLv2+) ๐
๐ธ COPYRIGHT ๐ธ
2001 Henrique de Moraes Holschuh
and that's the whole page babes ๐ this was version-1-March-2001 energy โ written by Henrique de Moraes Holschuh, dated 1 March 2001, filed under invoke-rc.d(8) in the fine Debian GNU/Linux manual. go forth and never call an init script directly ever again, mwah ๐๐
๐ฆ where this page comes from
- ubuntu resolute: init-system-helpers 1.69 ยท BSD-3-Clause
- ubuntu stonking: init-system-helpers 1.69 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms