You can use the raspbian preferences via the GUI to cause the pi user to be auto logged in at boot up and the GUI automatically run.  However if you need to run with root privileges due to needing IO pin control (yes yes its not advised to run as root, but for many uses its fine where the security issues aren’t a concern) then set the raspbian preferences to boot to the command line.  Now open this file (the “sudo nano” assumes you are editing it from the command line):

sudo nano /etc/rc.local

Before the “exit 0” line in it add the following line:

#Auto run the GUI as root
sudo startx

Save it by pressing Ctrl+X, ” Y”, ENTER

Re-boot your RPi and it should automatically run the GUI as the root user.  

“No session for pid 696”

We get this message when using this method, the number will be random based on system.  It may well be because of using sudo startx.

You can use command “ps 696”  to see the process there is no session for, for us it was:

  902 ?        Sl     0:00 lxpolkit

lxpolkit is a “Policy authentication agent”.  There’s lots of google resources on no session for PID with lxpolkit but after a few hours of trying we didn’t manage to resolve.  Instead we started our application using a script with a delay before it runs so that it simply appears on top of the error message.  Bodge, but it works for us…

We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published. Required fields are marked *