Published: 2024-08-27T13:05:09+02:00runit is being removed from Gentoo.
With the removal of runit from the Gentoo package repository, I have finally been forced to migrate to something new for managing user services on a system without systemd.
Gentoo's "default" init service is OpenRC, a modern alternative to the traditional SysV init (or other SysV-esque, like upstart) that was commonplace in most Linux distros up until ~2015, when systemd started taking over basically everywhere. Today, the landscape is very different:
Gentoo has, for a very long time, used OpenRC as its default init system. But Gentoo also has official support for systemd. Because of this dual support, the efforts of the Gentoo developers have resulted in major applications that would otherwise have hard systemd dependency being able to run on other init systems. Most notably, patches for the GNOME desktop are maintained by Gentoo developers to make it work with OpenRC.
One of the biggest missing features in OpenRC, for me, is user services. This is something systemd does very well. You just stick --user on a systemctl command, and you can run unprivileged services from your local user account.
User services are perfect for things like:
They're great for anything that needs to run all the time and stay out of your way.
https://wiki.gentoo.org/wiki/OpenRC/User_servicesOpenRC does not truly support user services. The best support for a "user service" with OpenRC is running a system-level service as a specific user. This is fine for basic single-user use cases, but still requires root access to modify or create new services. There are some other approaches in the wiki, but they are (in my opinion) even more hacky or complicated.
https://github.com/navi-desu/openrc/Luckily, there is now a fork of OpenRC (called OpenRC-Navi) that adds user service support to OpenRC. The fork is available in Gentoo as sys-apps/openrc-navi. The original is available as sys-apps/openrc.
Creating user services with the fork of OpenRC is straightforward; it's basically the same as creating system services.
Official User Service Guide OpenRC Service Script GuideIn summary:
At the time of writing, here are some issues I ran into while porting my runit scripts to OpenRC scripts:
Here is an example user service for an rclone mount.
/files/openrc/rclone-mountThe service meant to be symlinked, one for each specific rclone mountpoint to be created. For example, if you have an rclone mountpoint called `nextcloud:`, then you would need to execute shell some commands like this:
ln -s ~/.config/openrc/init.d/rclone-mount ~/.config/openrc/init.d/rclone-mount.nextcloud echo 'RCLONE_REMOTE=nextcloud:"' >> ~/.config/openrc/conf.d/rclone-mount.nextcloud echo LOCAL_MOUNTPOINT=/mnt/nextcloud"' >> ~/.config/openrc/conf.d/rclone-mount.nextcloud rc-update -U add rclone-mount.nextcloud default rc-service -U rclone-mount.nextcloud start
Instead of using a fork of OpenRC, there are a few alternatives on a Gentoo system:
Hopefully, the user service feature of OpenRC-Navi makes its way back upstream into the main version of OpenRC.
License: CC-BY-SA-4.0.
‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗
⤴️ [/posts] 🏠 Home