rc.local is not running on raspberry pi's startup

Lucas Barbosa picture Lucas Barbosa · Dec 10, 2015 · Viewed 13k times · Source

I'm trying to run a simple C code when the pi boots, so I followed the steps on the documentation (https://www.raspberrypi.org/documentation/linux/usage/rc-local.md), but when I start it, it shows this error:

Failed to start etc/rc.local compatibility.
See 'systemctl status rc-local.service' for details.

I do as it says and I receive this:

rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static)
Drop-In: /etc/systemd/system/rc-local.service.d
         ttyoutput.conf
Active: failed (Result: exit-code) since Tue 2015-12-08 10:44:23 UTC; 2min 18s ago
Process: 451 ExecStart=/etc/rc.local start (code=exit, status=203/EXEC)

My rc.local file looks like this:

./home/pi/server-starter &

exit 0

Can anyone show me what I'm doing wrong?

Answer

flo picture flo · Dec 11, 2015

You have to refer to your script using an absolute path.

/home/pi/server-starter &

Notice the absence of the . in comparison to your solution.

Also, you may have to add a reference to the shell right at the beginning of your rc.local.

#!/bin/sh -e
/home/pi/server-starter &
exit 0