User Tools

Site Tools


rc.local_on_modern_systemd

/etc/rc.local on modern systemd

So the systemd crew thinks that rc.local is bad or something and it's not enabled by default. Put it back by making this file:

sudo nano /etc/systemd/system/rc-local.service

with content:

[Unit]
 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local
 After=remote-fs.target

[Service]
 Type=forking
 ExecStart=/etc/rc.local start
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target

Note: the "After=remote-fs.target" is something I added so it would wait for NFS. If you don't need NFS to be up, you can remove that line.

Enable this new service:

sudo systemctl enable rc-local

Make a new fresh rc.local:

printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee /etc/rc.local
sudo chmod +x /etc/rc.local

If that doesn't work, the coward's way out is to use the @reboot cron specifier.

Source for the above: this plus this for NFS support.

rc.local_on_modern_systemd.txt · Last modified: 2020/08/10 18:41 by tkbletsc