Where is rc.local in Debian 9 (Debian Stretch)

Omidreza Bagheri picture Omidreza Bagheri · Jun 28, 2017 · Viewed 48.7k times · Source

It seems there is no /etc/rc.local in the latest stable version of Debian, Debian Stretch. Where is it? Is /etc/rc.local obsolete?

Answer

SYN picture SYN · Jun 28, 2017

rc.local is being deprecated.

It seems you can still have one though:

cat <<EOF >/etc/rc.local
#!/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
EOF
chmod +x /etc/rc.local
systemctl daemon-reload
systemctl start rc-local
systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: inactive (dead)
Condition: start condition failed at Wed 2017-06-28 11:32:36 UTC; 3min 13s ago

The vendor preset should be enabled. You can add some echo 123 >/proof to your rc.local and reboot, making sure it works - I confirm it does, using the last Debian Stretch AMI on EC2, ...