OpenRC: Start services after login prompt
I’m using Alpine Linux as my main OS on desktop.
As I don’t use any display manager/greeter such as LightDM’s,
I noticed that it takes quite a bit of time to actually get the login prompt.
After a while of searching through logs,
I realized that some services - primarily
chronyd - wait
a few seconds for e.g. getting a response from NTP server
and don’t exit the start function immediately after starting the process.
I tried googling for a solution and found this
Unix StackExchange answer, yet it didn’t solve my problem.
But, after reading Alpine User Handbook’s page on OpenRC, I got the idea that it could be solved with a bit of tinkering with custom runlevels.
So, the final solution was:
- create a custom runlevel (I chose the name “async”, but it doesn’t matter)
$ doas mkdir /etc/runlevels/async
defaultas a stacked runlevel
$ doas rc-update add -s default async
- remove services from
defaultand add them to
$ doas rc-update del chronyd $ doas rc-update add chronyd async
- add changing runlevel to
Add this line to
After rebooting, services from
default runlevel will still block agetty
from running (after all, it has the
wait label in inittab), but services
async will start separately.