skarnet / s6 Goto Github PK
View Code? Open in Web Editor NEWThe s6 supervision suite.
Home Page: https://skarnet.org/software/s6/
License: ISC License
The s6 supervision suite.
Home Page: https://skarnet.org/software/s6/
License: ISC License
Following the standard build-from-code process
RUN cd /tmp && git clone git://git.skarnet.org/skalibs && cd skalibs && ./configure && make && make install
RUN cd /tmp && git clone git://git.skarnet.org/execline && cd execline && ./configure && make && make install
RUN cd /tmp && git clone git://git.skarnet.org/s6 && cd s6 && ./configure && make && make install
However, now we get build failures stating that recipe for target 's6-ftrig-listen' failed
because cannot find -lexecline
This seems to be directly correlated to the recent #82e33dd
Any thoughts? Or have build instructions changed?
Thanks,
Ray
I have been trying to make readiness notification work for snmpd daemon but somehow I always end up in errno 9 EBADF 9 Bad file descriptor
Below is the readiness snippet in snmpd
#ifdef S6_NOTIFY
#define NOTIFY_FD 9
if (write(NOTIFY_FD, "\n", 1) > 0) {
close(NOTIFY_FD);
printf("notifying s6 success\n");
} else {
printf("notifying s6 failed with errno=%d\n", errno);
}
#endif
And below are the contents in snmpd-srv directory
root@(none):/etc/s6/source/snmpd-srv# cat notification-fd
9
root@(none):/etc/s6/source/snmpd-srv#
root@(none):/etc/s6/source/snmpd-srv# cat run
#!/bin/execlineb -P
foreground { echo "snmp service started" }
/usr/local/sbin/snmpd -f
root@(none):/etc/s6/source/snmpd-srv#
root@(none):/etc/s6/source/snmpd-srv# cat type
longrun
root@(none):/etc/s6/source/snmpd-srv#
Am I missing something? Please let me know if any further information is required.
Any help is really appreciated.
Tried the .configure, but:
./configure && make && sudo make install Checking for C compiler... ... gcc Checking whether C compiler works... ... yes Checking target system type... ... x86_64-linux-gnu ./configure: error: /usr/lib/skalibs/sysdeps is not a valid sysdeps directory root@devuan:~/s6# ./configure Checking for C compiler... ... gcc Checking whether C compiler works... ... yes Checking target system type... ... x86_64-linux-gnu ./configure: error: /usr/lib/skalibs/sysdeps is not a valid sysdeps directory
I tried creating that directory, but received the same error. Any advice?
Platform: arm32v7/alpine container (Host OS is either Debian 10 amd64 or Raspberry Pi OS arm32)
s6 version: 2.10.0.2
When I execute s6-svscan, following warning messages are displayed although the services work fine.
$ cat /etc/s6/cron/run
#!/bin/sh
exec cron -f -d 8
$ s6-svscan /etc/s6
crond: crond (busybox 1.32.1) started, log level 8
s6-supervise yes: warning: can't happen: timeout while the service is up!
s6-supervise yes: warning: can't happen: timeout while the service is up!
s6-supervise yes: warning: can't happen: timeout while the service is up!
s6-2.9.1.0 does not show the messages in the same situation.
reproduce:
backtick PWD { pwd }
importas MYPATH PWD
foreground
{ mkdir -p /logs${MYPATH} }
take a look at /logs
there is a ? in the path
I followed the standard build process to install the latest s6.
It always getting issue on src/libs/s6_svc_ok.c, could you give me some guide how to solve the issue?
src/libs6/s6_svc_ok.c: In function 's6_svc_ok': src/libs6/s6_svc_ok.c:21:3: error: implicit declaration of function 'fd_islocked' [-Werror=implicit-function-declaration] r = fd_islocked(fd) ; ^ cc1: some warnings being treated as errors make: *** [Makefile:135: src/libs6/s6_svc_ok.lo] Error 1
Unfortunately many Linux distributions (for example OpenSUSE) don't provide any s6
(or execline
) builds. Moreover building s6
is not straight forward as it depends on skalibs
(with the same fate).
Therefore it would be nice if you could provide an already-built set of binaries (perhaps statically linked) at least for x86_64.
Alternatively in order to improve compatibility with as many Linux distributions, you could:
rpath
feature to link the skalibs
.so
as relative to where the binaries live; (say you provide a bin
and lib
folder that should always be kept side-by-side;).so
(except the ones provided by libc
);I really like s6. I strive to use it, but I do sometimes struggle at times.
I note that all the tools only have terse usage built in. For example s6-svc
:
alpine312:~$ s6-svc --help
s6-svc: usage: s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduxOX ] servicedir
IIUC --help
doesn't exist, and its just the error in usage triggering the output. The meaning of -a
, or -wu
etc isn't in the output.
Contrast to another tool like service
(Alpine Linux):
alpine312:~$ service --help
Usage: rc-service [options] [-i] <service> <cmd>...
or: rc-service [options] -e <service>
or: rc-service [options] -l
or: rc-service [options] -r <service>
Options: [ cdDe:ilr:INsSZChqVv ]
-d, --debug set xtrace when running the command
-D, --nodeps ignore dependencies
-e, --exists <arg> tests if the service exists or not
<snip>
I don't use s6
or skalib
suite tools all the time and I'm quite forgetful. I need to google the documentation to do simple things because its not clear from commands what they do without the memorising or looking up the documentation. Which is fine. I'm just curious on the rational behind it. Is it purely to minimise the file size and, programming complexity, a separation of concerns, or something else?
I know in alpine I can install the s6-doc
package which has HTML documentation, and there's an on-going effort to port man-pages in https://github.com/flexibeast/s6-man-pages, which includes s6-svc
. These are what I need for a self-contained system to avoid going online.
I use a docker image which uses s6. I added my own custom /etc/s6/custom/run
s6 service script, which performs some work (only once), and then must not be restarted.
I thought if that script simply creates a /etc/s6/custom/down
file, the service will not be restarted - but it is.
So instead the script performs its work, then does this: $ s6-svc -D /etc/s6/custom
. That seems to work.
But I'm calling s6 from inside an s6 service. I wonder whether that is a supported scenario, or whether I am asking for trouble?
I have installed and set up s6 yesterday, but I have read through the docs and there are a bunch of things I cannot understand.
Would you mind answering these few?
Thanks
s6/src/libs6/s6_supervise_lock_mode.c
Line 20 in 3ea0b28
XBPS packages are delivered with supervise pointing to a yet-to-exist location in /run
. For example, openntpd
has the following links:
/etc/sv/openntpd/log/supervise -> /run/runit/supervise.openntpd-log
/etc/sv/openntpd/supervise -> /run/runit/supervise.openntpd
Ideally, s6-supervise would resolve the link and attempt to create the directories in /run
.
We are using notifyoncheck to call the data/check program with -t 5000
to set a 5 second timeout for the check program to exit. There are times when the logic of the check script hangs (child process never returns). In this case, I expect notifyoncheck to kill the check and start a new one. However we are seeing multiple checks all running in the same time.
Based on https://github.com/skarnet/s6/blob/master/src/supervision/s6-notifyoncheck.c#L254, it seems like contrary to the documentation, the process is not killed and another check is performed.
Running the s6-svscanboot on Illumos gives the following error:
s6-svscan: fatal: unable to selfpipe_init: No such file or directory
No matter how I try to run s6-svscan it gives the same error.
Using binaries from v1.21.8.0/s6-overlay-amd64.tar.gz:
[root@localhost bin]# s6-setuidgid root uptime
00:29:31 up 2:56, 2 users, load average: 0.00, 0.01, 0.00
[root@localhost bin]# s6-setuidgid root:root uptime
s6-applyuidgid: usage: s6-applyuidgid [ -z ] [ -u uid ] [ -g gid ] [ -G gidlist ] [ -U ] prog...
Can't get s6-applyuidgid to run properly:
[root@localhost bin]# s6-applyuidgid -u root uptime
s6-applyuidgid: usage: s6-applyuidgid [ -z ] [ -u uid ] [ -g gid ] [ -G gidlist ] [ -U ] prog...
Hi all. Add support for i18n so that users can translate and use languages other than English.
I've just started using s6 in some containers and I'm trying to identify a way to replicate the functionality of ExecStop in systemd? Essentially i would like to send a specific command to shutdown a process. I've attempted to use the final service file functionality as well as cont-final.d and down-signal but neither of those locations seem to execute prior to the SIGTERM being sent. Assistance is greatly appreciated.
S6 was recently supported by Artix Linux, so I wanted to try it out. I migrated my machine to use s6, and I was surprised. I noticed a slight speedup from when grub is done to when I can log in compared to runit, what I was using previously. I'm loving s6 so far, the way it works is simple yet powerful, it seems to be a lot more open-ended then runit as well.
But, onto the problem. On my T500, my current main machine, whenever I run sudo shutdown -h 0
it shuts down Xorg, kills the processes, then it just stays on system restart: system halted
and won't actually shutdown. Restarting works, however. On runit and s6 it takes a few seconds to actually restart, but I've left it on system restart: system halted
for at least 30 seconds and it stayed running, I ended up having to just hold the power button, what I have been doing. I searched around, tried a few different commands to shutdown that ended in the same problem. I thought it might have been something with the migration, so I decided to reinstall Artix and got the same problem. I'm not sure if I needed to post this to the artix forums or here, so I went with here. Any response would be greatly appreciated.
I just followed the standard build and install process for the latest s6 version.
The following error broke the installing process, see details below, could you give me some guide how to get solve this isseu.
src/libs6/s6_svc_ok.c: In function 's6_svc_ok': src/libs6/s6_svc_ok.c:21:3: error: implicit declaration of function 'fd_islocked' [-Werror=implicit-function-declaration] r = fd_islocked(fd) ; ^ cc1: some warnings being treated as errors make: *** [Makefile:135: src/libs6/s6_svc_ok.lo] Error 1
Hello @skarnet
I want to try s6 as my primary init system. I am using Gentoo and Alpine linux
It looks like Gentoo wiki page is outdated, as it refers to 0.4 and 1.0 versions of s6 (while releases show 2.x)
https://wiki.gentoo.org/wiki/S6_and_s6-rc-based_init_system
Do you happen to know of any existing manuals or success stories that describe the process of building s6 based linux system?
Perhaps you can share some of your personal experience. I've read a lot of https://skarnet.org/software/s6/ but what I think is missing is a good "How to get started" guide.
Maybe there are Linux distributions that are better suited to get started with s6 then others.
Thanks!
when i tried to compile s6 using tcc i get this error massage:
exec tcc -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -iquote src/include-local -Isrc/include -fPIC -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -pipe -Wall -std=c99 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -ffunction-sections -fdata-sections -O2 -fomit-frame-pointer -fno-stack-protector -c -o src/daemontools-extras/s6-log.o src/daemontools-extras/s6-log.c tcc: error: invalid option -- '-iquote'
the command was:
make CC=tcc install
I'm having troubles using s6-svc
to restart, reload, or shutdown a postgres service supervised by s6. It's possible I just don't understand s6 correctly, but after reading the doc multiple times I'm still stuck.
s6-svc -d
is supposed to shutdown the service but it doesn't seem to do anything.s6-svc -t
is supposed to send a SIGTERM
signal which according to PostgreSQL's doc should trigger a "Smart Shutdown", but instead it triggers a "Fast Shutdown". When I send SIGTERM
via kill it does trigger the Smart Shutdown.s6-svc -i
is supposed to send a SIGINT
signal which according to PostgreSQL's doc should trigger a "Fast Shutdown", but instead it doesn't seem to do anything. When I send SIGINT
via kill it does trigger the Fast Shutdown.s6-svc -h
is supposed to send a SIGHUP
signal which according to PostgreSQL's doc should trigger a configuration reload, but instead it doesn't seem to do anything. When I send SIGHUP
via kill it does reload the configuration.The way I know it does or doesn't do what's expected is simply by looking at PostgreSQL log file, which explicitly states whenever something is triggered.
The way I send signals with kill is:
kill -<SIGNAL_NAME> $(head -n 1 /var/lib/postgresql/13/main/postmaster.pid)
I use s6-overlay 2.2.0.1 (containing s6 2.10.0.0) and I start a PostgreSQL service with the following run file:
#!/usr/bin/with-contenv sh
s6-setuidgid postgres /usr/lib/postgresql/13/bin/postgres -D /etc/postgresql/13/main/ >> /var/log/postgresql/postgresql.log 2>&1
Did I misunderstand s6-svc documentation, or is there some issue with it?
Hi,
I certainly missing something, but when using postfix with s6-socklog (using the s6-overlay syslogd addon), I end up having the date
duplicated in every log lines. As far as I understood posfix doesn't log any date.
I ended up using S6_LOGGING_SCRIPT='n20 s1000000'
and thus removing the T
parameter, but this means that s6-log
and s6-socklog
are both logging timestamps. I wonder if this is normal.
Also, is there a way to add a server name in the log line (to be compatible with postfix log parser), to have something like
Aug 26 11:19:05 smtp postfix/postfix-script[25430]: refreshing the Postfix mail system
instead of
Aug 26 11:19:05 postfix/postfix-script[25430]: refreshing the Postfix mail system
Best regards
Recently I have been migrating services from systemd to s6. Few of my systemd services use ExecStartPost commands after ExecStart is run but I couldn't see any equivalent functionality in s6. Basically I want to run few commands as soon as my main process is started (it could be a daemon or a oneshot process). Is there a way to do this?
I was actually thinking to start a script prior to starting the main process and use s6-svwait until the service is up/ready and run the commands but I later realised that is going to work only for longrun processes and not for oneshot (since supervise doesn't run for oneshot). Any help is much appreciated.
I can't seem to get s6-svscan -s
to divert signals such as SIGPWR
and SIGRTMIN+3
on Alpine. Creating /etc/s6/services/.s6-svscan/SIGPWR
or SIGRTMIN+3
don't appear to have an effect. I even tried SIG???
since sig_name
returns ???
when it can't determine the name, but that doesn't work either for whatever reason. Presumably child_spawn0
doesn't like the question marks.
Obviously, the docs don't mention this is possible since there is an explicit list of supported signals. All of the diverted signals listed in the docs work fine. However, it would be nice to be able to handle other signals even if they're not defined in sig_table
and/or don't have a defined constant.
The primary reason for wanting SIGRTMIN+3
is for handling the lxc-stop
command gracefully without having to set lxc.signal.halt
to something else.
Perhaps s6-svscan
could fall back to using the signal number when searching for the handler script if sig_name
returns ???
, or supporting both name and number?
With the GDPR (RGPD in french) the logging policy must be stated in terms of retention duration (especially when they might contain personal data, like an IP address).
Currently s6-log does not seem to have the ability to enforce a policy like: keep the logs for at most 90 days.
It would probably needs to articulate around 2 settings:
max_retention
: logdirs should contain only archived files newer than a given time (e.g. 89 days)autorotate_duration
: rotate the log after a given time (e.g. 1 day)This last setting is necessary if a service does not log much, its timespan must be added to the max_retention
duration (if a log contains 10 days of data, then the logs will be actually kept for 89+10= 99 days).
What do you think?
At https://github.com/skarnet/s6/blob/master/doc/overview.html#L392, the link to s6-svperms is missing the .html at the end of it.
I have read your whole Blog on s6, and I have a few questions -
man
documentation for s6 and it's related binaries?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.