0

I upgraded to Raspbian Buster this morning and everything worked fine, until I added a command to run a python tkinter application in the LXDE-pi autostart file. When I rebooted to test the tkinter app, it launched fine, however, when I closed it there was no desktop behind it as there was in Jessie - just a black screen and a cursor.

I tried commenting out the line in the autostart file, but it still boots to the black screen (but without the tkinter application)

I'm using the official Raspberry Pi 7' Touchscreen and if logs are needed I can get them through SSH

3
  • What happens if you delete the file instead of commenting out the line?
    – Fred
    Sep 26 '19 at 16:40
  • @Fred Removing the line didn't help, but deleting the whole file fixed it. Now the question is how can I run a python script at X start without LXDE autostart?
    – SImon
    Sep 27 '19 at 5:48
  • Welcome to Raspberry Pi :-) Please take the short Tour and visit the Help Center to get an idea how things work here. The best way to handle your question is that @Fred makes his comment an answer. Then you can accept his answer and make a new question how to start the script without LXDE autostart. But there are already many answers given here to this problem.
    – Ingo
    Sep 27 '19 at 7:58
0

Removing the autostart file should let LXDE start normally again.

Searching the stack here with https://raspberrypi.stackexchange.com/search?q=lxde+autostart suggests that the autostart may need to contain all of the commands needed to start the LXDE window manager (openbox), taskbar (lxpanel), desktop (pcmanfm), etc.

Alternatively, it may work better for your application to create a tkinter.desktop file in ~/.config/autostart according to the LXDE wiki. A .desktop file should look like

[Desktop Entry] 

Type=Tkinter

Exec=tkinter

.desktop files can be named for any applocation and contain any executable in the Exec line, including optional arguments, e.g. Exec=/bin/bash /home/pi/myscript.sh.

0

I found a way that should handle your startup, providing a simpler way to startup as many programs as you want without always changing the LXDE file or other system files that can get lost on your next major upgrade.

The only LXDE autostart file in my fresh install of Buster (May 202) was here

/etc/xdg/lxsession/LXDE-pi

Note: this is a root file and changes will affect all users. User versions can exist in the user's hidden /home/{username}/.config/xgd/lxsession/LXDE-pi folder and will override the /etc/xdg/lxsession/LXDE-pi one. In FileManager the View option (orCTRL+H) can toggle the option to show hidden files.

I added an @lxterminal command in my /etc/xdg/lxsession/LXDE-pi/autostart. The command calls a script in my /home/pi folder:

lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@lxterminal -e /home/pi/StartCollectors.sh
@xscreensaver -no-splash

Note: as /etc/xdg/lxsession/LXDE-pi/autostart this is a root protected file, it had to be edited with root powers, so from a terminal issue the command sudo nano /etc/xdg/lxsession/LXDE-pi/autostart to open the nano editor.

To avoid a problem with timing, I call a script to pause before running my python scripts.

The bash file StartCollectors.sh contains this:

#!/bin/bash
# started from the /etc/xdg/LXDE-pi/autostart file 
# with the line @lxterminal -e /home/pi/StartCollectors.sh (reminder)
# change to my applications working directory
cd /home/pi/ETA2-copy
# let me know it's working
echo "starting House Collectors in 20 seconds"
sleep 10
echo "starting House Collectors in 10 seconds"
sleep 10 
# issue the start commands in terminal windows so I can track them.
lxterminal --working-directory='/home/pi/ETA2-copy' --command='python3 Hiverun.py' -t 'Hive'
lxterminal --working-directory='/home/pi/ETA2-copy' --command='python3 ETALog.py' -t 'ETA'
lxterminal --working-directory='/home/pi/ETA2-copy' --command='python3 ETADailySum.py' -t 'Summary'
echo "My work here is done.  Closing in 10 seconds"
sleep 10
exit

the -t options put a recognizable name on the terminal window.

So now, to start other programs I only need to add them in my own startup bash.
When I upgrade raspbian again, the comments in the bash file serve as a reminder of how to make it work with a one line mod to the LXDE-pi folder.

If you don't want your tkinter python program to start in an lxterminal that should be an easy mod to the bash script.

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.