Another Vexing BookWorm + Pi4 Issue Solved - autostart per-user
From
56d.1152@3:770/3 to
All on Mon Nov 6 23:06:12 2023
I'd been complaining to someone the other day that I had
a graphical app I wanted to autostart as soon as a user
was fully logged in.
Now with Bookworm, on a *Pi3* you can just put stuff
in '/home/user/.config/lxsession/LXDE-pi/autostart'
which you should just copy from the similar dir in
'.etc/xdg' and set ownership accordingly.
But, moving to a Pi4 ... IT DIDN'T WORK.
Thought MAYBE it was because I'd originally done the
install and everything on a Pi3, so I re-installed
from scratch on the Pi4.
Still could NOT get my python script to automatically
start.
Now a big issue is that until a user IS logged in,
there's no SCREEN on which to display the graphics,
so you can't autostart from root crontab or /etc
or anything else that starts-up earlier.
And no, switching back to Xorg from Wayland using
raspi-config did NOT work.
Even tried a script that starts the python app, with
a sleep delay, in .profile and .bashrc - no good.
@reboot does NOT seem to work for a USERS crontab in
modern Debs.
And no I'm not gonna try and sort out screen defs
after the fact - tried that once, TOO evil.
The easiest fix turned out to be dumping the local
/LXDE-pi/autostart entirely and creating a
/home/pi/.config/autostart FOLDER.
You put .desktop files INTO that folder ... and
edit what they start up (you can do it with pcmanfm).
THEN they appear in the inadequate "lxsession-edit"
app and you can check/uncheck activation as you want.
I got my .desktop file from /usr/share/something,
in my case it was the 'lxterminal' one, and then
bent it to my will in the /home/xxxx folder
By the time that autostart stuff runs, there IS a
screen for the user and everything Just Works.
In theory a systemd entry, customized for a user
and with necessary delays and requires params,
might also work. Systemd is NOT always super-
well documented alas. It CAN do all kinds of neat
stuff but the syntax has to be *perfect*.
This has been a very weird issue - and HARDWARE
SPECIFIC. As said, everything worked as expected
on the Pi3, but NOT on the Pi4.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)