0

This is what i got with

systemctl status rc-local.service
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: No protocol specified
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: Error: Can't open display: (null)
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: Failed creating new xdo instance
- déc. 07 16:09:48 PKPIE01 sudo[2161]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/firefox -url "theurl"
- déc. 07 16:09:48 PKPIE01 sudo[2161]: pam_unix(sudo:session): session opened for user root by (uid=0)
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: No protocol specified
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: Failed to connect to Mir: Failed to connect to server socket: Aucun fichier ou dossier de ce type
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: Unable to init server: Impossible de se connecter : Connexion refusée
- déc. 07 16:09:48 PKPIE01 rc.local[2157]: Error: cannot open display: :0.0
- déc. 07 16:09:48 PKPIE01 sudo[2161]: pam_unix(sudo:session): session closed for user root

And this is what i execute in my /etc/rc.local working when I run

sudo /etc/rc.local 

in terminal but doesn't work at restart :

sleep 45s

export DISPLAY=:0.0 xdotool

export DISPLAY=:0.0 firefox

sudo /usr/bin/firefox -url "the url"

exit 0

Any clues ? I'm really new to this, so if you have any good advices or best practices, let me know !

derHugo
  • 3,376
  • 5
  • 34
  • 52
Kyl'
  • 1
  • 1
  • 2

2 Answers2

0

If you VNC in, you can run the script/command "locally".

As mentioned by steeldriver (Rc.Local works manually but not at boot) and Sergiy Kolodyazhnyy (https://askubuntu.com/a/984164/877732) this doesn't work, but I'm sure it worked once???

I created a bash script, nano startFirefox.sh:

#!/bin/bash
echo "Starting Firefox"
/usr/lib/firefox-esr/firefox-esr &

Made it executable chmod a+x startFirefox.sh (https://stackoverflow.com/a/8352939/5165135)

Added it to /etc/rc.local:

fi
/home/pi/startFirefox.sh &
exit 0

On newer systems, check it is running systemctl status rc-local.service (https://askubuntu.com/a/759821/877732)

0
  1. Don't run GUI apps via rc.local, it's a command-line only script.

  2. All your commands are blocking, append & at the end of each line

  3. sudo is redundant, because rc.local runs as root already