Bug 426194 - OS Soft-lock when locking screen and switching back to the same user; running session isn't restored
Summary: OS Soft-lock when locking screen and switching back to the same user; running...
Status: RESOLVED UPSTREAM
Alias: None
Product: plasmashell
Classification: Plasma
Component: Lock/logout (show other bugs)
Version: 5.18.5
Platform: Kubuntu Linux
: NOR grave
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 424322 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-09-05 00:27 UTC by Geekley
Modified: 2022-11-05 03:38 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geekley 2020-09-05 00:27:50 UTC
SUMMARY
When locking Plasma session, and clicking switch user, I can't go back to same user (unlock session) in SDDM.
Plasma tries to start new session, but shows nothing. Whole system soft-locks and can't be interacted with. Keystrokes don't work. Can't recover from this state without a shutdown.


STEPS TO REPRODUCE

Steps I tested:
0a. (have multiple user accounts, may be relevant)
0b. (you may want to open some app; but make sure no important apps / files are open since you'll have to force a shutdown)
0c. (you may want to set some FG and BG apps to load on startup, to see the missing title bar effect)
0d. (not sure if relevant, but in System Settings > Startup and Shutdown > Desktop Session, you may want to set it to "Start with empty session")
1. Lock screen (META+L)
2. Click switch user
3. Choose same user, type password, enter
4. Wait for Plasma startup animation
5. There is a black screen / BG; system soft-locks
6. Test various keystrokes; but can only use power button here (press, no need to hold); takes a while to shutdown or reboot

Combinations that I didn't test, but might cause this too:
- Using Menu > Leave > Lock Screen (instead of shortcut) - PROBABLY YES
- Switch user directly (without Lock Screen first) - PROBABLY NOT
- Switch to different user, then back (using various methods) - PROBABLY NOT
- Anything involving terminal (CTRL+ALT+F7 / CTRL+ALT+F1) - NO IDEA


OBSERVED RESULT

After entering password, previous session isn't restored / unlocked.
Plasma/Breeze presentation screen is shown, as if trying to start a new session.
It seems to fail to start a new session. BG / Plasma UI isn't loaded, so a black screen is shown.

The apps configured to load on startup are loaded (and seem kind of interactable), but windows have no title bar. The apps that were open when locked session are nowhere to be seen, but I assume they're still running.
The taskbar / task manager panel isn't loaded.
OS Keyboard shortcuts (such as CTRL+ALT+DEL) don't seem to work as expected (should show options to logout, etc).
I think CTRL+ALT+F7 / CTRL+ALT+F1 doesn't work either.

Unable to recover from this state (soft-lock? hang?).
The only thing that seems to work is pressing (no need to hold) the laptop power button. When I do that, screen goes black. After long wait, it shuts down or reboots the computer "gracefully" (I hope?).


EXPECTED RESULT
Screen should be unlocked, and all apps from running session should be restored.


SOFTWARE/OS VERSIONS
OS: Kubuntu 20.04 64-bit
Linux Kernel: 5.4.0-45-generic
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8

Output of Command: apt list plasma* | grep installed
plasma-browser-integration/focal-updates,now 5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-calendar-addons/focal,now 4:5.18.4.1-0ubuntu2 amd64 [installed,automatic]
plasma-dataengines-addons/focal,now 4:5.18.4.1-0ubuntu2 amd64 [installed,automatic]
plasma-desktop-data/focal-updates,focal-updates,now 4:5.18.5-0ubuntu0.1 all [installed,automatic]
plasma-desktop/focal-updates,now 4:5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-discover-backend-fwupd/focal-updates,now 5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-discover-backend-snap/focal-updates,now 5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-discover-common/focal-updates,focal-updates,now 5.18.5-0ubuntu0.1 all [installed,automatic]
plasma-discover-snap-backend/focal-updates,focal-updates,now 5.18.5-0ubuntu0.1 all [installed,automatic]
plasma-discover/focal-updates,now 5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-framework/focal,now 5.68.0-0ubuntu1 amd64 [installed,automatic]
plasma-integration/focal,now 5.18.4.1-0ubuntu2 amd64 [installed,automatic]
plasma-nm/focal-updates,now 4:5.18.4.1-0ubuntu1.1 amd64 [installed,automatic]
plasma-pa/focal-updates,now 4:5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-runners-addons/focal,now 4:5.18.4.1-0ubuntu2 amd64 [installed,automatic]
plasma-thunderbolt/focal,now 5.18.4.1-0ubuntu1 amd64 [installed,automatic]
plasma-vault/focal-updates,now 5.18.5-0ubuntu0.1 amd64 [installed,automatic]
plasma-wallpapers-addons/focal,now 4:5.18.4.1-0ubuntu2 amd64 [installed,automatic]
plasma-widgets-addons/focal,now 4:5.18.4.1-0ubuntu2 amd64 [installed,automatic]
plasma-workspace/focal-updates,now 4:5.18.5-0ubuntu0.1 amd64 [installed,automatic]


ADDITIONAL INFORMATION

When I talk about "restoring session" I mean unlocking screen, not restoring in the same sense from the Settings App > Desktop Session.
In fact, my accounts are set to "start with empty session", not to "restore previous session". This may be relevant for reproducing.
I have been tweaking a few things in the Settings App, so, if you can't reproduce, tell me if there is any other non-default setting that could be causing this bug to appear.
Comment 1 Geekley 2020-09-05 00:33:11 UTC
Output of Command: apt list *sddm* | grep installed
kde-config-sddm/focal,now 4:5.18.4.1-0ubuntu1 amd64 [installed,automatic]
sddm-theme-breeze/focal-updates,now 4:5.18.5-0ubuntu0.1 amd64 [installed,automatic]
sddm/focal,now 0.18.1-1ubuntu2 amd64 [installed,automatic]
Comment 2 Geekley 2020-09-05 00:40:31 UTC
Oops, just noticed possible duplicate: https://bugs.kde.org/show_bug.cgi?id=424322
Comment 3 David Edmundson 2021-03-01 22:21:12 UTC
*** Bug 424322 has been marked as a duplicate of this bug. ***
Comment 4 David Edmundson 2021-03-01 22:22:25 UTC
Please include output of

sddm --example-config
Comment 5 David Edmundson 2021-03-01 22:22:36 UTC
Marking as needs info till then
Comment 6 Geekley 2021-03-01 23:07:58 UTC
Sorry for the delay. I had to use dpkg-reconfigure to switch back to sddm (I had changed to gdm3 because of this bug). Here's the output after changing back:

$ sddm --example-config
[Autologin]
# Whether sddm should automatically log back into sessions when they exit
Relogin=false

# Name of session file for autologin session (if empty try last logged in)
Session=

# Username for autologin session
User=


[General]
# Halt command
HaltCommand=/bin/systemctl poweroff

# Input method module
InputMethod=qtvirtualkeyboard

# Comma-separated list of Linux namespaces for user session to enter
Namespaces=

# Initial NumLock state. Can be on, off or none.
# If property is set to none, numlock won't be changed
# NOTE: Currently ignored if autologin is enabled.
Numlock=none

# Reboot command
RebootCommand=/bin/systemctl reboot


[Theme]
# Current theme name
Current=ubuntu-theme

# Cursor theme used in the greeter
CursorTheme=

# Number of users to use as threshold
# above which avatars are disabled
# unless explicitly enabled with EnableAvatars
DisableAvatarsThreshold=7

# Enable display of custom user avatars
EnableAvatars=true

# Global directory for user avatars
# The files should be named <username>.face.icon
FacesDir=/usr/share/sddm/faces

# Theme directory path
ThemeDir=/usr/share/sddm/themes


[Users]
# Default $PATH for logged in users
DefaultPath=/bin:/usr/bin

# Comma-separated list of shells.
# Users with these shells as their default won't be listed
HideShells=

# Comma-separated list of users that should not be listed
HideUsers=

# Maximum user id for displayed users
MaximumUid=60000

# Minimum user id for displayed users
MinimumUid=1000

# Remember the session of the last successfully logged in user
RememberLastSession=true

# Remember the last successfully logged in user
RememberLastUser=true

# When logging in as the same user twice, restore the original session, rather than create a new one
ReuseSession=false


[Wayland]
# Enable Qt's automatic high-DPI scaling
EnableHiDPI=false

# Path to a script to execute when starting the desktop session
SessionCommand=/etc/sddm/wayland-session

# Directory containing available Wayland sessions
SessionDir=/usr/share/wayland-sessions

# Path to the user session log file
SessionLogFile=.local/share/sddm/wayland-session.log


[X11]
# Path to a script to execute when starting the display server
DisplayCommand=/usr/share/sddm/scripts/Xsetup

# Path to a script to execute when stopping the display server
DisplayStopCommand=/usr/share/sddm/scripts/Xstop

# Enable Qt's automatic high-DPI scaling
EnableHiDPI=false

# The lowest virtual terminal number that will be used.
MinimumVT=1

# Arguments passed to the X server invocation
ServerArguments=-nolisten tcp

# Path to X server binary
ServerPath=/usr/bin/X

# Path to a script to execute when starting the desktop session
SessionCommand=/etc/sddm/Xsession

# Directory containing available X sessions
SessionDir=/usr/share/xsessions

# Path to the user session log file
SessionLogFile=.local/share/sddm/xorg-session.log

# Path to the Xauthority file
UserAuthFile=.Xauthority

# Path to xauth binary
XauthPath=/usr/bin/xauth

# Path to Xephyr binary
XephyrPath=/usr/bin/Xephyr
Comment 7 Geekley 2021-03-01 23:13:47 UTC
> I think CTRL+ALT+F7 / CTRL+ALT+F1 doesn't work either.

I tested now and CTRL+ALT+F1 did seem to bring me out of the softlock at first (I could go back to the logged session), but it was still buggy because "Leave session" command didn't work after that.
Comment 8 Karol Grudziński 2021-03-07 14:06:49 UTC
It frustrates me for the last 20 years (KDM and GDM worked the same way) that it is possible to even start a new GUI session for the same user.
Comment 9 David Edmundson 2021-03-29 11:06:47 UTC
[Users]
ReuseSession=false

Set this to true and it will act as you expect it should

It will be the default in newer SDDM.
Comment 10 Geekley 2021-03-29 19:10:57 UTC
Thanks! I've set it in a `/etc/sddm.conf.d/reuse.conf` and it worked after a reboot!
Good to know it will be default. That does solve the problem, and makes a lot more sense.

While it's technically still a bug for people who'd use duplicate GUI sessions, I'd say whatever. This is likely an extremely rare use case anyways, and it's only fair that it's not properly supported (and it must be a pain to test things taking this in consideration).

In fact, I wonder what would even be a valid use case for that? Legit question. I couldn't find info in a quick search on the web. Maybe for people to be able to test Gnome/Plasma or X/Wayland in parallel or something? Testing environment vars? Is this, like, a feature mostly for helping developers test things?
Comment 11 Geekley 2021-03-29 22:02:55 UTC
Actually, I've done more testing and SDDM still has some of these bugs even with ReuseSession=true. I took notes of the steps, in a "branching" form.

STEPS TO REPRODUCE AND OBSERVED RESULTS
(I merged multiple bugs I noticed when starting with the same steps, you may need to redo a few times from start to see the other "branch")

prereq0a. ReuseSession=true in sddm conf; using always Plasma session, not gnome
prereq0b. Have at least 2 users (in my case, they have same password, this may be relevant!)

1. Start with a fresh (re)boot of Kubuntu (don't just logout); you're at login screen.
2. Login User1 at SDDM
3. Winkey+L, Switch User; you're back at SDDM
3a. BUG#1! If you click Reboot, it takes a long time. It seems to be waiting at least 1 minute or so on purpose before rebooting, but there's no visual indication of this wait, or option to kill processes to reboot immediately (like in Windows).

Again, from step 3:
4. Choose User2 at SDDM and login
5. Winkey+L, Switch User; User1 at tty1 is shown
6. Start New Session; you're back at SDDM
7. Login User1 again at SDDM
7a. BUG#2! You're back to lock screen of User2, not User1. At least it's asking for the password.

8. At this lock screen, type password to go back to User2
9. CTRL+ALT+DEL, Logout
9a. BUG#3! You're now logged to User1! This time it didn't even ask for the password (maybe having same password for both users is related to this somehow? I didn't test with different passwords)!

10. Winkey+L, Switch User
10a. BUG#4! Now there's an Unused Session! If you use this session, you're at a black screen with empty console prompt (tty2?). CTRL+ALT+DEL here will reboot, again, after long wait of > 1 minute.

Again, from step 10:
11. Instead of the unused session, choose Start New Session; you're back at SDDM
12. Try to login as User2 now (type password, enter)
12a. BUG#5! You're back to User1 again! It's asking for password. Unused is still there!
12b. Not sure what happened here, but it seems that if you wait 1+ minute, it goes back to SDDM on its own? Was it logging out under the hood?? I'm not 100% sure, but I think that I just waited, because I was taking notes on a paper; I don't think I clicked New Session.

Anyways, from step 12, quickly:
13. Login back to User1 again from that lock screen
14. CTRL+ALT+DEL, Logout
15. It does seem like you have to wait 1+ minute here... now you're back at SDDM
16. Try to login at User2 (password, enter)
16a. BUG#6! It seems like it would have succeeded (fade out transition), but you end up in SDDM still! If you now try User1 the same happens! You can't login to either!

There's definitely something wrong in the way SDDM and/or Plasma is handling these sessions. Something about tty1/tty2, I don't know. But I don't think this happens when using GDM with Plasma.


EXPECTED BEHAVIOR

I'd expect that ReuseSession=true would make it so that those options "use this session" or "start new session" would not even show up (it would always behave like in step 3, even with multiple users logged in). It think this setting should make "Switch User" in lock screen ALWAYS take you to SDDM (not stay in lock screen to see the other sessions).

Then on SDDM (not lock screen), you'd be able to see some visual indication on each user of whether or not they're already logged in. For example, a dot next to the user avatar img, or some text like "(logged in)" after the user name.

And if you try to reboot or shut down from there, it should show a dialog asking for confirmation, like: "Some users are still logged in, are you sure?"; that dialog can have the wait time of 1+ minute to kill it if you don't click anything; or the option to cancel or shut down immediately without waiting.

And it would never use tty2 for anything GUI if I don't explicitly ask for it (like by pressing CTRL+ALT+F2 or something). All GUI sessions are in tty1, in fact, a novice user shouldn't even notice that this is a thing.


SOFTWARE/OS VERSIONS
OS: Kubuntu 20.04 64-bit
Linux Kernel: 5.4.0-70-generic
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Comment 12 Nate Graham 2022-11-05 03:21:01 UTC
Since these are SDDM bugs, can you open a new bug report at https://github.com/sddm/sddm/issues? Thanks!
Comment 13 Geekley 2022-11-05 03:38:19 UTC
https://github.com/sddm/sddm/issues/1609
I've added the summary from here and a link to this page.