1

I have created a python script with GUI and I want to be able to run it at start up once the Pi boots. I placed my script in the rc.local but the GUI does not appear at start up. But when I placed it in the autostart it does. Can somebody explain what is the difference of using those? Why also does the autostart need to be edited as a user and not as a root?

Here is the path of those files I edited. /etc/rc.local and ~/.config/lxsession/LXDE-pi/autostart

1

rc.local is an old startup file which is being kept around for compatibility reasons. As such, it provides no dependency semantics: there's no guarantee that a particular service has started before this file is called. In your case, the missing service may be Xorg, which manages the Linux GUI subsystem. Obviously, LXDE autostart runs when the desktop environment is ready.

Another important difference is that autostart is run with the user ID of the user who logged in to LXDE, inheriting its environment. This is required for many GUI programs to run properly. BTW, this is also why this file has to be edited as the respective user and not as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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