One minute
Linux rc.local on Modern Systemd (Debian 13)
If you miss the old /etc/rc.local from the SysV days – it still
works on modern systemd systems. You just need to enable it manually.
Create the systemd service unit
sudo nano /etc/systemd/system/rc-local.service
Paste this:
[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
Create rc.local
sudo nano /etc/rc.local
Paste this:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
Enable and test
sudo chmod +x /etc/rc.local
sudo systemctl enable rc-local
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
Notes
- Any commands placed before
exit 0will run at the end of every multiuser boot. Useful for old habits, kernel tweaks, or hardware init that doesn’t have a proper systemd service yet. - This works on Debian 13 Trixie. Also works on Ubuntu 18.04+, RHEL 7+, and most modern distros.