I am trying to diagnose why /etc/rc.local is not successfully executing on boot of a raspberry pi.
I have stripped the content of /etc/rc.local to a minimal version, and still cannot get it to touch a file in the /tmp directory.
I am getting this relevant output in /var/log/syslog on startup.
So looks like systemd is responsible for executing /etc/rc.local but is failing.
Have done lots of googling, no luck yet.
Thanks
Notes
System info (new to raspberry pi so let me know what else i can post):
uname -a
:
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
/etc/rc.local
content:
#!/bin/bash
#
# 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.
# Print the IP address
touch /tmp/foo
exit 0
/var/log/syslog
content:
raspberrypi systemd[1]: Starting /etc/rc.local Compatibility...
raspberrypi systemd[290]: rc-local.service: Failed at step STDOUT spawning /etc/rc.local: No such device
raspberrypi systemd[1]: rc-local.service: Control process exited, code=exited status=209
raspberrypi systemd[1]: Failed to start /etc/rc.local Compatibility.
raspberrypi systemd[1]: rc-local.service: Unit entered failed state.
raspberrypi systemd[1]: rc-local.service: Failed with result 'exit-code'
/etc/rc.local
appears to have correct permissions:
pi@raspberrypi:~ $ ls -la /etc/rc.local
-rwxr-xr-x 1 root root 345 Jan 16 18:03 /etc/rc.local
Edit/Update:
I ended up abandoning attempts to start my server via /etc/rc.local
and instead created a systemd unit, which was pretty straight forward.
Guide here : https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup
/etc/rc.local
has limitations due to Compatibility with SysV. Following the recommendation of the developers from systemd you should avoid using it. Instead you should create a systemd unit file for your script. – Ingo Jan 27 '19 at 21:09