about summary refs log tree commit diff
path: root/doc/index.html
blob: 45e0572d9da207f3e81d10eba28c7629e71883a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6 - skarnet's small supervision suite</title>
    <meta name="Description" content="s6 - skarnet's small supervision suite" />
    <meta name="Keywords" content="s6 unix administration root pipe laurent bercot ska skarnet supervision runit" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> s6 </h1>

<h2> What is it&nbsp;? </h2>

<p>
 s6 is a small suite of programs for UNIX, designed to allow process supervision
(a.k.a service supervision),
in the line of <a href="https://cr.yp.to/daemontools.html">daemontools</a>
and <a href="http://smarden.org/runit/">runit</a>, 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.
</p>

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

<ul>
 <li> <a href="https://en.wikipedia.org/wiki/Syslog">syslogd</a> functionality,
using much less resources than the traditional syslogd. </li>
 <li> Reliable service readiness notification, which is the basis for
service dependency management. </li>
 <li> Controlled privileged gain as with
<a href="https://en.wikipedia.org/wiki/Sudo">sudo</a>, without using
any suid programs. </li>
 <li> The useful parts of
<a href="https://0pointer.net/blog/projects/socket-activation.html">socket
activation</a><sup><a href="#fn1" id="r1">[1]</a></sup>
without having to change application code or link servers
against any specific library, and without having to switch to any
specific init system. </li>
</ul>

<p>
 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 <a href="#related">related resources</a> section
below for pointers to more resources, and earlier approaches to process
supervision that might help you understand the basics.
</p>

<hr />

<ul>
<li> A <a href="overview.html">high-level overview</a> of s6 </li>
<li> <a href="why.html">Why another supervision suite?</a> Isn't <a href="http://smarden.org/runit/">runit</a> good enough?</li>
<li> What is <a href="ftrig.html">instant notification</a>? What does the
<a href="libs6/ftrigr.html">ftrigr library</a> do exactly?</li>
<li> How to run an s6-svscan-based supervision tree <a href="s6-svscan-not-1.html">without replacing init</a> </li>
<li> How to <a href="s6-svscan-1.html">replace init</a> </li>
<li> How to perform <a href="socket-activation.html">socket activation
with s6</a> </li>
</ul>

<hr />

<h2> Installation </h2>

<h3> Requirements </h3>

<ul>
 <li> A POSIX-compliant system with a standard C development environment </li>
 <li> GNU make, version 3.81 or later </li>
 <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
2.10.0.2 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. </li>
 <li> Optional: <a href="//skarnet.org/software/execline/">execline</a> version
2.7.0.1 or later. When s6 is built with execline support (which is the default),
execline is a build-time requirement, and also a run-time requirement for
certain binaries that spawn scripts interpreted with
<a href="//skarnet.org/software/execline/execlineb.html">execlineb</a>. </li>
</ul>

<p>
 The following optional dependencies are also supported:
</p>

<ul>
 <li> If you're using <a href="https://www.musl-libc.org/">musl</a> and
want nsswitch-like functionality:
<a href="//skarnet.org/software/nsss/">nsss</a> version
0.1.0.0 or later (build-time and boot-time) </li>
</ul>

<h3> Licensing </h3>

<p>
 s6 is free software. It is available under the
<a href="https://opensource.org/licenses/ISC">ISC license</a>.
</p>

<h3> Download </h3>

<ul>
 <li> The current released version of s6 is <a href="s6-2.10.0.2.tar.gz">2.10.0.2</a>. </li>
 <li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6/">s6
git repository</a>:
<pre> git clone git://git.skarnet.org/s6 </pre> </li>
 <li> There's also a
<a href="https://github.com/skarnet/s6">GitHub mirror</a>
of the s6 git repository. </li>
</ul>

<h3> Compilation </h3>

<ul>
 <li> See the enclosed INSTALL file for installation details. </li>
</ul>

<h3> Upgrade notes </h3>

<ul>
 <li> <a href="upgrade.html">This page</a> lists the differences to be aware of between
the previous versions of s6 and the current one. </li>
</ul>

<hr />

<h2> Reference </h2>

<p>
 If you prefer to read this documentation as man pages, it is now possible!
There is a <a href="https://github.com/flexibeast/s6-man-pages">project</a> that
ports the s6 documentation to a set of man pages.
</p>

<h3> Commands </h3>

<p>
 All these commands exit 111 if they encounter a temporary error, and
100 if they encounter a permanent error - such as a misuse. They exit
127 if they're trying to execute into a program and cannot find it, and
126 if they fail to execute into a program for another reason.
Short-lived commands exit 0 on success.
</p>

<h4> Supervision system </h4>

<p>
 <a href="s6-svscan.html">s6-svscan</a> and <a href="s6-supervise.html">s6-supervise</a>
are the long-lived processes maintaining the supervision tree. Other programs are
a user interface to control those processes and monitor service states.
</p>

<ul>
<li><a href="s6-svscan.html">The <tt>s6-svscan</tt> program</a></li>
<li><a href="s6-svscanctl.html">The <tt>s6-svscanctl</tt> program</a></li>
<li><a href="s6-supervise.html">The <tt>s6-supervise</tt> program</a></li>
<li><a href="s6-svc.html">The <tt>s6-svc</tt> program</a></li>
<li><a href="s6-svok.html">The <tt>s6-svok</tt> program</a></li>
<li><a href="s6-svstat.html">The <tt>s6-svstat</tt> program</a></li>
<li><a href="s6-svperms.html">The <tt>s6-svperms</tt> program</a></li>
<li><a href="s6-svwait.html">The <tt>s6-svwait</tt> program</a></li>
<li><a href="s6-svlisten1.html">The <tt>s6-svlisten1</tt> program</a></li>
<li><a href="s6-svlisten.html">The <tt>s6-svlisten</tt> program</a></li>
<li><a href="s6-notifyoncheck.html">The <tt>s6-notifyoncheck</tt> program</a></li>
<li><a href="s6-svdt.html">The <tt>s6-svdt</tt> program</a></li>
<li><a href="s6-svdt-clear.html">The <tt>s6-svdt-clear</tt> program</a></li>
<li><a href="s6-permafailon.html">The <tt>s6-permafailon</tt> program</a></li>
</ul>

<h4> Daemontools-like utilities </h4>

<p>
 These programs are a rewrite of the corresponding utilities from
<a href="https://cr.yp.to/daemontools.html">daemontools</a>, with
a few extras.
</p>

<ul>
<li><a href="s6-envdir.html">The <tt>s6-envdir</tt> program</a></li>
<li><a href="s6-envuidgid.html">The <tt>s6-envuidgid</tt> program</a></li>
<li><a href="s6-fghack.html">The <tt>s6-fghack</tt> program</a></li>
<li><a href="s6-setsid.html">The <tt>s6-setsid</tt> program</a></li>
<li><a href="s6-setuidgid.html">The <tt>s6-setuidgid</tt> program</a></li>
<li><a href="s6-applyuidgid.html">The <tt>s6-applyuidgid</tt> program</a></li>
<li><a href="s6-softlimit.html">The <tt>s6-softlimit</tt> program</a></li>
<li><a href="s6-tai64n.html">The <tt>s6-tai64n</tt> program</a></li>
<li><a href="s6-tai64nlocal.html">The <tt>s6-tai64nlocal</tt> program</a></li>
</ul>

<h4> Fifodir management, notification and subscription </h4>

<p>
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
<a href="ftrig.html#notification">inter-process notification and
synchronization</a>.
</p>

<ul>
<li><a href="s6-mkfifodir.html">The <tt>s6-mkfifodir</tt> program</a></li>
<li><a href="s6-cleanfifodir.html">The <tt>s6-cleanfifodir</tt> program</a></li>
</ul>
<ul>
<li><a href="s6-ftrig-notify.html">The <tt>s6-ftrig-notify</tt> program</a></li>
</ul>
<ul>
<li><a href="s6-ftrig-wait.html">The <tt>s6-ftrig-wait</tt> program</a></li>
<li><a href="s6-ftrig-listen1.html">The <tt>s6-ftrig-listen1</tt> program</a></li>
<li><a href="s6-ftrig-listen.html">The <tt>s6-ftrig-listen</tt> program</a></li>
</ul>
<ul>
<li><a href="libs6/s6-ftrigrd.html">The <tt>s6-ftrigrd</tt> internal program</a></li>
</ul>

<h4> Local service management and access control </h4>

<ul>
<li><a href="s6-ipcclient.html">The <tt>s6-ipcclient</tt> program</a></li>
<li><a href="s6-ipcserver.html">The <tt>s6-ipcserver</tt> program</a></li>
<li><a href="s6-ipcserver-socketbinder.html">The <tt>s6-ipcserver-socketbinder</tt> program</a></li>
<li><a href="s6-ipcserverd.html">The <tt>s6-ipcserverd</tt> program</a></li>
<li><a href="s6-ioconnect.html">The <tt>s6-ioconnect</tt> program</a></li>
</ul>
<ul>
<li><a href="s6-ipcserver-access.html">The <tt>s6-ipcserver-access</tt> program</a></li>
<li><a href="s6-connlimit.html">The <tt>s6-connlimit</tt> program</a></li>
</ul>
<ul>
<li><a href="s6-accessrules-cdb-from-fs.html">The <tt>s6-accessrules-cdb-from-fs</tt> program</a></li>
<li><a href="s6-accessrules-fs-from-cdb.html">The <tt>s6-accessrules-fs-from-cdb</tt> program</a></li>
</ul>

<h4> suidless privilege gain </h4>

<ul>
<li><a href="s6-sudo.html">The <tt>s6-sudo</tt> program</a></li>
<li><a href="s6-sudoc.html">The <tt>s6-sudoc</tt> program</a></li>
<li><a href="s6-sudod.html">The <tt>s6-sudod</tt> program</a></li>
</ul>

<h4> Logging </h4>

<ul>
<li><a href="s6-log.html">The <tt>s6-log</tt> program</a></li>
<li><a href="ucspilogd.html">The <tt>ucspilogd</tt> program</a></li>
</ul>

<h4> Management of user supervision trees </h4>

<ul>
<li><a href="s6-usertree-maker.html">The <tt>s6-usertree-maker</tt> program</a></li>
</ul>

<h4> Timed lock acquisition </h4>

<ul>
<li><a href="s6-setlock.html">The <tt>s6-setlock</tt> program</a></li>
<li><a href="libs6/s6lockd.html">The <tt>s6lockd</tt> program</a></li>
<li><a href="libs6/s6lockd-helper.html">The <tt>s6lockd-helper</tt> internal program</a></li>
</ul>

<h4> fd-holding, a.k.a. the sensible part of socket activation </h4>

<ul>
<li><a href="s6-fdholder-daemon.html">The <tt>s6-fdholder-daemon</tt> program</a></li>
<li><a href="s6-fdholderd.html">The <tt>s6-fdholderd</tt> program</a></li>
</ul>
<ul>
<li><a href="s6-fdholder-store.html">The <tt>s6-fdholder-store</tt> program</a></li>
<li><a href="s6-fdholder-retrieve.html">The <tt>s6-fdholder-retrieve</tt> program</a></li>
<li><a href="s6-fdholder-delete.html">The <tt>s6-fdholder-delete</tt> program</a></li>
<li><a href="s6-fdholder-list.html">The <tt>s6-fdholder-list</tt> program</a></li>
<li><a href="s6-fdholder-getdump.html">The <tt>s6-fdholder-getdump</tt> program</a></li>
<li><a href="s6-fdholder-setdump.html">The <tt>s6-fdholder-setdump</tt> program</a></li>
<li><a href="s6-fdholder-transferdump.html">The <tt>s6-fdholder-transferdump</tt> program</a></li>
</ul>

<h3> Libraries </h3>

<ul>
<li><a href="libs6/"><tt>s6/s6.h</tt>, the main entry point</a></li>
<li><a href="libs6/ftrigw.html">The <tt>ftrigw</tt> library interface</a></li>
<li><a href="libs6/ftrigr.html">The <tt>ftrigr</tt> library interface</a></li>
<li><a href="libs6/s6lock.html">The <tt>s6lock</tt> library interface</a></li>
<li><a href="libs6/accessrules.html">The <tt>accessrules</tt> library interface</a></li>
<li><a href="libs6/s6-fdholder.html">The <tt>s6-fdholder</tt> library interface</a></li>
</ul>

<h3> Definitions </h3>

<ul>
<li> What is a <a href="fifodir.html">fifodir</a></li>
<li> What is a <a href="servicedir.html">service directory</a></li>
<li> What is a <a href="scandir.html">scan directory</a></li>
<li> What is a <a href="localservice.html">local service</a></li>
<li> Why are the <a href="ftrig.html">libftrigw and libftrigr</a> needed </li>
</ul>

<hr />

<a name="related">
<h2> Related resources </h2>
</a>

<h3> s6 manual pages </h3>

<ul>
 <li> <a href="https://github.com/flexibeast">flexibeast</a> is doing the ungrateful
but valuable work of
<a href="https://github.com/flexibeast/s6-man-pages">providing the s6 documentation
as a set of man pages</a>. </li>
</ul>

<h3> Other components for s6-based init systems </h3>

<ul>
 <li> <a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a>
is a package to help you create a <tt>/sbin/init</tt> binary booting a
Linux system with s6-svscan as process 1. </li>
 <li> <a href="https://github.com/just-containers/s6-overlay">s6-overlay</a>
is a project that automates integration of s6 into Docker images. </li>
 <li> <a href="//skarnet.org/software/s6-rc/">s6-rc</a> is a
dependency-based service manager for s6. </li>
 <li> <a href="https://jjacky.com/anopa">anopa</a> is another dependency-based
service manager for s6. </li>
</ul>


<h3> s6 discussion </h3>

<ul>
 <li> <tt>s6</tt> is discussed on the
<a href="//skarnet.org/lists.html#supervision">supervision</a> mailing-list. </li>
 <li> There is a <tt>#s6</tt> IRC channel on Freenode. Sometimes people are there
and answer questions. </li>
</ul>

<h3> Similar work </h3>

<ul>
 <li> <a href="https://cr.yp.to/daemontools.html">daemontools</a>, the pioneering
process supervision software suite. </li>
 <li> <a href="https://untroubled.org/daemontools-encore/">daemontools-encore</a>,
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.) </li>
 <li> <a href="http://smarden.org/runit/">runit</a>, a slightly different
approach to process supervision, with the same goals. </li>
 <li> <a href="http://b0llix.net/perp/">perp</a>, yet another slightly different
approach to process supervision, also with the same goals. </li>
 <li> <a href="http://jdebp.eu./Softwares/nosh/">nosh</a>
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. </li>
</ul>

<h3> Other init systems </h3>

<ul>
 <li> Felix von Leitner's <a href="https://www.fefe.de/minit/">minit</a> is an
init system for Linux, with process supervision capabilities. </li>
 <li> <a href="https://git.suckless.org/sinit">suckless init</a> 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. </li>
 <li> <a href="https://nongnu.org/sysvinit/">sysvinit</a> is the
traditional init system for Linux. </li>
 <li> <a href="https://upstart.ubuntu.com/">Upstart</a> 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.</li>
 <li> <a href="//skarnet.org/software/systemd.html">systemd</a> is a problem in its own category. </li>
 <li> The various BSD flavors have their own style of
<a href="https://www.freebsd.org/doc/handbook/boot-init.html">init</a>. </li>
 <li> MacOS X has its own init spaghetti monster called
<a href="https://en.wikipedia.org/wiki/Launchd">launchd</a>. </li>
</ul>

<p>
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.
<a href="s6-svscan-1.html#stages">There is a good reason for this.</a>
</p>


<h2> Miscellaneous </h2>

<h3> Why "s6"&nbsp;? </h3>

<p>
<strong>s</strong>karnet.org's <strong>s</strong>mall and <strong>s</strong>ecure
<strong>s</strong>upervision <strong>s</strong>oftware <strong>s</strong>uite.
</p>

<p>
 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.
</p>

<h3> Footnotes </h3>

<section>
 <p id="fn1"><a href="#r1"><sup>[1]</sup></a>
 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.)
 </p>
</section>

</body>
</html>