I have trouble with my Raspberry Pi 4B configuration. I prepared RPI to work with TV - it turns on the TV and switches active source to HDMI1 with cec-client. After turning on the TV it should start playing the video with omxplayer, what randomly fails and the omxplayer doesn't start at all.

Here is how it looks:


exit 0


echo "on" | cec-client -s -d 1
echo "as" | cec-client -s -d 1 -p 1


omxplayer -o hdmi --loop /home/pi/Downloads/video

The startup.sh script seems to be fine - TV always starts and the active source is set as it should be. I tried to put "&" sign at the end of the line with path to video.sh script in rc.local file but this didn't help. Also, I set chmod 777 to all video.sh, startup.sh and video.

1 Answer 1


I think the main problem is that you still use deprecated /etc/rc.local.

Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.

In particular you should note the last sentence of the document:

Note that there are some areas where systemd currently provides a certain amount of compatibility where we expect this compatibility to be removed eventually.

It seems that this is the case with the latest Raspberry Pi OS. You should use a systemd Unit file to start your scripts. You will find many examples here on this site with tag systemd-startup.

  • Thank you! I tested your solution with almost 30 different RPIs and everything works perfectly for now. Jul 5, 2021 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.