Skip to main content
Topic: [Tracker] s6 support (Read 291 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[Tracker] s6 support

This is the thread for tracking s6 support in Artix.

What is it?
s6 is a daemontools-like init system, service manager, and process supervisor.

How does it compare to runit or openrc?
s6 has more in common with runit since runit is also daemontools-like, but it is a bit more complex. One of the main strengths of s6 is its ability to guarantee proper service dependency management as well as truly parallelized service startup. runit is parallel, but it requires scripts to manually write a check function which may not be perfect. Openrc's dependency management works well but its parallel implementation is still considered experimental since it can possibly lock the machine during boot. See the author's page for a little more of his argument.

Current status:
Most basic pieces are in place however the main init switching part is still in progress.

Currently, various s6-related packages are in the goblins repo. You will have to enable the repo in your /etc/pacman.conf. None of the the packages there will change your init system. They simply install various libs, binaries, and init scripts needed for an s6 system. Nevertheless the usual disclaimer applies, proceed with caution since the goblins repo is essentially experimental.

If you had previously installed my s6 AUR packages, replace them with the versions in the goblins repo ASAP. I completely rewrote the hooks and install scripts for greater flexibility. On this machine, I was surprisingly able to replace all of the packages without any file conflicts, but I can't guarantee that will happen for everyone so use the --overwrite/--force flags with caution. There (hopefully) shouldn't be any more major changes like this in the future.

From the goblins' repo, skalibs, execline, s6, and s6-rc are mandatory packages. Additionally, a handful of service scripts are available (suffixed with *-s6). Due to how modular s6's parts are, you can install s6 scripts without even needing to change your init. Most likely, you'll want agetty-s6 (for other ttys), dhcpcd-s6 (internet of course), and eudev-s6 (no udev is no fun). After you're done with all that (if you wish), you can proceed to the next step to replace your init and run an s6 system.

Disclaimer: This last part is not official yet. The s6 init binaries still need to be integrated within artix-sysvcompat and that will take some time to iron out given s6's extra kinks. However, you can still replace the init and get a semi-official s6 Artix system up and running. This depends on @konmex's runit-rc. Install it and be sure you are on the latest version (20190913-1) or else you'll have problems. Now to replace init just use your favorite AUR helper (for example, trizen) to grab it from AUR.

Code: [Select]
$ trizen -S s6-linux-init

Note: Installing the above package will make new init-related binaries and move your old ones to /tmp. Also it does not conflict with any existing init system at this time (mainly for easier testing) meaning that you can install it with openrc or runit. Of course, it will mess up your symlinks and old binaries so don't run this if you are not willing to replace the entire init.

You should have skalibs, execline, s6, s6-rc, and s6-linux-init which is everything you need for booting. Shell scripts are located in /etc/s6-linux-init/current/scripts which are executed at every bootup and shutdown. You can modify them to your liking. After a reboot, you should have a working and functional s6 system. Make sure you didn't forget to install an s6 script and then reboot your system (the old reboot binary should be in your /tmp directory so "sudo /tmp/reboot").

Hopefully the reboot goes smoothly without any hitches. Now that you are actually running an s6-based system, you can start customizing your services and playing with the s6-rc database. The s6-rc packages are configured to start the "default" bundle if it exists on boot. You can add any services you want to a bundle. This is basically like using openrc's runlevels. So to add services to the default bundle you can simply do this:
Code: [Select]
# s6-rc-bundle add default dhcpcd udevd agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6
Note that due to the way s6-rc's database works, you have to first delete a bundle (s6-rc-bundle delete "name") and then add it again if you want to modify it. "agetty-tty1" is provided by the s6-init binary itself so there is no need worry about adding that to s6-rc as a service. To startup the bundle it's just simply:
Code: [Select]
# s6-rc -u change default

Of course, you can also individual start services in the same way. So for example:
Code: [Select]
# s6-rc -u change dhcpcd

I won't be covering all possible usage here (please consult s6-rc's faq for more details) but here are some quick tips. s6-rc uses a database approach to managing services which makes it a little more complex. The s6 packages I put together hide most of the boilerplate in the background so you shouldn't have to worry too much about it (scripts are installed in /etc/s6/sv if you need to know), but look at s6's documentation if you want more details.

To bring up a service/bundle:
Code: [Select]
# s6-rc -u change service

To bring down a service/bundle:
Code: [Select]
# s6-rc -d change service

To list all available services:
Code: [Select]
# s6-rc -d list

To generate a new database:
Code: [Select]
# s6-rc-compile /destdir /sourcedir

To update the database:
Code: [Select]
# s6-rc-update /path/to/compiled-database

Re: Unofficial s6 support guide

Reply #1
Updated the OP in light of the newest version of runit-rc being pushed to stable. If you had manually edited the file before, you can just do a quick "pacman -Sy --force runit-rc" to make sure the file gets overwritten with the upstream changes.

Re: Unofficial s6 support guide

Reply #2
There's no point in duplicating work if you don't have to
In this case why you don't use 66?
boot-66serv (complete set of service to boot properly your system): (use the tag not the commit)
66 (complete set of tools to manage your service): (use tag not the commit)
Complete Documentation are also available:
Set of service:
66 PKGBUILD: (use version not trunk)
boot-66serv PKGBUILD: (use version not trunk)
Obarun : free to control your system

Re: Unofficial s6 support guide

Reply #3
To be quite honest, I haven't really looked into 66. I'll be sure to look at it in more detail in the future.

Re: [Tracker] s6 support

Reply #4
Great news. s6 support has made some progress over the weekend and is now (mostly) official. I've updated the OP of this thread to reflect that change. Various s6 packages are now available in the goblins repo (you will have to enable that in your /etc/pacman.conf). These will be in goblins for at least the time being since we're still at the experimental stage here.

If you had previously installed my s6 AUR packages, please replace them with the goblins version ASAP as there were some large changes. The main star of the show here (s6-linux-init; which actually makes and replaces your init) is still AUR only since we need to figure out how to integrate it with artix-sysvcompat, but everything else is in the repos now.

If you have any service script requests and or just general questions feel free to ask me here (or in IRC). A future goal of mine is to figure out how to port s6 service scripts to execline (a different scripting language made specifically for s6), but for now I'm just doing them in shell since they work fine. And "doing them" might be a bit too much of an exaggeration because most of the time it's just copying the runit script with a few modifications.

Re: [Tracker] s6 support

Reply #5
Goblins repo? Do you mean gremlins?

Edit: Ah it is indeed goblins, thought it was an error.
Assuming s6 doesn't do some of those out of the box there are quite a couple of services in the boot runlevel of openrc that might need a script for a conversion, namely dmcrypt.

Re: [Tracker] s6 support

Reply #6
Man is as good as his tools.

Re: [Tracker] s6 support

Reply #7
Oh I see, I was purely going from the commented pacman.conf

Re: [Tracker] s6 support

Reply #8
Oh I see, I was purely going from the commented pacman.conf

Normally, you don't really want to use the goblins repos, unless you know exactly what you are doing.
These repos contain rebuilds, and chances are high you break your system if you catch eg with s6 other updates as it currently also contains llvm9.

s6 is parked there until deemed to not be breaking any depends with other inits, once all works as expected, s6 packages will move in gremlins.

Re: [Tracker] s6 support

Reply #9
Apologies, the information the OP is a tad outdated. If you're careful, you can use the s6 goblins packages right now (which has everything for a basic s6 system) but you would need to force an install of runit-rc somehow otherwise your system won't be too useful (dev/sys/proc/ doesn't mount, no cgroups, etc.). Currently the hold up is that I need to put together a package that contains a list of oneshot startup services for s6 and make that a dependency. Runit-rc does actually accomplish this, but it makes more sense to launch it in a way that actually integrates with s6 (namely s6-rc).

Assuming s6 doesn't do some of those out of the box there are quite a couple of services in the boot runlevel of openrc that might need a script for a conversion, namely dmcrypt.

dmcrypt actually works with runit-rc (I'm using on this machine right now in fact), but yes the plan is for it to be provided as part of a set of oneshot startup scripts for s6-rc.