[systemd-devel] rc-local.service and its future in systemd?

Lennart Poettering lennart at poettering.net
Mon Apr 24 11:14:19 UTC 2023


On Mo, 24.04.23 11:57, Aki Ketolainen (akik at mykolab.com) wrote:

> Would it be possible to change the rc-local.service configuration as
> follows, so that it could be used similarly as before
> i.e. running close to the end of the "runlevel" or systemd target:
>
> [Unit]
> After=crond.service

Why crond? Why is that the "end of the runlevel"?

It's 2023, thinking in concepts such as "runlevels" is like so last decade...

Quite frankly, at this point if we make changes to rc-local.service we
probably should just remove it altogether. The semantics are just too
vague and undefined. For example anything long-running forked off it
just lives in an unsupervised netherworld that is not how things
should be done in 2023.

Note that you can easily order rc-local.service after whatever service
you like locally via:

    mkdir -p /etc/systemd/system/rc-local.service.d/
    cat > /etc/systemd/system/rc-local.service.d/50-after-crond.conf <<EOF
    [Unit]
    After=crond.service
    EOF
    systemctl daemon-reload

This looks like a very very specific goal though, local to your own
install, and I am very sure we should not make a similar change for
anyone else.

Note that instead of adding a drop-in as suggested above it would
probably be infinitely better to just drop in a proper service for
your usecase, named after your usecase, with the precise deps you need
and no others. Leave rc-local.service be, it's a legacy concept from
the 1990s. But the 90s are over.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list