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?
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, ...
-
1
-
44it's actually a big mistake deprecating such a proven parts of the system like rc.local! If you move to another things like systemd - OK, just don't use the old part for it, but why removing it? – Alexey Vesnin Jul 19 '17 at 2:44
-
It's also worth mentioning that
/etc/rc.local
is invoked from/etc/init.d/rc.local
, the latter file belonging to initscripts package. At least if you have SysV init installed. – Bass Jul 24 '18 at 18:26 -
12
-
1it's not working, as you need to add magical extra service
rc-local.service
to invoke the/etc/rc.local
. It's not working if i need something bigger thenecho hello world
- packages installation, db config, modules config. – Hellseher Nov 10 '18 at 7:23
/etc/rc.local is not invoked from /etc/init.d/rc.local (at least on the Debian stretch system I've just installed today), because /etc/init.d/rc.local does not exist in that system.
-
3
-
explanation is above, you probably don't got the sys5 compat scripts which that is part of. (we can have our opinions about whether some upstream devs should even be allowed to deprecate something we want to use, but hey) – Florian Heigl Dec 17 '18 at 1:27