Bug 427673 - Session management is totally broken - system does not work with multi-user parallel sessions
Summary: Session management is totally broken - system does not work with multi-user p...
Status: RESOLVED DUPLICATE of bug 423526
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: master
Platform: openSUSE Linux
: NOR critical
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-14 04:13 UTC by Eric Johnson
Modified: 2020-10-16 09:34 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Figures 1-4 showing different greeters (login screens) and frozen session (2.67 MB, application/pdf)
2020-10-14 04:13 UTC, Eric Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Johnson 2020-10-14 04:13:07 UTC
Created attachment 132340 [details]
Figures 1-4 showing different greeters (login screens) and frozen session

SUMMARY
Session management is totally broken - system does not work with multi-user parallel sessions 

STEPS TO REPRODUCE

1) Starting with fresh boot and no sessions running, the greeter is displayed with list of users - lets say User1, User2, User3, and User4, a password prompt, and additional options such as "Sleep, Restart, Shutdown, Other," and also a drop down to select session type such as "Plasma, Plasma Wayland..." and also a "Virtual Keyboard." Lets call this the normal greeter (see Figure 1.). If User1 logs in and starts a session (vt7), then locks the session the normal greeter is NOT displayed but rather a greeter that only displays a single option which is to unlock User1 session. Lets call this the broken greeter(see Figure 2). No option appears to start any new session and there is no option such as "Sleep, Restart, Shutdown, Other." So the system can only be unlocked/used by user1 and no other user can login or start a session or do anything else. Obviously this is not the desired/expected behavior.

2) User1 from situation above unlocks the session, and from application menu selects "Power/Session" > "Switch User." First of all this is totally stupid because only User1 can do this which defeats the purpose because we need a way for User2 etc to start a session without loging in to User1. But lets just see the behavior. The normal greeter appears and displays list of users and all the other expected options. Now User2 can login and start a session (vt8). If the session is locked we see again the broken greeter. No option appears to start any new session etc. The only way to get back to User1 on vt7 is to use Ctrl+Alt+F7 which switches to vt7 where the the broken greeter appears.

3) We now have User1 (vt7) and User2 (vt8) and can toggle those with Ctrl+Alt+F7(F8). So lets go to vt8 and unlock then "Power/Session" > "Switch User." Now we see yet another greeter(see figure 3). This time a list of sessions is displayed (eg User1 on TTY 7) and there are options "Switch to This Session, "Start New Session," or "Back." Lets select "User1 on TTY 7" and then "Switch to This Session." This results in the session becoming frozen and displaying only the Desktop wallpaper and mouse cursor(see Figure 4). Mouse clicks Alt+F2 have no response. Ctrl+Alt+F7 returns you to the session on vt7, where the broken greeter appears but which functions to allow User1 to unlock the session. Session on vt8 can be killed with Ctrl+Alt+Backspace x 2. Unfortunately if User1 then tries to initiate a new session for User2 the session starts but only progresses to a frozen session again.

Clearly this is unacceptable and totally borked. Session management has serious issues and does not function properly. This is limiting the system to a single user.

OBSERVED RESULT

Can not use the system with multiple users. If one user starts session and locks it, there is no option for any other user to start a session. Switching sessions from within a session causes current session to become frozen.

EXPECTED RESULT

System should work with multiple users! When a user starts a session and then locks the session there should be an option for other users to start a new, or unlock already running, parallel session. When attempting to switch to a parallel session current session should not be come frozen.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 

Operating System: openSUSE Tumbleweed 20201012
KDE Plasma Version: 5.20.0
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1
Kernel Version: 5.8.14-1-default
OS Type: 64-bit
Processors: 6 × AMD Phenom(tm) II X6 1055T Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Quadro K2000/PCIe/SSE2

ADDITIONAL INFORMATION
Comment 1 Wolfgang Bauer 2020-10-14 09:54:32 UTC
I'd like to add that I do have a "Switch User" button on the lock screen here when using KDM as login manager.

But when using SDDM, the button is missing here too.

I'm using Leap 15.2 with an older systemd btw (but Plasma 5.20.0 from additional repos).
Comment 2 Eric Johnson 2020-10-14 19:25:18 UTC
(In reply to Wolfgang Bauer from comment #1)
> I'd like to add that I do have a "Switch User" button on the lock screen
> here when using KDM as login manager.
> 
> But when using SDDM, the button is missing here too.
> 
> I'm using Leap 15.2 with an older systemd btw (but Plasma 5.20.0 from
> additional repos).

Thanks for testing that out on SDDM and confirming the issue. Just to be clear I'm using SDDM but I've tried using xdm, lightdm on Tumbleweed but when I lock the session I always get the greeter/lockscreen missing the switch user options.
Comment 3 Wolfgang Bauer 2020-10-15 08:08:28 UTC
(In reply to Eric Johnson from comment #2)
> Thanks for testing that out on SDDM and confirming the issue. Just to be
> clear I'm using SDDM but I've tried using xdm, lightdm on Tumbleweed but
> when I lock the session I always get the greeter/lockscreen missing the
> switch user options.

There's specific code to support KDM. The others you mention should fall into the same category as SDDM IIANM (though I'm not sure if xdm actually supports that at all).
Comment 4 Wolfgang Bauer 2020-10-15 09:26:08 UTC
PS: I suppose org.kde.plasma.private.sessions in plasma-workspace (https://invent.kde.org/plasma/plasma-workspace/-/blob/master/components/sessionsprivate/sessionsmodel.cpp ,  https://invent.kde.org/plasma/plasma-workspace/-/blob/master/components/sessionsprivate/sessionsmodel.h) should be ported away from (the deprecated?) KDisplayManager, like it was done for Kicker/the application menu in https://invent.kde.org/plasma/plasma-workspace/-/commit/05414ed58d43d87d907326636faac53ae2e7bd60 .

Maybe that would fix the missing button?
That's what the lockscreen uses to determine whether the button should be shown, at least:
visible: sessionsModel.canStartNewSession && sessionsModel.canSwitchUser
Comment 5 Wolfgang Bauer 2020-10-15 09:29:47 UTC
(In reply to Wolfgang Bauer from comment #4)
> visible: sessionsModel.canStartNewSession && sessionsModel.canSwitchUser

OTOH, why does it check for both properties? Shouldn't it be shown also if only one of them is possible? Or only the latter one at least?
No idea if that is relevant in reality though.
Comment 6 Wolfgang Bauer 2020-10-15 10:29:38 UTC
And that's exactly the problem here (when using SDDM):
sessionsModel.canStartNewSession is true, but sessionsModel.canSwitchUser is false, so the button is not shown.

If I change it to visible:true (so the button is shown unconditionally), creating a new session works but switching to a parallel running session does not (the list is empty).

So apparently the real problem is that sessionsModel.canSwitchUser is not set properly here (in the non-KDM case at least).
Comment 7 Wolfgang Bauer 2020-10-15 10:45:16 UTC
(In reply to Wolfgang Bauer from comment #6)
> So apparently the real problem is that sessionsModel.canSwitchUser is not
> set properly here (in the non-KDM case at least).
I mean that the detection whether user switching is possible does not work properly.

Although, the problem seems to be more general than just affecting the lock screen.
If I choose "Switch User" from the application menu, it directly jumps to the SDDM login screen (shouldn't it show a list of existing parallel sessions if there are some?)

I thought user switching (i.e. to an existing parallel session) should be possible with SDDM, shouldn't it?
Comment 8 Wolfgang Bauer 2020-10-16 06:38:02 UTC
(In reply to Wolfgang Bauer from comment #6)
> And that's exactly the problem here (when using SDDM):
> sessionsModel.canStartNewSession is true, but sessionsModel.canSwitchUser is
> false, so the button is not shown.
Hm.
Today sessionsModel.canSwitchUser is true (with SDDM), and the button shows up.
So I cannot investigate at the moment why KDisplayManager::isSwitchable() returned false. (*)

But if I click the "Switch User" button on the lock screen with other sessions running, it still directly switches to the login screen. Shouldn't it show a list of existing sessions to switch to instead?
And Plasma's user switch applet doesn't show other user sessions either, only the current one.



(*)
PS: I did have a look in qdbusviewer yesterday when it was not working. All expected DBUS services/interfaces seemed to be there, and the "CanMultiSession" property of the current session was true. So AFAICS, KDisplayManager::isSwitchable() should have returned true, but obviously something went wrong there.
Comment 9 Wolfgang Bauer 2020-10-16 07:06:31 UTC
(In reply to Wolfgang Bauer from comment #8)
> But if I click the "Switch User" button on the lock screen with other
> sessions running, it still directly switches to the login screen. Shouldn't
> it show a list of existing sessions to switch to instead?
> And Plasma's user switch applet doesn't show other user sessions either,
> only the current one.
Also this works with KDM, I do get a list of existing sessions then if I click the button, with two options to "Switch to session" and "Create a new session". Only if there are no other sessions do I get to the login screen immediately.

And the user switch applet does show the other sessions too.
Comment 10 Wolfgang Bauer 2020-10-16 08:15:44 UTC
Argh! Please ignore comment#8:
(In reply to Wolfgang Bauer from comment #8)
> Hm.
> Today sessionsModel.canSwitchUser is true (with SDDM), and the button shows
> up.
> So I cannot investigate at the moment why KDisplayManager::isSwitchable()
> returned false. (*)
I modified SessionsModel::canSwitchUser() to always return true as a test yesterday evening, but I didn't remember that I already installed that patched version...

So it is still (reliably) broken here with SDDM, sessionsModel.canSwitchUser is false because KDisplayManager::isSwitchable() returns false for some reason. That's likely also the reason why the session list was still empty this morning.
(on the positive side, this should make it easier to further investigate the problem... ;-) )
Comment 11 David Edmundson 2020-10-16 09:34:20 UTC

*** This bug has been marked as a duplicate of bug 423526 ***