Open maacruz opened 2 days ago
Thanks for researching and writing this up! I'll have a look into it in the next several days.
Presumably you're doing this on a RasPiOS Bookworm system With Desktop, but can you please confirm the system on which you've identified this issue? Thx!
I have found out that each new remote desktop spawns a "ssh-agent -s" and a system-config-printer "applet.py" process which will remain once the desktop session is closed, preventing the systemd session from exiting normally. This happens at least when using lightdm, I haven't tried with other display managers.
The problem with applet.py is known upstream and is WONTFIX. It's been reported to happen with sddm, kdm and lightdm.
I propose the following solution for lightdm:
1) Edit /etc/lightdm/lightdm.conf and put this line under section [Seat:*]
session-cleanup-script=/etc/lightdm/session-cleanup-script.sh
2) Create the file /etc/lightdm/session-cleanup-script.sh with the following content
3) Make the script executable with
chmod +x /etc/lightdm/session-cleanup-script.sh
4) Restart lightdm
systemctl restart lightdm
Explanation: I haven't managed to get the current systemd session scope for the lightdm process launching the session-cleanup script ("loginctl session-status" returns error), so I resorted to kill all "ssh-agent -s" and "applet.py" processes on all systemd session scopes where the leader has already been killed. This script will be run each time the desktop session is terminated. A bit blunt but works fine.