Arch and RunitCONTENT
So, after months, I finally come back to this site to write random things I probably have zero knowledge or zero authority to write and (maybe) I will be yelled because of it, so if you do think something is wrong with this writing, please send me an e-mail.
systemd is a very controversial topic, some people likes it because it makes their life easier, some people don’t like it, some people treat it like it’s the end of Linux.
Personally, I have no problems with systemd, I will gladly use it without any complaints. However, I’m always fascinated in alternative solutions for init and service management, like OpenRC and runit, for instance.
Now, I have tried OpenRC because I have tried Gentoo, but I found them rather.. uninteresting, and needlessly complicated. So I tried to find another solution.
That’s where I found runit.
Now runit really fascinates me, because it’s that simple. Three stages: booting, running, and shutdown. That’s what your computer will ever need.
According to runit’s site:
runit performs the system’s booting, running and shutting down in three stages:
Stage 1: runit starts
/etc/runit/1 and waits for it to terminate. The system’s one time initialization tasks are done here.
/etc/runit/1 has full control over
/dev/console to be able to start an emergency shell in case the one time initialization tasks fail.
Stage 2: runit starts
/etc/runit/2 which should not return until the system is going to halt or reboot; if it crashes, it will be restarted. Normally,
/etc/runit/2 runs runsvdir. In Stage 2 runit optionally handles the INT signal (ctrl-alt-del keyboard request on Linux/i386).
Stage 3: If runit is told to halt or reboot the system, or Stage 2 returns without errors, it terminates Stage 2 if it is running, and runs
/etc/runit/3. The systems tasks to shutdown and halt or reboot are done here.
My immediate reaction was: “that’s it?” So I decided to take a look at one of those
/etc/runit/1 files, which is provided by those guys at Void Linux. I begin to understand how a system was booted up, and decided to use runit instead of both systemd or OpenRC.
Now, one of my favorite distribution is Arch Linux (By the way, did you know I used Arch?) and it’s been very comfortable to use it so I don’t see why I should switch. I tried Void, but I kept coming back. So I thought, why don’t I bring runit to Arch?
There are few attempts to bring runit into Arch, you can see them in the AUR, but that probably utilizes the old Arch initscripts (I only used Arch after their migration to systemd, so I have no idea about their initial initscripts), and there is one attempt to bring runit to Arch, but it seems that the project is dead and not maintained.
There’s a Linux distribution project named Artix which aims to be Arch, but without systemd. So they used OpenRC as their default init instead.
However, I asked one of their devs (do you guys have interest in Runit as an alternative init system?), he agreed to it, and I decided to start working on it.
Initially, I imported void-runit to Artix (in this case, because the dev I asked has another side project named Cromnix, I decided to import it there (since I have no access to that repo, I do it to my repo, and make the changes, and he takes it to his project’s repo, and distribute it to Artix) first) verbatim, deleting very Void-specific changes (such as dracut). First try, it works! A little bit clunky because there are some things missing, but that can be done later.
Initially, I also imported their service directories (I called them runscripts, but I don’t know should I regret this or not) verbatim from Void, only deleting the parts where /etc/runit/1 handles the job.
However, there are some services that are not available on runit, and I had to import them from somewhere else, or just write them.
I am pleasantly surprised that most things run well in Artix runit (at least with the packages I have tested personally), but there are some use cases where a verbatim import doesn’t work, so I had to edit it so it runs in Artix (such as system user and directories, where Artix and Void handles in different ways). However, as of now, runit in Artix is working good.
Anyway, thanks to Artix Linux (especially ccromer), and shoutout to ServiceRobot for testing runit in Artix and pointed out all errors that have happened!