Configuring OpenRC Services on ArtixLinux: From Init Scripts to Runlevels
Learn how to create, enable, and troubleshoot OpenRC services on ArtixLinux with a concrete SSH daemon example, plus common pitfalls and verification steps.
13 Oct 2025, 09:51 UTC

The problem: services that won't start at boot
ArtixLinux uses OpenRC as its default init system. If you drop a script into /etc/init.d and expect it to run on boot, it won't—OpenRC requires an explicit runlevel link. This guide shows how to write a proper init script, configure its options, add it to the default runlevel, and verify it works, using the OpenSSH daemon as a concrete example.
OpenRC layout you need to know
- /etc/init.d/ – executable init scripts (one per service).
- /etc/conf.d/ – optional configuration files that the script sources for variables.
- /etc/runlevels/ – directories of symlinks that define which services start in each runlevel.
OpenRC reads the depend() function in each script to order startup; without it, a service may start before the network is up.
Worked example: enabling sshd on boot
1. Inspect or create the init script
Artix ships an sshd script in /etc/init.d/sshd. If you're writing your own, place it in /etc/init.d/ and make it executable:
# /etc/init.d/myservice
#!/sbin/openrc-run
name="My Custom Daemon"
description="Runs a custom network service"
command="/usr/bin/myservice"
command_args="--config /etc/myservice.conf"
pidfile="/run/myservice/myservice.pid"
# Dependency ordering – critical for network services
depend() {
need net
after firewall
}
start_pre() {
checkpath --directory --owner myservice:myservice --mode 0755 /run/myservice
}Run as root:
chmod +x /etc/init.d/myservice2. Create the matching conf.d file
Variables here keep the init script clean and allow per-host tuning without editing the script.
# /etc/conf.d/myservice
# Extra arguments passed to the daemon
MY_SERVICE_OPTS="--verbose --port 8080"
# OpenRC uses this variable to know which service to add to the default runlevel
rc_update_defaults="myservice"3. Add the service to the default runlevel
This creates the symlink /etc/runlevels/default/myservice → /etc/init.d/myservice.
rc-update add myservice defaultWhere to run: root shell on the target ArtixLinux machine.
Permissions: root (or sudo).
Expected check: ls -l /etc/runlevels/default/myservice should show the symlink.
4. Verify the service starts and runs
rc-service myservice start
rc-service myservice statusThe status output should show started and a PID that matches the running process (ps -p ).
Common mistakes and how to avoid them
| Mistake | Symptom | Fix |
|---|---|---|
Missing depend() function | Service starts before network, fails to bind ports | Add depend() { need net; } (and after for ordering) |
Forgetting rc-update add | Script works manually but not on reboot | Run rc-update add default |
Running rc-service myservice without action | Leaves service in undefined state | Always use start, stop, or restart |
| Mixing OpenRC and systemd units | Conflicting service definitions, double starts | Pick one init system; Artix provides OpenRC, runit, s6, dinit – choose one |
| Using OpenRC < 0.44 with socket activation | Socket units fail or hang | Upgrade Artix or avoid socket activation on older releases |
Limitations to be aware of
- OpenRC does not natively support socket activation before version 0.44; if you need systemd-style socket units, verify your Artix release includes OpenRC ≥0.44.
- Parallel startup is optional and controlled by
rc_parallel="YES"in/etc/rc.conf; not all services are safe to run in parallel. - There is no built-in journal; logs go to syslog or the service's own log files.
Rollback if you added the wrong service
If you added a service to the default runlevel by mistake, remove it:
rc-update del myservice defaultThis deletes the symlink but leaves the init script and conf.d file intact.
Quick verification checklist
ls /etc/runlevels/default/ | grep myservice– symlink exists.rc-service myservice status– reportsstartedwith a valid PID.ps -p $(cat /run/myservice/myservice.pid)– process matches the daemon.- Reboot and confirm the service is running without manual intervention.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.