Bug 416557

Summary: Screen after "Switch User" option shows normal login screen with currently logged user
Product: [Plasma] plasmashell Reporter: Piotr Mierzwinski <piotr.mierzwinski>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, piotr.mierzwinski, plasma-bugs
Priority: NOR    
Version: 5.17.5   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Piotr Mierzwinski 2020-01-21 22:57:56 UTC
SUMMARY
At the first time (after I logged in) afer I used "Switch user" option I saw normal login screen (I use sddm session manager) including my self. Please notice that trying to log in one more time into myself made that new session of plasma just hung / block (stops in the middle) - isn't open currently working. Shortcut Alt+Ctrl+Backspace helps, but seems some processes still working in the background and in case of close plasma session (Log off or restart or turn off computer) operation takes very long time or just never finishes.

Would be nice to don't show currently logged user to avoid accidentally login on the same user.
Or better just after checking that this user is currently working - don't start new session of plasma.

Second issue here is that I cannot back from this login screen after I change my mind that actually I don't want to switch. Nevertheless in this case I must select another user and log in. Therefore would be nice to have possibility to back to plasma session.

STEPS TO REPRODUCE
1. log in into plasma session
2. Click "Switch user" option
3. 

OBSERVED RESULT
session manager screen without possibility to back to currently working session and shown currently logged user which choosing made running new plasma session

EXPECTED RESULT
session manager screen with possibility to back to currently working session or not visible currently logged user, but if must be visible then after his choosing let be showing his currently running session

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: YES
(available in About System)
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66
Qt Version: 5.14

ADDITIONAL INFORMATION
I'm not sure maybe this issue should be (also) reported to sddm's author(s).
Comment 1 Nate Graham 2020-01-21 23:42:58 UTC
> At the first time (after I logged in) afer I used "Switch user" option I saw
> normal login screen (I use sddm session manager) including my self. 
Yeah, the login screen is what shows other accounts you can log into.

> Please notice that trying to log in one more time into myself made that new
> session of plasma just hung / block (stops in the middle) - isn't open currently
> working
This is a bug in how your distro has configured the SDDM login screen. Tell them to add `reuseSessions=true` to the config file they ship.
Comment 2 Nate Graham 2020-01-22 02:14:24 UTC
Sorry, it's "reuseSession=true". It's also set by default in SDDM, so I suspect it might have gotten overridden to "false" in your config somewhere. Can you check on that?
Comment 3 Piotr Mierzwinski 2020-01-22 22:37:51 UTC
(In reply to Nate Graham from comment #2)
> Sorry, it's "reuseSession=true". It's also set by default in SDDM, so I
> suspect it might have gotten overridden to "false" in your config somewhere.
> Can you check on that?

Below please find my config (placed: /etc/sddm.conf.d/kde_settings.conf):
Autologin]
Relogin=false
Session=
User=

[General]
HaltCommand=/usr/bin/systemctl poweroff
RebootCommand=/usr/bin/systemctl reboot

[Theme]
Current=charlie

[X11]
EnableHiDPI=true

[XDisplay]
# Xsetup script path
# A script to execute when starting the display server
DisplayCommand=/usr/share/sddm/scripts/Xsetup

[Users]
MaximumUid=60000
MinimumUid=1000


I have also other sddm config placed in /etc and calling sddm.conf with such content:
[Theme]
CursorTheme=Adwaita

[X11]
EnableHiDPI=false

I'm not sure if this second one is used, but for sure is used this previous one. I changed theme there (on charlie) and it was working.

Anyway I don't see in both any overwritten "reuseSession" parameter.

And as for Xsetup script. It only turn off (by xrandr command) not necessary display for sddm. This is work around for not working support multi monitors (I reported issue to sddm authors) couple weeks ago, but no answer till now. Please note that without this turned off screen I can see two login screens - one covers the other. There are two, because one display has higher resolution and the other lower and are display both. I tried to fix theme itself, but I'm not so familiar with qml and themes for sddm, so I gave up and applied turn around. Anyway my Xsetup content looks like this:
#!/bin/sh
xrandr --output HDMI2 --off
xrandr --output HDMI1 --mode 2560x1440 --pos 0x0 --rotate normal

And back to suggested option.
I'm not sure in which section I should put setting mentioned parameter.
Comment 4 Nate Graham 2020-01-22 22:41:31 UTC
Let's make sure we're talking about the same issue here. You're reporting that when you log in as yourself using the SDDM login screen and there is an existing session for your user, Plasma hangs at a black screen? Or it logs in as you successfully, but in a new session rather than re-using the existing session?

What distro are you using?
Comment 5 Piotr Mierzwinski 2020-01-22 22:56:18 UTC
I use Antergos, which became the Arch Linux.
I turn on my PC, login into my user and after some time I use "Switch User" option. Now trying back to currently working session (because I changed my mind) on login screen I click into my self and try to login. In result Plasma started loading again, and in the middle just stop (any black screen doesn't happen). I just kill it by Ctrl+Alt+Backspace.
To be able to back to my session I need to actual switch to another user, and then I can back to my session. And then I get proper screen with button "switch to this session" (or something similar). I hope now is more clear.

Anyway I relogin myself trying to retest new updated configuration.
I added suggested parameter to both mentioned configuration files. Like this:

/etc/sddm.conf
[Theme]
CursorTheme=Adwaita

[X11]
EnableHiDPI=false
reuseSession=true


/etc/sddm.conf.d/kde_settings.conf
[Autologin]
Relogin=false
Session=
User=

[General]
HaltCommand=/usr/bin/systemctl poweroff
RebootCommand=/usr/bin/systemctl reboot
reuseSession=true

[Theme]
Current=charlie

[X11]
EnableHiDPI=true

[XDisplay]
# Xsetup script path
# A script to execute when starting the display server
DisplayCommand=/usr/share/sddm/scripts/Xsetup

[Users]
MaximumUid=60000
MinimumUid=1000
reuseSession=true

Unfortunately it changed nothing. Again after I used "Switch User" I got normal sddm login screen and when I chose my self then Plasma again started loading.

I use sddm in version 0.18.1
Comment 6 Piotr Mierzwinski 2020-01-22 22:59:41 UTC
Worth to add that after failed loading Plasma, which I killed before, when I finally switch to my session and here I try to turn off PC, it just doesn't work. Just after clicking "Shut Down" happens nothing.
Comment 7 Piotr Mierzwinski 2020-01-22 23:03:47 UTC
After I logged out from another session and again clicked "Switch User" I got proper screen, where I was able actual switch back to my currently working Plasma session. This didn't look like normal sddm login screen what I saw at very first time.
Comment 8 Nate Graham 2020-01-22 23:43:47 UTC
Okay so the problem is that when logging in as yourself in SDDM, Plasma crashes or hangs or something.
Comment 9 Piotr Mierzwinski 2020-01-23 19:47:34 UTC
(In reply to Nate Graham from comment #8)
> Okay so the problem is that when logging in as yourself in SDDM, Plasma
> crashes or hangs or something.

I suppose the problem is that, I should be able to reuse already running session and Plasma should not start loading again for account for which already is running. I'm not sure if this is bug in the Plasma or in the sddm.
Comment 10 Piotr Mierzwinski 2020-01-30 18:17:52 UTC
Another related issue is that. When I log off from recently switched user I get also the same normal login screen (sddm), and when I try to back to my session Plasma again loading itself, and after some time black screen appears. When I kill it (Ctrl+Alt+Backspace) then I get switching screen and can normally back to my session.

I'm not sure if this is issue only on my system or also others experience this.
Nate didn't confirm if he meets it or not.
Comment 11 Piotr Mierzwinski 2020-01-30 18:56:10 UTC
I thought that maybe this issue is because I applied work around for double login screen in case having two displays/screens with different resolutions. I mean entry DisplayCommand=/usr/share/sddm/scripts/Xsetup in sddm config file. I restored configuration to original and removed Xsetup file. Restarted PC and again experienced the same described below issue.
Comment 12 Piotr Mierzwinski 2020-01-30 19:11:19 UTC
Testing reused session by sddm I discovered that switching screen is displaying if any user is logged in TTY (text terminal) session. In this case I can see suggestion to switch to already logged (on TTY) user (and see another user calling "Unused") or I'm able to back to mine (by button "Back").

Strange is that this screen is not displayed if there is logged only one user and when I'm trying to switch user then I get normal login screen providing by sddm. The work around for this is just killing this by Ctrl+Alt+Backspace. After that appearing switching screen.

Another case with strange behavior is that, when I log off user in TTY (as in described above situation), I back to Plasma and will try to use "Switch User", then I get switching screen with user calling "Unused" and of course "Back" button which allows me to back to my Plasma session.
Comment 13 Piotr Mierzwinski 2020-01-30 22:05:35 UTC
I found that in distribution KaOS it works well. Only I didn't test multi-monitor configuration. 
In this moment seems this is issue related with my distribution (or only my instance this distribution).
Comment 14 Nate Graham 2020-01-31 22:30:29 UTC
Ah, so this is Bug 407305.

Can confirm now.

*** This bug has been marked as a duplicate of bug 407305 ***
Comment 15 Piotr Mierzwinski 2020-02-24 20:56:25 UTC
(In reply to Nate Graham from comment #14)
> Ah, so this is Bug 407305.
> 
> Can confirm now.
> 
> *** This bug has been marked as a duplicate of bug 407305 ***

I think bug I reported isn't duplication of this you linked (referring to increasing file sessions).
Here the problem is that after using "Switch User" from some unknown reason I get normal login screen, and when I try to use it to back to old session, this leads to breaking currently running session.
I tested this issue also on newly installed KaOS Linux distribution, where I met the same behavior.
And after this I discovered something interesting.
My X session (and of course Plasma session) starts originally on vte1 (achievable after Ctrl+Alt+F1). When I use "Switch User" seems that it magically switches into vte2 and on vte1 starts _correct_User_Switch_screen_. I get this correct screen when when I use Switch User very first time and when "normal login screen" is visible (not expected result) I use Ctrl+Alt+F1. In this moment I can switch user creating new session or just back to currently working. Strange thing is that, when I back and try again switch user then I get _correct_User_Switch_screen_, not like very first time "normal login screen".
This was tested on single monitor configuration.
I reproduced this on my arch based distribution and newly installed KaOS.
Comment 16 Piotr Mierzwinski 2020-02-24 21:38:18 UTC
I tried to fix it like that:
[X11]
Change
MinimumVT=1
to
MinimumVT=2 or more.

Only one difference I observed was that on vte1 I have messages from starting kernel, and on vte2 still appearing normal login screen. Switching to vte1 and back to vte2 shows "switch user screen".

Advice comes from: https://forum.manjaro.org/t/solved-my-towers-kde-lost-ability-to-switch-user/41051/13
Comment 17 Nate Graham 2021-06-21 22:46:18 UTC

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