By Stephan Wijman

With Debian 11 (Bullseye) there is no default rc.local file anymore. But this doesn't mean it has been completely removed.

The rc-local service is available but it will need a default config file.

Create a file /etc/rc.local with the following content:


#!/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

We now have to make the file executable with the following command:


chmod +x /etc/rc.local

Then we need to reload the systemd manager configuration:


systemctl daemon-reload

Then we start the rc-local daemon:


systemctl start rc-local

And then we check the status of rc-local to confirm it ran OK:


systemctl status rc-local

You should then get an output like below stating the it is active and exited normal:


● rc-local.service - /etc/rc.local Compatibility
     Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/rc-local.service.d
             └─debian.conf
     Active: active (exited)
       Docs: man:systemd-rc-local-generator(8)
    Process: 58756 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

Stephan Wijman • 32 Articles

View Articles