skarnet / s6-rc Goto Github PK
View Code? Open in Web Editor NEWA service manager for s6.
Home Page: https://skarnet.org/software/s6-rc/
License: ISC License
A service manager for s6.
Home Page: https://skarnet.org/software/s6-rc/
License: ISC License
Hi,
I'm trying to create working s6-based system with s6-rc. My problem is that s6-rc-compile
does not create compiled
file required by s6-rc-init
in destdir even from sources from examples
directory:
localhost examples # ls source/
00 fdholder-log init-diskconfig mount-proc ok-wan syslogd-srv
devd fifodir-cleanup init-eth3 mount-rwfs qmail taiclockd-4
devd-log hostapd init-lan mount-swap qmail-log taiclockd-4-log
dns-cache hostapd-log init-sysctl mount-sync qmtpd-4 udhcpc-eth3
dns-cache-log httpd-4 init-urandom mount-sys qmtpd-4-log udhcpc-eth3-log
dns-server-tcp-4 httpd-4-log init-wlan0 ntpclient smtpd-4 udhcpd-wlan0
dns-server-tcp-4-log identd-4 klogd-log ntpclient-log smtpd-4-log udhcpd-wlan0-log
dns-server-udp identd-4-log klogd-srv ok-all sshd-4 wan
dns-server-udp-log init-coldplug mount-cgroups ok-lan sshd-4-log
fdholder init-devtmpfs mount-disks ok-local syslogd-log
localhost examples # s6-rc-compile -v 3 built source/
s6-rc-compile: info: parsing source//ok-lan
s6-rc-compile: info: ok-lan has type bundle
s6-rc-compile: info: parsing source//init-sysctl
s6-rc-compile: info: init-sysctl has type oneshot
s6-rc-compile: info: parsing source//ok-local
s6-rc-compile: info: ok-local has type bundle
s6-rc-compile: info: parsing source//dns-cache-log
s6-rc-compile: info: dns-cache-log has type longrun
s6-rc-compile: info: dns-cache-log is a consumer for dns-cache
s6-rc-compile: info: parsing source//mount-cgroups
s6-rc-compile: info: mount-cgroups has type oneshot
s6-rc-compile: info: parsing source//ok-wan
s6-rc-compile: info: ok-wan has type bundle
s6-rc-compile: info: parsing source//mount-sync
s6-rc-compile: info: mount-sync has type oneshot
s6-rc-compile: info: parsing source//qmail
s6-rc-compile: info: qmail has type longrun
s6-rc-compile: info: qmail is a producer for qmail-log
s6-rc-compile: info: parsing source//ntpclient
s6-rc-compile: info: ntpclient has type longrun
s6-rc-compile: info: ntpclient is a producer for ntpclient-log
s6-rc-compile: info: parsing source//mount-swap
s6-rc-compile: info: mount-swap has type oneshot
s6-rc-compile: info: parsing source//httpd-4
s6-rc-compile: info: httpd-4 has type longrun
s6-rc-compile: info: httpd-4 is a producer for httpd-4-log
s6-rc-compile: info: parsing source//identd-4
s6-rc-compile: info: identd-4 has type longrun
s6-rc-compile: info: identd-4 is a producer for identd-4-log
s6-rc-compile: info: parsing source//sshd-4
s6-rc-compile: info: sshd-4 has type longrun
s6-rc-compile: info: sshd-4 is a producer for sshd-4-log
s6-rc-compile: info: parsing source//mount-rwfs
s6-rc-compile: info: mount-rwfs has type oneshot
s6-rc-compile: info: parsing source//mount-sys
s6-rc-compile: info: mount-sys has type oneshot
s6-rc-compile: info: parsing source//dns-server-udp-log
s6-rc-compile: info: dns-server-udp-log has type longrun
s6-rc-compile: info: dns-server-udp-log is a consumer for dns-server-udp
s6-rc-compile: info: parsing source//ntpclient-log
s6-rc-compile: info: ntpclient-log has type longrun
s6-rc-compile: info: ntpclient-log is a consumer for ntpclient
s6-rc-compile: info: parsing source//devd
s6-rc-compile: info: devd has type longrun
s6-rc-compile: info: devd is a producer for devd-log
s6-rc-compile: info: parsing source//qmtpd-4
s6-rc-compile: info: qmtpd-4 has type longrun
s6-rc-compile: info: qmtpd-4 is a producer for qmtpd-4-log
s6-rc-compile: info: parsing source//klogd-log
s6-rc-compile: info: klogd-log has type longrun
s6-rc-compile: info: klogd-log is a consumer for klogd-srv
s6-rc-compile: info: parsing source//smtpd-4-log
s6-rc-compile: info: smtpd-4-log has type longrun
s6-rc-compile: info: smtpd-4-log is a consumer for smtpd-4
s6-rc-compile: info: parsing source//wan
s6-rc-compile: info: wan has type bundle
s6-rc-compile: info: parsing source//mount-disks
s6-rc-compile: info: mount-disks has type bundle
s6-rc-compile: info: parsing source//ok-all
s6-rc-compile: info: ok-all has type bundle
s6-rc-compile: info: parsing source//devd-log
s6-rc-compile: info: devd-log has type longrun
s6-rc-compile: info: devd-log is a consumer for devd
s6-rc-compile: info: parsing source//init-urandom
s6-rc-compile: info: init-urandom has type oneshot
s6-rc-compile: info: parsing source//taiclockd-4
s6-rc-compile: info: taiclockd-4 has type longrun
s6-rc-compile: info: taiclockd-4 is a producer for taiclockd-4-log
s6-rc-compile: info: parsing source//klogd-srv
s6-rc-compile: info: klogd-srv has type longrun
s6-rc-compile: info: klogd-srv is a producer for klogd-log
s6-rc-compile: info: parsing source//fifodir-cleanup
s6-rc-compile: info: fifodir-cleanup has type longrun
s6-rc-compile: info: parsing source//udhcpc-eth3-log
s6-rc-compile: info: udhcpc-eth3-log has type longrun
s6-rc-compile: info: udhcpc-eth3-log is a consumer for udhcpc-eth3
s6-rc-compile: info: parsing source//qmtpd-4-log
s6-rc-compile: info: qmtpd-4-log has type longrun
s6-rc-compile: info: qmtpd-4-log is a consumer for qmtpd-4
s6-rc-compile: info: parsing source//init-coldplug
s6-rc-compile: info: init-coldplug has type oneshot
s6-rc-compile: info: parsing source//sshd-4-log
s6-rc-compile: info: sshd-4-log has type longrun
s6-rc-compile: info: sshd-4-log is a consumer for sshd-4
s6-rc-compile: info: parsing source//init-eth3
s6-rc-compile: info: init-eth3 has type oneshot
s6-rc-compile: info: parsing source//fdholder-log
s6-rc-compile: info: fdholder-log has type longrun
s6-rc-compile: info: fdholder-log is a consumer for fdholder
s6-rc-compile: info: parsing source//taiclockd-4-log
s6-rc-compile: info: taiclockd-4-log has type longrun
s6-rc-compile: info: taiclockd-4-log is a consumer for taiclockd-4
s6-rc-compile: info: parsing source//dns-server-tcp-4-log
s6-rc-compile: info: dns-server-tcp-4-log has type longrun
s6-rc-compile: info: dns-server-tcp-4-log is a consumer for dns-server-tcp-4
s6-rc-compile: info: parsing source//dns-server-udp
s6-rc-compile: info: dns-server-udp has type longrun
s6-rc-compile: info: dns-server-udp is a producer for dns-server-udp-log
s6-rc-compile: info: parsing source//httpd-4-log
s6-rc-compile: info: httpd-4-log has type longrun
s6-rc-compile: info: httpd-4-log is a consumer for httpd-4
s6-rc-compile: info: parsing source//identd-4-log
s6-rc-compile: info: identd-4-log has type longrun
s6-rc-compile: info: identd-4-log is a consumer for identd-4
s6-rc-compile: info: parsing source//mount-proc
s6-rc-compile: info: mount-proc has type oneshot
s6-rc-compile: info: parsing source//hostapd-log
s6-rc-compile: info: hostapd-log has type longrun
s6-rc-compile: info: hostapd-log is a consumer for hostapd
s6-rc-compile: info: parsing source//00
s6-rc-compile: info: 00 has type oneshot
s6-rc-compile: info: parsing source//udhcpd-wlan0-log
s6-rc-compile: info: udhcpd-wlan0-log has type longrun
s6-rc-compile: info: udhcpd-wlan0-log is a consumer for udhcpd-wlan0
s6-rc-compile: info: parsing source//udhcpc-eth3
s6-rc-compile: info: udhcpc-eth3 has type longrun
s6-rc-compile: info: udhcpc-eth3 is a producer for udhcpc-eth3-log
s6-rc-compile: info: parsing source//qmail-log
s6-rc-compile: info: qmail-log has type longrun
s6-rc-compile: info: qmail-log is a consumer for qmail
s6-rc-compile: info: parsing source//hostapd
s6-rc-compile: info: hostapd has type longrun
s6-rc-compile: info: hostapd is a producer for hostapd-log
s6-rc-compile: info: parsing source//init-diskconfig
s6-rc-compile: info: init-diskconfig has type oneshot
s6-rc-compile: info: parsing source//dns-cache
s6-rc-compile: info: dns-cache has type longrun
s6-rc-compile: info: dns-cache is a producer for dns-cache-log
s6-rc-compile: info: parsing source//init-lan
s6-rc-compile: info: init-lan has type oneshot
s6-rc-compile: info: parsing source//fdholder
s6-rc-compile: info: fdholder has type longrun
s6-rc-compile: info: fdholder is a producer for fdholder-log
s6-rc-compile: info: parsing source//init-devtmpfs
s6-rc-compile: info: init-devtmpfs has type oneshot
s6-rc-compile: info: parsing source//udhcpd-wlan0
s6-rc-compile: info: udhcpd-wlan0 has type longrun
s6-rc-compile: info: udhcpd-wlan0 is a producer for udhcpd-wlan0-log
s6-rc-compile: info: parsing source//init-wlan0
s6-rc-compile: info: init-wlan0 has type oneshot
s6-rc-compile: info: parsing source//syslogd-log
s6-rc-compile: info: syslogd-log has type longrun
s6-rc-compile: info: syslogd-log is a consumer for syslogd-srv
s6-rc-compile: info: parsing source//smtpd-4
s6-rc-compile: info: smtpd-4 has type longrun
s6-rc-compile: info: smtpd-4 is a producer for smtpd-4-log
s6-rc-compile: info: parsing source//dns-server-tcp-4
s6-rc-compile: info: dns-server-tcp-4 has type longrun
s6-rc-compile: info: dns-server-tcp-4 is a producer for dns-server-tcp-4-log
s6-rc-compile: info: parsing source//syslogd-srv
s6-rc-compile: info: syslogd-srv has type longrun
s6-rc-compile: info: syslogd-srv is a producer for syslogd-log
s6-rc-compile: info: making bundles for pipelines
s6-rc-compile: info: creating bundle for pipeline syslogd
s6-rc-compile: info: creating bundle for pipeline dns-server-tcp-4-pipeline
s6-rc-compile: info: creating bundle for pipeline smtpd-4-pipeline
s6-rc-compile: info: creating bundle for pipeline udhcpd-wlan0-pipeline
s6-rc-compile: info: creating bundle for pipeline fdholder-pipeline
s6-rc-compile: info: creating bundle for pipeline dns-cache-pipeline
s6-rc-compile: info: creating bundle for pipeline hostapd-pipeline
s6-rc-compile: info: creating bundle for pipeline udhcpc-eth3-pipeline
s6-rc-compile: info: creating bundle for pipeline dns-server-udp-pipeline
s6-rc-compile: info: creating bundle for pipeline klogd
s6-rc-compile: info: creating bundle for pipeline taiclockd-4-pipeline
s6-rc-compile: info: creating bundle for pipeline qmtpd-4-pipeline
s6-rc-compile: info: creating bundle for pipeline devd-pipeline
s6-rc-compile: info: creating bundle for pipeline sshd-4-pipeline
s6-rc-compile: info: creating bundle for pipeline identd-4-pipeline
s6-rc-compile: info: creating bundle for pipeline httpd-4-pipeline
s6-rc-compile: info: creating bundle for pipeline ntpclient-pipeline
s6-rc-compile: info: creating bundle for pipeline qmail-pipeline
s6-rc-compile: info: resolving bundle names
s6-rc-compile: info: converting bundle array
s6-rc-compile: info: resolving service names
s6-rc-compile: info: converting service dependency array
s6-rc-compile: info: checking database correctness
s6-rc-compile: info: writing compiled information to built
s6-rc-compile: info: writing built/n
s6-rc-compile: info: writing built/resolve.cdb
s6-rc-compile: info: writing built/db
s6-rc-compile: info: writing built/servicedirs
localhost examples # ls built/
db lock n resolve.cdb servicedirs
localhost examples #
localhost examples # s6-rc-init /home/ecko/develop/s6-rc/examples/built/
s6-rc-init: fatal: unable to open /etc/s6-rc/compiled: No such file or directory
localhost examples #
There is some system info:
localhost examples # eix s6
<...>
* app-emulation/s6-overlay
Available versions: ~1.18.1.3
Homepage: https://github.com/just-containers/s6-overlay
Description: an s6-based init system for containers
[I] sys-apps/s6
Available versions: 2.1.3.0 (~)2.2.4.3 (~)2.3.0.0 {static static-libs}
Installed versions: 2.3.0.0(19:35:33 31/10/16)(-static -static-libs)
Homepage: http://www.skarnet.org/software/s6/
Description: skarnet.org's small and secure supervision software suite
[I] sys-apps/s6-linux-init
Available versions: (~)0.0.1.4 (~)0.1.0.0 {static}
Installed versions: 0.1.0.0(20:27:42 07/12/16)(-static)
Homepage: http://www.skarnet.org/software/s6-linux-init/
Description: Generates an init binary for s6-based init systems
[I] sys-apps/s6-linux-utils
Available versions: (~)2.0.2.3 (~)2.1.0.0 {static}
Installed versions: 2.1.0.0(20:27:46 07/12/16)(-static)
Homepage: http://www.skarnet.org/software/s6-linux-utils/
Description: Set of tiny linux utilities
[I] sys-apps/s6-portable-utils
Available versions: (~)2.0.5.3 (~)2.0.6.0 {static}
Installed versions: 2.0.6.0(20:35:25 07/12/16)(-static)
Homepage: http://www.skarnet.org/software/s6-portable-utils/
Description: Set of tiny portable unix utilities
[I] sys-apps/s6-rc
Available versions: (~)0.0.2.1 (~)0.0.3.0 {static static-libs}
Installed versions: 0.0.3.0(20:27:52 07/12/16)(-static -static-libs)
Homepage: http://www.skarnet.org/software/s6-rc/
Description: Service manager for the s6 supervision suite
<...>
localhost examples #
Can you help me with this issue? Thank you!
I'm trying to add a oneshot service as a dependency to an existing s6-rc longrun service. The oneshot script takes up to a few minutes to run to prepare some data, but I get a failure due to a timeout about halfway through and the longrun service never starts. My understanding from the documentation was the oneshot should never timeout unless an explicit timeout-up file was given. I had tried adding a 10-minute timeout-up file, but I still get a timeout in less than a minute.
What would be causing this timeout? Is there a time limit to oneshot tasks?
How can I make it work with GDM.
I have installed gdm
and gdm-s6
and enabled the service via:
s6-rc-bundle-update add default gdm
.
After the boot is finished, I get a blank screen.
s6-linux-init-hpr
has options to shutdown, halt and reboot... where's suspend ?
Yes, I am using s6 + s6-rc + s6-linux-init
on my main machine. :P
P.S. What distro do you personally use? I'm curious. Mine's Artix.
The s6-rc-compile seems to be missing / not take into account dependencies created on a type=bundle service.
The documentation doesn't mention it, so I thought it might be a missed entry, given that "flag-essential" on a bundle will be propagated on all services present in the bundles content.d folder.
https://skarnet.org/software/s6-rc/s6-rc-compile.html
If you make a dependencies.d inside of a folder that has a type=bundle and add files with the names of services in it, just like you'd do with atomic services, this dependency is currently just ignored and doesn't get propagated.
Is there a way to globally define a common dependency on a whole group? I'd like to avoid having to individually go through each atomic service in a bundle and adding the dependencies.d directory for all of them.
As a few examples (yes, I know you can just "s6-mount -a" in a single service, this is just an example):
Another one:
Imagine I had more services, none of them requiring much dependencies (if any), just making sure they are in the proper "runlevel" (for lack of a better term). These would be getting included in their respective bundles, but all of them would have a "common ancestor" which can either be a bundle or a service.
When setting up serialized dependencies, it's easy, as you only need to add the immediate parent and in very rare cases a bit more than 1 dependency. But when launching a massive amount of services in parallel, that's where it gets annoying to set up dependencies (particularly if the atomic services don't even require dependencies at all, other than early startup things like udev, fs mounting and networking).
As an example of that, setting up an s6-rc service for each virtual machine I'm running would imply parent dependencies: networking (oneshot or longrun) -> iscsid (longrun) -> iscsi-login-logout (oneshot) -> vm1, vm2, vm3 etc. (longrun). But for all the VMs, the dependency has to be the iscsi-login-logout service, otherwise the VMs won't start (no attached disks). And let's say I put in the effort at first to write the dependencies.d/iscsi-login-logout at first for 300 VMs. Then something changes (say I move everything to local volumes instead of iscsi), so now I need to change 300 VMs' dependencies to something else (idk, making sure a particular disk is mounted and not in a failed state, say mount-vmdir, or zpool-import-vm-pool).
If I knew ahead of time that changes are inevitable, I'd have probably played it smart and made a bundle "vm-requirements" and added iscsi-login-logout to it and inside 300 VMs dependencies.d, I'd only have vm-requirements bundle. That'd make it trivial to just change the contents.d of the bundle from iscsi-login-logout to mount-vmdir or zpool-import-vm-pool. But I'd still have had to put in the time to write 300 dependencies.d/vm-requirements (assuming I didn't script it, which is probably what I'll do for now).
I have a couple of questions regarding services that I couldn't figure out.
Is there a way to make s6-rc to have a specific time between restarting services? I'm using an embedded processor and right now if a service fails it tries to restart immediately. I would like to set a delay appropriate to the service before it retries again. This way if lots of services fail at once for some reason, they don't hammer the system. For example, right now I have a internet connection monitoring daemon, if it fails, I'm ok to wait 5s between retries.
Is there a way to differentiate between an error that is unrecoverable and something that is not? For example as the example above, I have an internet connection daemon which might fail because a config file does not exist. I'd prefer to have it only restart if the error code is below or above a certain number .... e.g. if errorcode is < 100 then keep supervising and restart, if it's above 100 then don't supervise.
Is there some kind of failure count mechanism? There are some services I would like to retry 10 times then give up on. Once the service is running, I would like to supervise. So this is a kind of semi-supervision state.
I'm sure there are some clever ways to address my issues above, any ideas on how I could handle these cases?
Inside examples/source/00/up
, I see -
if { s6-echo "init-stage2 starting." }
s6-hostname foo.example.com
Hmm.. s6-echo and s6-hostname are no longer included in s6...
This intrigued me. Why did these programs exist in the first place?
I mean, what is wrong with the usual echo
that you needed to write
a new s6-echo
for yourself?
Vim or Emacs? Or something else? ๐
As one of those stuck with enterprise Linux, Iโve looked into the s6 constellation of software several times now as a potential drop-in replacement for (the useful parts of) systemd. And Iโm really excited about the prospect of the two remaining red squares turning green as envisaged in: https://skarnet.com/projects/service-manager.html.
I was wondering if you could give us an update on the rough timeline for this last piece of the puzzle.
Update: in the meantime, this recent piece will be helpful to others in the same shoes https://skarnet.org/software/s6/unit-conversion.html.
So far I have been using -u/-d change options to bring up or bring down a service. Is there a way to restart the service without have to run two commands?
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.