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

killermoehre at gmx.net killermoehre at gmx.net
Mon Apr 24 09:19:11 UTC 2023


> Am 24.04.2023 um 10:57 schrieb Aki Ketolainen <akik at mykolab.com>:
> 
> Hi,
> I noticed in Rocky Linux 8.7 LXC container image that they've added a message to /etc/rc.d/rc.local:
> # In contrast to previous versions due to parallel execution during boot
> # this script will NOT be run after all other services.
> I created an issue report on this at github: https://github.com/systemd/systemd/issues/27340
> "How to run /etc/rc.d/rc.local as the last Linux bootup task?"
> 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
> [Install]
> WantedBy=default.target
> chmod 700 /etc/rc.d/rc.local
> systemctl enable rc-local.service
> I tested this and see in ps output (ps auxwwf | sort -n -k 2,2 >> /var/tmp/boot.ps) that it starts after crond
> in both multi-user.target and graphical.target.
> Best regards,
> Aki

Hi Aki,

as Lennard already told you in the GitHub issue that "last" just doesn't make sense in systemd, there is also no need to change the dependencies global for everyone. Especially as there are systems out there which doesn't have crond installed (because there are .timer).

Your best bet is really to change all your custom scripts from rc.local into proper .service and instead of crond check out systemd.timer.

BR
Silvio


More information about the systemd-devel mailing list