I'm running lubuntu 20.04 with sddm as display-manager.
Whenever I logout over gui and login as a different user the user-session is not be killed (do not know if it is by-design). So loginctl shows me doupple sessions for my users.
All sessions from my 2. user I killed with
killall -u second_user_name
for my main user 3 sessions remains.
The session with the lowerst session id i could remove with
sudo loginctl kill-session 3
Leftover
loginctl list-sessions
SESSION UID USER SEAT TTY
11 1000 alex seat0
21 1000 alex seat0
Next try
alex@Guilmon:~$ sudo loginctl kill-session 11
[sudo] Passwort für alex:
alex@Guilmon:~$ loginctl list-sessions
SESSION UID USER SEAT TTY
11 1000 alex seat0
21 1000 alex seat0
2 sessions listed.
alex@Guilmon:~$
How can I get rid of it? Or avoid this situation (more than one session per user)
I think I found out to avoid this situation. In
From manpage
after logout 1. user and logged in to 2. user and back
No longer waiting for stopping something from abandoned user session during shutdown or restart.