kota's memex

Start a service:

rc-service alsa start

Enable (autostart) a service:

rc-update add alsa

List running/stopped/crashed:

rc-status

List all enabled

rc-update show

User services

OpenRC support user services which are managed with the -U option and without doas.

Start services after login prompt

https://ptrcnull.me/posts/openrc-async-services.html

create a custom runlevel

doas mkdir /etc/runlevels/async

add default as a stacked runlevel

doas rc-update add -s default async

remove services from default and add them to async

doas rc-update del chronyd
doas rc-update add chronyd async

add changing runlevel to async to /etc/inittab

::once:/sbin/openrc async

Recovering crashed services

When a process crashes while starting, an error or warning message will be printed when trying to start, stop, or show the status of a service. For example, when using the "docker" service:

root #rc-service docker status
 * status: crashed

root #rc-service docker start
 * WARNING: docker has already been started

root #rc-service docker stop
 * Caching service dependencies ...                                      [ ok ]
 * Stopping docker ...
 * Failed to stop docker                                                 [ !! ]
 * ERROR: docker failed to stop

To remedy this situation, zap the service:

root #rc-service docker zap

Hide clock skew errors on raspberry pi's

Create an empty file /etc/init.d/.use-swclock to signal usage of this hack (just to be able to disable on systems with hardware clock). Add the following snippet in /lib/rc/sh/init.sh, just after setting up /proc:

if [ -e /etc/init.d/.use-swclock ]; then
  “$RC_LIBEXECDIR/sbin/swclock” /etc/init.d
fi