update-rc.d(8)
โจ update-rc.d(8) โ the Debian GNU/Linux manual page, bestie edition โจ
okay so this is update-rc.d, straight out of the Debian GNU/Linux manual, section 8 (that's the sysadmin section, the one with all the Important Grown-Up Commands ๐ซถ). Her whole job? Installing and removing System-V style init script links. That's it. That's the girl. ๐
๐ธ Name ๐ธ
update-rc.d โ install and remove System-V style init script links
๐ฆ SYNOPSIS ๐ฆ
update-rc.d [-f] name remove
update-rc.d name defaults
update-rc.d name defaults-disabled
update-rc.d name disable|enable [ S|2|3|4|5 ]
look at her. four whole moods. pick your fighter. ๐
โจ DESCRIPTION โจ
okay so what does she actually do? update-rc.d updates the System V style init script links, periodt.
Those links live at /etc/rcrunlevel.d/NNname, and their target is the actual script at /etc/init.d/name.
Who runs these links? init, that's who โ init runs them whenever it changes runlevels. And what are they for? Generally for starting and stopping system services, like daemons. ๐ซ
so about those placeholder names:
runlevelis one of the runlevels that init supports, literally:0123456789SNNis the two-digit sequence number that decides where in the sequence init is gonna run the scripts
and just so we're clear about scope: this manpage documents only the usage and behaviour of update-rc.d. If you want the whole deep-dive discussion of System V style init script arrangements, go read init(8) and the Debian Policy Manual. iykyk ๐
๐ INSTALLING INIT SCRIPT LINKS ๐
so here's the tea. update-rc.d requires dependency and runlevel information to be provided in the init.d script LSB comment header โ of all init.d scripts. Need the details on the LSB header format? That's the insserv(8) manual page's whole moment. go look. ๐
the defaults option
When you run it with the defaults option, update-rc.d makes links named /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name, using the runlevel and dependency info from that init.d script LSB comment header. iconic. โจ
the defaults-disabled option
When you run it with the defaults-disabled option, update-rc.d makes links named /etc/rcrunlevel.d/KNNname that point to the script /etc/init.d/name, using dependency information from the init.d script LSB comment header. Which means the init.d script is gonna be disabled (more on that below, don't worry bestie). ๐
the "nah, she's not touching that" rule
If any files named /etc/rcrunlevel.d/[SK]??name already exist, then update-rc.d does nothing. Absolutely nothing. sits there. ๐
And why?? The program was written this way on purpose, so that it will never change an existing configuration โ because that config might have been customized by the system administrator, and we do not disrespect their choices. The program will only install links if none are present, i.e., if it appears that the service has never been installed before. ๐ซถ
a lil history moment
Older versions of update-rc.d also supported start and stop options. Those are no longer supported, and they're now equivalent to the defaults option. they're giving legacy. moving on. ๐
the classic sysadmin L (we've all been there)
so this is a super common system administration error: deleting the links with the thought that this will "disable" the service, i.e., that it'll prevent the service from being started.
ngl that does not work. if all links have been deleted, then the next time the package is upgraded, the package's postinst script will run update-rc.d again, and this will reinstall the links at their factory default locations. she comes back. she always comes back. ๐
So what's the correct way to disable services? Configure the service as stopped in all runlevels in which it is started by default. In the System V init system, that means renaming the service's symbolic links from S to K. there it is. that's the move. ๐
Also, the script/etc/init.d/namemust exist beforeupdate-rc.dis run to create the links. no script, no links, no service. simple math. ๐ญ
๐ REMOVING SCRIPTS ๐
When invoked with the remove option, update-rc.d removes any links in the /etc/rcrunlevel.d directories to the script /etc/init.d/name.
But โ and this is the important bit โ the script must have been deleted already. If the script is still present, then update-rc.d aborts with an error message. she's not gonna clean up after you while the evidence is still sitting there. ๐ซ
update-rc.d is usually called from a package's post-removal script when that script is given the purge argument. cute.
And any files in the /etc/rcrunlevel.d directories that are not symbolic links to the script /etc/init.d/name will be left untouched. she doesn't touch what isn't hers. ๐
๐ DISABLING INIT SCRIPT START LINKS ๐
disable [ S|2|3|4|5 ]
When run with the disable [ S|2|3|4|5 ] options, update-rc.d modifies existing runlevel links for the script /etc/init.d/name by renaming start links to stop links with a sequence number equal to the difference of 100 minus the original sequence number. math. slay. ๐ฅ
enable [ S|2|3|4|5 ]
When run with the enable [ S|2|3|4|5 ] options, update-rc.d modifies existing runlevel links for the script /etc/init.d/name by renaming stop links to start links with a sequence number equal to the positive difference of current sequence number minus 100, thus returning to the original sequence number that the script had been installed with before disabling it. she's restoring her roots. the glow up is real. โจ
Both of these options only operate on start runlevel links ofS,2,3,4or5.
If no start runlevel is specified after the disable or enable keywords, the script will attempt to modify links in all start runlevels. go big or go home. ๐
๐ OPTIONS ๐
-fโ Force removal of symlinks even if/etc/init.d/namestill exists. aggressive. we respect it. ๐ค
๐ EXAMPLES ๐
Insert links using the defaults:
update-rc.d foobar defaults
The equivalent dependency header would have start and stop dependencies on $remote_fs and $syslog, and start in runlevels 2-5 and stop in runlevels 0, 1 and 6. โจ
Remove all links for a script (assuming foobar has been deleted already):
update-rc.d foobar remove
Example of disabling a service:
update-rc.d foobar disable
Example of a command for installing a system initialization-and-shutdown script:
update-rc.d foobar defaults
Example of a command for disabling a system initialization-and-shutdown script:
update-rc.d foobar disable
see how foobar is just out here living her best life in every single example? main character energy fr fr. ๐
๐ BUGS ๐
See <http://bugs.debian.org/sysv-rc> and <http://bugs.debian.org/init-system-helpers>.
(yes those are the places to go file your complaints. be nice, be specific, attach logs. ๐ซถ)
๐ FILES ๐
/etc/init.d/โ The directory containing the actual init scripts./etc/rc?.d/โ The directories containing the links used by init and managed byupdate-rc.d./etc/init.d/skeletonโ Model for use by writers of init.d scripts.
๐ง SEE ALSO ๐ง
- Debian Policy Manual
/etc/init.d/skeletoninsserv(8)init(8)
๐ Author ๐
Ian Jackson, Miquel van Smoorenburg
License: GNU General Public License v2 or Later (GPLv2+) โ she's free and open, as she should be. ๐
๐ Copyright ๐
2001 Henrique de Moraes Holschuh
and that's the whole page, bestie!! ๐ this one's from Debian GNU/Linux, dated 14 November 2005, and it's update-rc.d(8) โ go forth and manage your init links responsibly. no cap. ๐
โจ๐ฆ๐ธ๐ซถ
๐ฆ 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 on : a language model's rewrite of the original, under its terms