When creating a UI using a Raspberry Pi and a Slush Engine, it is desirable for your UI script to run as soon as the Raspberry Pi loads the display. Note that there are very many ways of accomplishing this, so the steps listed below may differ from some online guides. These steps were tested on Raspbian Stretch Lite with the RPD desktop environment installed.
- Open the LXDE autostart file by typing
sudo vim ~/.config/lxsession/LXDE-pi/autostart
into a terminal.
- This file should have several lines already, each begining with
@
. If this file is empty, ensure you typed the path in correctly.
- At the end of the autostart file, add a line that runs your UI script. This line constists of an
@
sybmol at the beginning, followed bypython3 [PATH TO YOUR SCRIPT]
. For example:@python3 /home/pi/Documents/InfinityMirrorPie/main.py
.
- If you don't know how to edit files in vim, try this or use
sudo nano
instead.
- Save your file and reboot the Pi using
sudo reboot
. Theoretically, your script should run as soon as you log in and the display loads. If it works, continue to the next step. If you have issues, move to the troubleshooting section. - We now have to disable the password prompt for the Raspberry Pi's login. Start by opening a terminal and typing
sudo raspi-config
. - Using the arrows and enter key, navigate to Boot Options>Desktop/CLI.
- Navigate down to option B4 on the very bottom of the menu and hit enter.
- Reboot the Pi. If all has gone to plan, the UI will automatically start.
- So your startup script didn't run. Bummer. First, view the crash logs by typing
sudo vim /home/pi/.xsession-errors
. This should show you any crashes that occured while the desktop environment was loading. - If you see a line that says python3 [YOUR SCRIPT]: No such file or directory or something of that sort, ensure you typed the directory of your script correctly. I've also found that it doesn't work when you use the
~
symbol in your script path, so make sure to write out the full path.
- e.g.
@python3 /home/pi/Documents/InfinityMirrorPie/main.py
instead of@python3 ~/Documents/InfinityMirrorPie/main.py
- Reboot the Pi and try again. If you see a different error related to your script, edit the path and script accordingly.