Jay Taylor's notes

back to listing index

s6 - skarnet's small supervision suite

[web search]
Original source (skarnet.org)
Tags: containers docker s6 pid-1 init skarnet.org
Clipped on: 2017-01-19

Software
skarnet.org

s6

What is it ?

s6 is a small suite of programs for UNIX, designed to allow process supervision (a.k.a service supervision), in the line of daemontools and runit, as well as various operations on processes and daemons. It is meant to be a toolbox for low-level process and service administration, providing different sets of independent tools that can be used within or without the framework, and that can be assembled together to achieve powerful functionality with a very small amount of code.

Examples of things you can do by assembling together several programs provided by s6 - besides process supervision:

  • syslogd functionality, using much less resources than the traditional syslogd.
  • Reliable service readiness notification, which is the basis for service dependency management.
  • Controlled privileged gain as with sudo, without using any suid programs.
  • The useful parts of socket activation[1] without having to change application code or link servers against any specific library, and without having to switch to any specific init system.

The s6 documentation tries to be complete and self-contained; however, if you have never heard of process supervision before, you might be confused at first. See the related resources section below for pointers to more resources, and earlier approaches to process supervision that might help you understand the basics.



Installation

Requirements

  • A POSIX-compliant system with a standard C development environment
  • GNU make, version 3.81 or later
  • skalibs version 2.4.0.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library.
  • execline version 2.2.0.0 or later. It's a build-time and run-time requirement.

Licensing

s6 is free software. It is available under the ISC license.

Download

  • The current released version of s6 is 2.4.0.0.
  • Alternatively, you can checkout a copy of the s6 git repository:
     git clone git://git.skarnet.org/s6 
  • There's also a GitHub mirror of the s6 git repository.

Compilation

  • See the enclosed INSTALL file for installation details.

Upgrade notes

  • This page lists the differences to be aware of between the previous versions of s6 and the current one.

Reference

Commands

All these commands exit 111 if they encounter a temporary error or hardware error, and 100 if they encounter a permanent error - such as a misuse. Short-lived commands exit 0 on success.

Supervision system

s6-svscan and s6-supervise are the long-lived processes maintaining the supervision tree. Other programs are a user interface to control those processes and monitor service states.

Daemontools-like utilities

These programs are a rewrite of the corresponding utilities from daemontools, with a few extras.

Fifodir management, notification and subscription

These programs are a clean rewrite of the obsolete "pipe-tools" package; they are now based on a properly designed notification library. They provide a command-line interface to inter-process notification and synchronization.

Local service management and access control

suidless privilege gain

Logging

Timed lock acquisition

fd-holding, a.k.a. the sensible part of socket activation

Libraries

Definitions


Related resources

Other components for s6-based init systems

  • s6-linux-init is a package to help you create a /sbin/init binary booting a Linux system with s6-svscan as process 1.
  • s6-overlay is a project that automates integration of s6 into Docker images.
  • s6-rc is a dependency-based service manager for s6.
  • anopa is another dependency-based service manager for s6.

s6 discussion

  • s6 is discussed on the supervision mailing-list.
  • There is a #s6 IRC channel on Freenode. Sometimes people are there and answer questions.

Similar work

  • daemontools, the pioneering process supervision software suite.
  • daemontools-encore, a derived work from daemontools with enhancements. (Note that although s6 follows the same naming scheme, the same general design, and many of the same architecture choices as daemontools, it is still original work, sharing no code at all with daemontools.)
  • runit, a slightly different approach to process supervision, with the same goals.
  • perp, yet another slightly different approach to process supervision, also with the same goals.
  • nosh is another suite of system-level utilities with similarities in the design and approach. It is written in C++, though, and is coded in quite a different way than the previous items on this list.

Other init systems

  • Felix von Leitner's minit is an init system for Linux, with process supervision capabilities.
  • suckless init is considered by many as the smallest possible init. I disagree: suckless init is incorrect, because it has no supervision capabilities, and thus, killing all processes but init can brick the machine. Nevertheless, suckless init, like many other suckless projects, is a neat exercise in minimalism.
  • sysvinit is the traditional init system for Linux.
  • Upstart is a well-known init system for Linux, with complete service management, that comes with the Ubuntu distribution. It includes a coffee machine and the kitchen sink.
  • systemd is a problem in its own category.
  • The various BSD flavors have their own style of init.
  • MacOS X has its own init spaghetti monster called launchd.

All-in-one init systems generally feel complex and convoluted, and when most people find out about the process supervision approach to init systems, they usually find it much simpler. There is a good reason for this.

Miscellaneous

Why "s6" ?

skarnet.org's small and secure supervision software suite.

Also, s6 is a nice command name prefix to have: it identifies the origin of the software, and it's short. Expect more use of s6- in future skarnet.org software releases. And please avoid using that prefix for your own projects.

Footnotes

[1] Take everything you read on that link with two or three salt shakers. (This is true for anything written by the author of that document.)