S6-RC-WHY(7)
π NAME π
S6-RC-WHY(7) β why s6-rc π
okay bestie, welcome to S6-RC-WHY(7) from the Miscellaneous Information Manual. this is the βwhy is s6-rc even a thingβ page, and itβs giving big-brain Unix energy fr fr π§β¨
β¨ DESCRIPTION β¨
π§ The limits of supervision suites π§
Supervision suites like s6[1], runit[2], perp[3], or daemontools[4] define a service as a long-lived process, a.k.a. a daemon. they give you tools to run that daemon in a reproducible way inside a controlled environment and keep it alive if it dies; they also give you daemon management tools that, among other things, let you send signals to the daemon without knowing its PID. they can control individual long-lived processes perfectly well, and s6 also provides tools to manage a whole supervision tree. to any system administrator who cares about reliability, supervision suites are a good thing. π
but β and this is the whole point β a supervision suite is not a service manager. periodt.
relying on a supervision suite to handle all the service management is doable on simple systems, where there arenβt many dependencies, and where most of the one-time initialization can take place in stage 1, before any daemons are launched. on some embedded systems, for instance, this is perfectly reasonable. π
on other systems, though, it gets more problematic. here are a few issues encountered:
- with a pure supervision tree, all daemons are launched in parallel; if their dependencies are not met, daemons just die, and are restarted by the supervisors, and so on; so eventually the dependency tree is correctly built and everything is brought up. this is okay with lightweight daemons that do not take up too many resources when starting; but with heavyweight daemons, bringing them up at the wrong time can expend CPU or cause heavy disk access, and increase the total booting time significantly. π
- the
runitmodel of separating one-time initialization (stage 1) and daemon management (stage 2) does not always work: some one-time initialization may depend on a daemon being up. example:udevdon Linux. such daemons then need to be run in stage 1, unsupervised β which defeats the purpose of having a supervision suite. π - more generally, supervision suites do not perform dependency management. their job is to maintain daemons alive and ease their administration; dependency across those daemons is not their concern, and one-time initialization scripts are entirely foreign to them. so a situation like
udevdwhere it is necessary to interleave daemons and one-time scripts is not handled properly by them.
to manage complex systems, pure supervision suites are insufficient, and real service managers β starting and stopping services in the proper order and handling both oneshots (one-time initialization scripts) and longruns (daemons) β are needed. no cap. π₯
πΈ Previous alternatives πΈ
Unix distributions usually come with their own init systems and service managers; all of those have flaws one way or another. no widely spread init system gets things right, which is the main reason for the recent βinit warsβ β no matter what init system you talk about, there are strong, valid reasons to like it and support it, and there are also strong, valid reasons to dislike it. π
non-supervision init systems usually fall in one of two categories, both with pros and cons.
π Traditional, sequential starters π
those are either the historical Unix init systems, or newer systems that still favor simplicity. among them, for instance:
sysvinit[5], the historical GNU/Linux init system, and its companion set of/etc/rc.dinit scripts that some distributions like to callsysv-rc. note thatsysvinitdoes have supervision capabilities, but nobody ever bothered to use them for anything else thangettys, and all the machine initialization, including longruns, is done by thesysv-rcscripts, in a less than elegant way. π«BSD init[6], which is very similar tosysvinitβ including the supervision abilities that are only ever used forgettys. the/etc/rcscript takes care of all the initialization. πOpenRC[7], an alternative, dependency-based rc system. π¦
all these systems run sequentially: they will start services, either oneshots or longruns, one by one, even when the dependency graph says that some services could be started in parallel. also, the daemons they start are always unsupervised, even when the underlying init system provides supervision features. there usually is no readiness notification support (cf. s6-notifywhenup(7)) on daemons either β daemons are fire-and-forget (but thatβs more on the scripts themselves than on the frameworks). another common criticism of those systems is that the amount of shell scripting is so huge that it has a significant performance impact. π
(note that OpenRC has an option to start services in parallel, but at the time of this writing, it uses polling on a lock file to check whether a service has completed all its dependencies; this is heavily prone to race conditions, and is not the correct mechanism to ensure proper service ordering, so this option cannot be considered reliable.) β οΈ
another, less obvious, but important drawback is that service-launching scripts run as scions of the shell that invoked the command, and so they may exhibit different behaviours when theyβre run automatically at boot time and when theyβre run manually by an admin, because the environment is different. scripts usually try to run in a clean environment, but itβs hard to think of everything (open file descriptors!) and every script must protect itself with a gigantic boilerplate, which adds to the inefficiency problem. π
π Monolithic init behemoths π
the other category of service managers is made of attempts to cover the flaws of traditional service starters, and provide supervision, dependency management and sometimes readiness notification, while reducing the amount of scripting needed. unfortunately, the results are tightly integrated, monolithic init systems straying far away from Unix core principles, with design flaws that make the historical initsβ design flaws look like a joke. π
Upstart[8]was the first one. the concepts inUpstartare actually pretty good: in theory, itβs a decent event-based service manager. unfortunately, the implementation is less than ideal. for instance, the service file format is full ofadhocismsbreaking the principle of least surprise. but most importantly,Upstartwas the first system that usedptrace(2)on the processes it spawned in order to keep track of their forks. if you donβt know what that means: itβs complete insanity, using a debug feature in production, with heavy impact on security and efficiency. πlaunchd[9], Darwinβs init and service manager. the Wikipedia page (linked here because Apple doesnβt see fit to provide a documentation page forlaunchd) is very clear: it replacesinit,rc,init.d/rc.d,SystemStarter,inetd,crontd,atdandwatchdogd. it does all of this in process 1. and it uses XML for daemon configuration, solaunchctlhas to link in an XML parsing library, and it communicates with process 1 via a Mach-specific IPC mechanism. is this the sleek, elegant design that Apple is usually known for? like, stick to selling iPhones, guys. πsystemd[10], the main protagonist (or antagonist) in the βinit warsβ. it has the same problems aslaunchd, up by an order of magnitude;here[11]is why.systemdavowedly aims to replace the whole low-level user-space of Linux systems, but its design is horrendous. it doesnβt even get readiness notificationright[12]. π₯π
the problem of integrated init systems is that:
- they have been developed by companies and associations, not individuals, and despite the licensing, they are for all intents and purposes closer to proprietary software than free software; they also suffer from many of the technical flaws of enterprise software design.
- as a result, and despite being backed by tremendous manpower, they have been very poorly thought out. the manpower goes into the coding of features, not into architecture conception; and the architects were obviously not Unix experts, which is a shame when itβs about creating a process 1 for Unix. this is apparent because:
- they have been designed like application software, not system software, which requires a fairly different set of skills, and careful attention to details that are not as important in application software, such as minimal software dependencies and shortness of code paths.
pages and pages could be β and have been β written about the shortcomings of integrated init systems, but one fact remains: they are not a satisfying solution to the problem of service management under Unix. periodt. π«Ά
π¦ The best of both worlds π¦
s6-rc aims to be such a solution: it is small and modular, but offers full functionality. parallel service startup and shutdown with correct dependency management (none of the systemd nonsense where services are started before their dependencies are met), correct readiness notification support, reproducible script execution, and short code paths. β¨π
s6-rcis a service manager, i.e. the equivalent ofsysv-rcorOpenRC. it is not an init system. you can runs6-rcwith any init system of your choosing. of course,s6-rcrequires ans6supervision tree to be running on the system, since it delegates the management of longrun services to that supervision tree, but it does not require thats6be the init system itself.s6-rcwill work whens6-svscan(8)runs as process 1 (cf.s6-svscan-as-process-1(7)β on Linux, such a setup can be easily achieved via the help of thes6-linux-initpackage), and it will also work whens6-svscan(8)runs under another init process (cf.s6-svscan-not-as-process-1(7)). π- the service manager runs on top of a supervision suite. it does not try to make it perform boot/shutdown operations or dependency management itself; and it does not substitute itself to it.
s6-rcuses the functionality provided bys6, but it is still possible to runs6withouts6-rcfor systems that do not need a service manager. it would also be theoretically possible to runs6-rcon top of another supervision suite, if said supervision suite provided the hooks thats6-rcneeds. π«Ά - the dependency-graph grind? okay so analyzing a whole set of services and computing a dependency graph for that set is a significantly time-consuming part of any service manager, fr fr. And at the time of writing this document,
s6-rcis the only service manager that does that work offline β which means it eliminates the dependency analysis overhead from boot time, shutdown time, or literally any other time where the machine state changes. iconic behavior, honestly π - the source format stays simple on purpose. the source format for the
s6-rc-compile(8)tool is purposefully simple, so that external tools can automatically write service definitions for s6-rc β for instance, for conversions between service manager formats. cooperation slay π - tiny code, does its job, nothing else. like every skarnet.org tool[13], s6-rc is made of very little code, that does its job and nothing else. the binaries are small, it is very light in memory usage, and the code paths are extremely short. she's efficient, she's minimal, she's that girl β¨
the combination of s6 and s6-rc makes a complete, full-featured and performant init system and service manager, with probably the lowest total memory footprint of any service manager out there, plus all the reliability and ease of administration that a supervision suite can provide. it is a real, viable alternative to integrated init behemoths, providing equivalent functionality while being much smaller and much more maintainable. no cap β she's a whole main character π
π¦ SEE ALSO π¦
the besties she wants you to meet:
s6-rc-faq(7)s6-rc-overview(7)s6-rc(8)s6-rc-bundle(8)s6-rc-compile(8)s6-rc-db(8)s6-rc-fdholder-filler(8)s6-rc-format-upgrade(8)s6-rc-init(8)s6-rc-oneshot-run(8)s6-rc-update(8)
and the receipts (iykyk) π§Ύ:
- [1]
https://skarnet.org/software/s6/ - [2]
http://smarden.org/runit/ - [3]
http://b0llix.net/perp/ - [4]
https://cr.yp.to/daemontools.html - [5]
https://savannah.nongnu.org/projects/sysvinit - [6]
https://www.freebsd.org/cgi/man.cgi?query=init(8) - [7]
https://wiki.gentoo.org/wiki/Project:OpenRC - [8]
https://upstart.ubuntu.com/ - [9]
https://en.wikipedia.org/wiki/Launchd - [10]
https://www.freedesktop.org/wiki/Software/systemd/ - [11]
https://skarnet.org/software/systemd.html - [12]
http://ewontfix.com/15/ - [13]
https://skarnet.org/software/
this man page is ported from the authoritative documentation at: https://skarnet.org/software/s6-rc/why.html β always gotta give credit where credit is due π«Ά
π AUTHORS π
Laurent BercotπAlexis <flexibeast@gmail.com>(man page port) π
and that's the whole page, bestie β you made it π this drop is from Debian, dated April 6, 2023, and she's filed as S6-RC-WHY(7). go forth and run your services, you beautiful little sysadmin ππ
π¦ where this page comes from
- nixpkgs unstable: s6-rc 0.7.0.0
- nixpkgs unstable: s6-rc-man-pages 0.6.0.0.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms