Bug 448229 - Xwayland stops working after switching users
Summary: Xwayland stops working after switching users
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.23.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-10 18:51 UTC by Evgeny
Modified: 2022-07-02 08:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
wayland session logs (36.18 KB, text/plain)
2022-01-11 10:29 UTC, Evgeny
Details
strace glxgears (51.35 KB, text/plain)
2022-01-26 18:25 UTC, Evgeny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny 2022-01-10 18:51:26 UTC
SUMMARY
It's not possible to launch new xwayland apps after switching users. Launched before switch apps are working fine.


STEPS TO REPRODUCE
1. Run plasma with sddm with user 1
2. Press "Switch User" and login as user 2
3. Press "Switch User" and login back as user 1
4. Try to run any xwayland app

OBSERVED RESULT
It doesn't run (with errors like can't open display :1).

EXPECTED RESULT
It should run.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: NixOS 21.11
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.87
Comment 1 Vlad Zahorodnii 2022-01-11 10:13:59 UTC
Can you attach wayland session logs after making Xwayland crash? Wayland session logs are at ~/.local/share/sddm/wayland-session.log
Comment 2 Evgeny 2022-01-11 10:29:34 UTC
Created attachment 145324 [details]
wayland session logs

Here are the logs, but I don't think xwayland crashes because xwayland apps launched before user switch works fine.
Comment 3 Vlad Zahorodnii 2022-01-11 10:36:54 UTC
Can you check the value of the XAUTHORITY environment variable before & after switching user?
Comment 4 Evgeny 2022-01-11 14:00:13 UTC
XAUTHORITY=/run/user/1000/xauth_TEtNwZ - it doesn't change after user switch, and another user has different XAUTHORITY value.
Comment 5 Bug Janitor Service 2022-01-26 04:37:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Vlad Zahorodnii 2022-01-26 10:31:00 UTC
(In reply to Evgeny from comment #4)
> XAUTHORITY=/run/user/1000/xauth_TEtNwZ - it doesn't change after user
> switch, and another user has different XAUTHORITY value.

Weird. It seems like I cannot reproduce the issue in 5.24. X11 apps can be started after switching between users.

Not sure what might be causing the issue, as long as the xauthority remains the same, x11 apps should be able to connect to xwayland. Changing hostname can cause connection issues, but that doesn't look like the case here.
Comment 7 Evgeny 2022-01-26 11:39:45 UTC
The strange thing is that it happens only when I use switch user functionality and start new session with it. If I start plasma manually via `dbus-run-session startplasma-wayland` and switch between different tty with switch user or via ctrl+alt+f1-2 everything works fine.
Comment 8 Evgeny 2022-01-26 11:56:55 UTC
Some more info - apps are complaining about invalid MIT-MAGIC-COOKIE-1:
Invalid MIT-MAGIC-COOKIE-1 keyDisplay :1 unavailable

But at the same time xauth list shows:
dell/unix:1  MIT-MAGIC-COOKIE-1  12333bcf3f7de137aa43e19008b66f6c
#ffff##:1  MIT-MAGIC-COOKIE-1  12333bcf3f7de137aa43e19008b66f6c

And it doesn't change before/after switch.
Comment 9 Vlad Zahorodnii 2022-01-26 15:00:38 UTC
As a workaround,  you could put `KWIN_WAYLAND_NO_XAUTHORITY=1` in /etc/environment and reboot. Still, no idea what can break x11 apps. Can you check whether hostname is alright, e.g. hostnamectl status output and /etc/hostname file? Also, a shot in the dark, but maybe apps cannot open sockets inside /tmp/.X11-unix/? can you run `strace glxgears` and attach its output to the bug report?
Comment 10 Vlad Zahorodnii 2022-01-26 15:04:13 UTC
Can you also clarify what version of sddm you have on computer?
Comment 11 Evgeny 2022-01-26 18:25:20 UTC
Created attachment 145967 [details]
strace glxgears
Comment 12 Evgeny 2022-01-26 18:27:17 UTC
> Can you check whether hostname is alright, e.g. hostnamectl status output and /etc/hostname file?

Yes, it's correct.

> Can you also clarify what version of sddm you have on computer?

0.19.0
Comment 13 Evgeny 2022-07-02 08:35:21 UTC
I just checked plasma 5.24 and it works fine here (though the issue with kwin consuming 100% of cpu core remains) so I think this can be closed.