I am trying to get a python script with tkinter GUI to run in kiosk mode on startup without loading the entire X environments desktop and everything else.

I have the following script in ~/.xinitrc:

exec /home/pi/test.py --kiosk

Using Rasps-Config, if I boot to the console with auto login and type startx, then it works perfectly. However, if I boot to the desktop environment it loads the complete desktop and my script never runs. If I boot to the console and place a script in rc.local that runs startx, it still goes to the complete environment without running my script. However, I do get an error saying "no session for pid 786".

In this usage case, I do not have access to a keyboard so I am unable to type startx from the console to make it boot correctly.

Anyway have and ideas or solutions?

By the way, I'm running a Pi 3 with the latest image of stretch. It's a clean install except for the software to run Adafruit's 2.4" PiTFT screen.

1 Answer 1


I seem to have answered my own question. When booting to desktop with auto login, the ~/.xinitrc file was not being read. I moved the same script to ~/.xsession and it seems to be working correctly now.

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.