1

I have Raspbian Buster on a RPi4 and I was launching a Python3 based Kivy 2.0 app at startup. Since it is a GUI app that needs networking and bluetooth. The only way to make it work was an executable script with sudo chmod +x myapp.py and add the line @python3 ~/myapp.py to /etc/xdg/lxsession/LXDE-pi/autostart.

Later on I installed Teamviewer and at the startup the app simply does not start any more. I have checked all the LXDE-pi autostarts, configs, desktops, lxpanels, lxsessions, xdges without finding a flaw. The only change I found was teeamviewer added a service in etc/systemd/system. Uninstalling teamviewer did not help.

Any suggestions?

UPDATE n.1

The file /home/pi/.config/lxsession/LXDE-pi/autostart does not exist so it is not used instead of /etc/xdg/lxsession/LXDE-pi/autostart.

In $HOME/.config/lxsession/LXDE-pi/desktop.conf the part disable_autostart=no, so it should be fine.

My app launched only using lxsessions/autostart. Other attempts such with rc.local,autostart desktop files, systemd, crontab,init.d and bashrc did not have a positive outcome and I can not consider them as solutions.

UPDATE n.2

Teamviewer is not guilty. I tested with a simple script and lxsessions does run after boot.

The script myapp.py works fine when launched any time except after reboot. After checking /home/pi/.cache/lxsession/LXDE-pi/run.log it seems to be a serial tty port problem. This is the post where I found out about run.log raspberry-pi-autostart-of-lxde-does-not-work.

4
  • Are there any actual error messages associated with "failed miserably" and "went bananas"? In general, you should make your question more focused. If you managed to start your script though lxsession autostart, and this is now broken, ask how to fix that, don't mention crontab and friends. If you want to switch to crontab or systemd, ask specifically about that. – Dmitry Grigoryev Feb 22 at 14:28
  • @DmitryGrigoryev I mentioned crontab and friends to avoid proposing them as alternatives as they do not work. Unfortunately there are no errors visible that I could post, the app simply does not start. Thank you for the suggiestion about narrowing the question. – parovelb Feb 22 at 14:53
  • Another point: does lxsession still run, or did it get removed / disabled when you installed Teamviewer? And BTW, systemd or a .desktop may be a good alternative, despite the fact you couldn't set it up before. – Dmitry Grigoryev Feb 22 at 15:02
  • 1
    @DmitryGrigoryev, lxsessions is still running. – parovelb Feb 22 at 15:59
1

I suggest you try adding a simple app to your autostart file, e.g. leafpad, just to make sure it is still in use. If Leafpad won't run, you'll have to concentrate on your desktop environment / session configuration. Perhaps checking log files in /home/pi/.cache/lxsession/LXDE-pi will shed some light on the situation.

Otherwise, the problem is in your script. I would replace ~/myapp.py with an absolute path to be sure, and then add some code to it which logs the progress to a file.

1
  • I tested with a simple script and lxsessions does run after boot. It seems to be a problem with opening a serial tty port right after boot. – parovelb Feb 23 at 10:15
1

When launched my script initializes the serial ports ttyACM*. After failing with lxsession/LXDE-pi/autostart I went to see the lxsession autostart log .cache/lxsesion/LXDE-pi/rpi.log. I found out my script was not able to open the serial port only at startup, right after boot. It was not a matter of permissions or timing. After playing with crontab, bash and lxsession, I removed sudo apt-get purge modemmanager as suggested in the Arduino forum and now my script works as expected.

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.