This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to get rid of "unused" sessions?

Tags: None
(comma "," separated)
whoopsdecade
Registered Member
Posts
16
Karma
0

How to get rid of "unused" sessions?

Mon Apr 29, 2019 11:01 pm
I have switched from one user to another several times. The first user stays logged in, I login to the other, logout, then go back to the first user. After doing that several times over several days this is what I get:
Image

Why are there so many "unused" sessions"? How can I get rid of them appearing on there? How can I stop this from happening? I somehow feel like I'm not switching users properly even though I'm pretty sure I'm clicking on the right options. Any suggestions would be appreciated.
airdrik
Registered Member
Posts
1854
Karma
5
OS
Usually when you log out it should clean up the session and bring you back to the previous session (now locked). The lock screen will probably still list the new session that had been created as I don't think there's anything which notifies each session as other sessions are started or stopped. When you log in and then lock the session again it should refresh with the current list of available sessions. If those sessions still show up, you could try switching to them and see what happens.

Each of these sessions can usually be accessed using Ctrl+Alt+Fn shortcuts. Usually the first graphical session is set up at Ctrl+Alt+F8 and subsequent graphical sessions are available under F9+, with text sessions filling in F1-F7, though different (newer?) systems may configure this differently (my ubuntu 18.04 system has the initial login screen at F1, first graphical session at F2 and text sessions at F3+). Another option you can try is pressing those keyboard combos to switch between the different sessions and figure out what shows up in each.


airdrik, proud to be a member of KDE forums since 2008-Dec.
whoopsdecade
Registered Member
Posts
16
Karma
0
I know that this essentially how kde treats terminals tty and that you can change them using ctrl+alt+fn. But kde is not closing the sessions once I logout it seems so I don't know if I did anything wrong (even though switching users seems straightforward enough). Given that kde isn't getting rid of those sessions or removing them from ssdm, is there a way to get rid of them other than restarting the OS?
airdrik
Registered Member
Posts
1854
Karma
5
OS
If the session is still running then there must be some process associated with that session which didn't get closed out when you logged out. Check for any stray "kdeinit5" processes; there should be one per active session. (you can use Ctrl+Esc to bring up the process list)


airdrik, proud to be a member of KDE forums since 2008-Dec.
whoopsdecade
Registered Member
Posts
16
Karma
0
airdrik wrote:If the session is still running then there must be some process associated with that session which didn't get closed out when you logged out. Check for any stray "kdeinit5" processes; there should be one per active session. (you can use Ctrl+Esc to bring up the process list)


Is that process supposed to be left running even if I log out of the session?
whoopsdecade
Registered Member
Posts
16
Karma
0
airdrik
Registered Member
Posts
1854
Karma
5
OS
nope, when you log in that session is directly tied to that process (at a higher level, logging in launches a particular process, the exit of which process is what constitutes/finalizes logging out. For KDE Plasma sessions, that process is kdeinit5).

You might also look at the tree view of the processes to see what specific things are still attached to those sessions that's keeping them from ending.


airdrik, proud to be a member of KDE forums since 2008-Dec.
akay64
Registered Member
Posts
7
Karma
0
My finding has been that there is indeed a process running for these sessions which is why they are "Unused" and that process is SDDM! Like if you failed to authenticate and then made a new sessions, and did so again and again... As strong and powerful KDE is as a DE, it's weakest part right now is the extremely buggy sessions manager and lock screen.

I have tested a fix for this issue and posted a solution here -> viewtopic.php?f=305&t=151924&p=425108#p425108

Hopefully it works for you as well.
whoopsdecade
Registered Member
Posts
16
Karma
0
akay64 wrote:Like if you failed to authenticate and then made a new sessions, and did so again and again... As strong and powerful KDE is as a DE, it's weakest part right now is the extremely buggy sessions manager and lock screen.

I didn't fail to authenticate though. Thanks for suggesting a fix, I'm not sure I'll be able to test this out soon but I'll bookmark it. The KDE session manager is incredibly unstable. Not to mention that sometimes it locks if there's an intense IO operation going on in one of the sessions... Not sure how it's fallen through the cracks like that.
patwoees
Registered Member
Posts
1
Karma
0

Getting rid of "unused" sessions

Sat Feb 01, 2020 9:51 pm
I found this quite annoying running Kubuntu for the main desktop for my family. so, I wrote this bash script (which must be run with root privileges):

Code: Select all
for session_id in $(loginctl list-sessions | grep -Eo '^ +[0-9]+' | grep -Eo '[0-9]+'); do
    if [ $(loginctl -p State --value show-session $session_id) = "closing" ]; then
        loginctl kill-session $session_id;
    fi ;
done


using loginctl list-sessions, I can grep for the ID of each session, and then show the State property of each. If the State property is equal to "closing", then it is one of the "unused" sessions that shows up in the login switcher. killing this session seems to remove the "unused" session, and doesn't seem to affect anything else.

This script can be run at user logout, or as a cron job for the root user

I know this is a hack, but it seems to work for me until the devs figure out how to actually solve the issue.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]