Bug 445240

Summary: Logging from kwin_wayland failing to start with 10 "cannot open display" Gtk-WARNING lines is not helpful enough to determine the issue
Product: [Plasma] kwin Reporter: Alex Folland <lexlexlex>
Component: platform-wayland-nestedAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UNMAINTAINED    
Severity: major CC: lexlexlex, nate
Priority: NOR Keywords: usability
Version First Reported In: 5.23.3   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: wayland session log

Description Alex Folland 2021-11-10 01:13:04 UTC
Created attachment 143390 [details]
wayland session log

***Please understand that this issue report is about logging only, not the failure to start the session.***

STEPS TO REPRODUCE

1. Have the issue where the session named "Plasma (Wayland)" fails to start from SDDM, in such a way that trying to start it from the SDDM login menu navigates to a black screen, stays there for a few seconds, then navigates back to the SDDM login menu.
2. Verify that the contents of your ~/.local/share/sddm/wayland-session.log file are the following, or any with "cannot open display:" with nothing following that text, like so:

---

(kwin_wayland:1939): Gtk-WARNING **: 16:11:52.831: cannot open display: 

(kwin_wayland:1944): Gtk-WARNING **: 16:11:52.903: cannot open display: 

(kwin_wayland:1945): Gtk-WARNING **: 16:11:52.975: cannot open display: 

(kwin_wayland:1946): Gtk-WARNING **: 16:11:53.036: cannot open display: 

(kwin_wayland:1948): Gtk-WARNING **: 16:11:53.094: cannot open display: 

(kwin_wayland:1949): Gtk-WARNING **: 16:11:53.151: cannot open display: 

(kwin_wayland:1951): Gtk-WARNING **: 16:11:53.206: cannot open display: 

(kwin_wayland:1952): Gtk-WARNING **: 16:11:53.262: cannot open display: 

(kwin_wayland:1953): Gtk-WARNING **: 16:11:53.318: cannot open display: 

(kwin_wayland:1954): Gtk-WARNING **: 16:11:53.373: cannot open display: 

(kwin_wayland:1955): Gtk-WARNING **: 16:11:53.428: cannot open display: 
startplasmacompositor: Shutting down...
startplasmacompositor: Done.

---

3. Spend as much time as it takes to search online for a way to work around the issue.

OBSERVED BEHAVIOR

The log entries here that are like "Gtk-WARNING **: 16:11:52.831: cannot open display: " with nothing after them are not informative enough to figure out what the problem is, and there's no error message explaining why the session could not start, from either kwin_wayland or startplasmacompositor.  The log file itself is attached to this ticket.

EXPECTED BEHAVIOR

Session log entries for sessions which fail to start are expected to explain clearly what is causing them to fail to start.

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: Linux 5.15
KDE Plasma Version: KDE Plasma 5.23.3
KDE Frameworks Version: 5.23.3
Qt Version: 5.15.2 and 6.2.1

ADDITIONAL INFORMATION

Remember, this issue report is not about the failure to start.  That can be tackled in another ticket.

This is about the log entries on session start failure not being useful enough to determine the cause of the session start failure.  They should always say exactly what's wrong, and improving the logging to the point where it says exactly what's wrong if the session fails to start is the only goal of this ticket.
Comment 1 Alex Folland 2022-08-09 15:55:32 UTC
I've tried again and the logging is different now for the same login issue.  It's still not quite good enough to understand exactly why Plasma can't reach the desktop, but here's an update of what's logged in `~/.local/share/sddm/wayland-session.log`.

```
kf.service.services: The desktop entry file "/usr/share/applications/kcm_krunnersettings.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/kcm_krunnersettings.desktop"
kf.service.services: The desktop entry file "/usr/share/applications/qemu.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/qemu.desktop"
/usr/bin/xrdb: Can't open display ''
QPixmap: QGuiApplication must be created before calling defaultDepth().
QPixmap: QGuiApplication must be created before calling defaultDepth().
Error: could not determine $DISPLAY.
Error: Can not contact kdeinit5!
org.kde.startup: "kdeinit5_shutdown" () exited with code 255
startplasma-wayland: Shutting down...
startplasmacompositor: Shutting down...
startplasmacompositor: Done.
```

By the way, I'm not sure if Markdown works here.  It tends to work pretty much everywhere else on the internet these days, so I'm trying it despite the preview not rendering it correctly.
Comment 2 Vlad Zahorodnii 2022-08-10 10:24:02 UTC
Can you check whether basic test cas works?

- switch to a vt, e.g. ctrl+alt+f3
- run `XDG_SESSION_TYPE=wayland dbus-run-session kwin_wayland --exit-with-session=konsole`

Do you see a konsole window? If so, can you try running `XDG_SESSION_TYPE=wayland dbus-run-session kwin_wayland --xwayland --exit-with-session=glxgears` (glxgears or any other x11 app)?
Comment 3 Alex Folland 2022-08-11 01:17:03 UTC
OK, I've tried both of those commands.  Here are the logs from them.

from `XDG_SESSION_TYPE=wayland dbus-run-session kwin_wayland --exit-with-session=konsole`

```
kf.service.services: The desktop entry file "/usr/share/applications/kcm_krunnersettings.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/kcm_krunnersettings.desktop"
kf.service.services: The desktop entry file "/usr/share/applications/qemu.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/qemu.desktop"
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.kde.KSplash' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172192 comm="startplasma-wayland --exit-with-session=konsole")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activating service name='org.freedesktop.systemd1' requested by ':1.3' (uid=1000 pid=2172221 comm="/usr/bin/kwin_wayland_wrapper --xwayland")
dbus-daemon[2172191]: [session uid=1000 pid=2172191] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'
kdeinit5: Launched KLauncher, pid = 2172230, result = 0

(kwin_wayland:2172222): Gtk-WARNING **: 18:13:45.725: cannot open display: 

(kwin_wayland:2172233): Gtk-WARNING **: 18:13:45.810: cannot open display: 

(kwin_wayland:2172234): Gtk-WARNING **: 18:13:45.887: cannot open display: 

(kwin_wayland:2172235): Gtk-WARNING **: 18:13:45.964: cannot open display: 

(kwin_wayland:2172236): Gtk-WARNING **: 18:13:46.039: cannot open display: 

(kwin_wayland:2172237): Gtk-WARNING **: 18:13:46.116: cannot open display: 

(kwin_wayland:2172240): Gtk-WARNING **: 18:13:46.200: cannot open display: 

(kwin_wayland:2172241): Gtk-WARNING **: 18:13:46.281: cannot open display: 

(kwin_wayland:2172242): Gtk-WARNING **: 18:13:46.378: cannot open display: 

(kwin_wayland:2172243): Gtk-WARNING **: 18:13:46.462: cannot open display: 

(kwin_wayland:2172244): Gtk-WARNING **: 18:13:46.542: cannot open display: 
kdeinit5: Communication error with launcher. Exiting!
Error: could not determine $DISPLAY.
Error: Can not contact kdeinit5!
org.kde.startup: "kdeinit5_shutdown" () exited with code 255
startplasma-wayland: Shutting down...
startplasmacompositor: Shutting down...
startplasmacompositor: Done.
org.kde.knotifications: WaitForName: Service was not registered within timeout
```

from `XDG_SESSION_TYPE=wayland dbus-run-session kwin_wayland --xwayland --exit-with-session=glxgears`

```
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.kde.KSplash' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=2172605 comm="startplasma-wayland --xwayland --exit-with-session")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activating service name='org.freedesktop.systemd1' requested by ':1.3' (uid=1000 pid=2172629 comm="/usr/bin/kwin_wayland_wrapper --xwayland")
dbus-daemon[2172604]: [session uid=1000 pid=2172604] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'
kdeinit5: Launched KLauncher, pid = 2172638, result = 0

(kwin_wayland:2172630): Gtk-WARNING **: 18:14:23.114: cannot open display: 

(kwin_wayland:2172639): Gtk-WARNING **: 18:14:23.190: cannot open display: 

(kwin_wayland:2172642): Gtk-WARNING **: 18:14:23.265: cannot open display: 

(kwin_wayland:2172643): Gtk-WARNING **: 18:14:23.339: cannot open display: 

(kwin_wayland:2172644): Gtk-WARNING **: 18:14:23.415: cannot open display: 

(kwin_wayland:2172645): Gtk-WARNING **: 18:14:23.492: cannot open display: 

(kwin_wayland:2172646): Gtk-WARNING **: 18:14:23.568: cannot open display: 

(kwin_wayland:2172647): Gtk-WARNING **: 18:14:23.643: cannot open display: 

(kwin_wayland:2172648): Gtk-WARNING **: 18:14:23.719: cannot open display: 

(kwin_wayland:2172649): Gtk-WARNING **: 18:14:23.796: cannot open display: 

(kwin_wayland:2172650): Gtk-WARNING **: 18:14:23.874: cannot open display: 
kdeinit5: Communication error with launcher. Exiting!
Error: could not determine $DISPLAY.
Error: Can not contact kdeinit5!
org.kde.startup: "kdeinit5_shutdown" () exited with code 255
startplasma-wayland: Shutting down...
startplasmacompositor: Shutting down...
startplasmacompositor: Done.
org.kde.knotifications: WaitForName: Service was not registered within timeout
```
Comment 4 Vlad Zahorodnii 2022-08-11 08:05:08 UTC
Did you see konsole and glxgears windows? The logs seem to be unrelated, you need to redirect stdout and stderr of kwin_wayland to a file.
Comment 5 Alex Folland 2022-08-12 05:52:22 UTC
No, I didn't see any change in visibility from the TTY.  The source of these logs is from redirecting the output to a file, and there was no output that wasn't redirected, as I saw no text output, but the file was populated.  I think you've hit the nail on the head about what this issue ticket is for: the fact that the logging output from kwin is not helpful enough to determine the issue.  It shouldn't simply exit without saying exactly what happened.  Instead, it should show some kind of helpful error message explaining exactly what's wrong, or better yet, simply work instead, since other graphical programs work with no issue.  I can even run RetroArch directly, for example, with no X11 or Wayland server previously running, so kwin doesn't have a good excuse to not simply render to my screens.
Comment 6 David Edmundson 2023-09-06 10:39:13 UTC
This bug was reported against an outdated version of KWin. We have made many changes since the. 
If the issue persists in newer versions can you reopen the bug report updating the version number.