update-rc.d(8)

๐Ÿ“ฆ
version 1.69 ยท 4 versions
, in ubuntu resolute, ubuntu stonking

โœจ 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:

  • runlevel is one of the runlevels that init supports, literally: 0123456789S
  • NN is 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 ๐Ÿ“š


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/name must exist before update-rc.d is 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. ๐Ÿ’œ


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 of S, 2, 3, 4 or 5.

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/name still 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 by update-rc.d .
  • /etc/init.d/skeleton โ€” Model for use by writers of init.d scripts.

๐Ÿงš SEE ALSO ๐Ÿงš


๐Ÿ‘‘ Author ๐Ÿ‘‘

Ian Jackson, Miquel van Smoorenburg

License: GNU General Public License v2 or Later (GPLv2+) โ€” she's free and open, as she should be. ๐Ÿ’–


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