Bug 417227 - No keyboard shortcuts work on Wayland when using musl instead of glibc
Summary: No keyboard shortcuts work on Wayland when using musl instead of glibc
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-06 12:05 UTC by Bart Ribbers
Modified: 2023-09-20 06:25 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
"ps ux" output of a fresh Wayland session (7.36 KB, text/x-log)
2020-09-07 10:41 UTC, Bart Ribbers
Details
"env" output of a fresh Wayland session (1.94 KB, text/x-log)
2020-09-07 10:42 UTC, Bart Ribbers
Details
"qdbus" output of a fresh Wayland session (3.00 KB, text/x-log)
2020-09-07 10:42 UTC, Bart Ribbers
Details
"kwin_wayland" output with "export `dbus-launch`" just before (2.00 KB, text/x-log)
2020-09-07 10:48 UTC, Bart Ribbers
Details
Strace output of "kwin_wayland" (1.22 MB, text/x-log)
2020-09-07 10:52 UTC, Bart Ribbers
Details
"strace -f" output of "kwin_wayland" (144 bytes, text/plain)
2020-09-07 10:59 UTC, Bart Ribbers
Details
"strace -fefault=prctl" output of "kwin_wayland" (2.90 MB, text/x-log)
2020-09-07 11:04 UTC, Bart Ribbers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bart Ribbers 2020-02-06 12:05:28 UTC
SUMMARY

When starting a Plasma on Wayland session, none of my keyboard shortcuts work.
This was debugged a bit last Akademy in Milano, and it seemed it was an issue while starting KWin where kglobalaccel doesn't start up properly.

This makes the whole session unusable to me and I have to resort back to X11.


STEPS TO REPRODUCE
1. Install an Alpine 3.11 or Alpine edge system
2. Install the `plasma` meta package, it pulls in all required dependencies
3. Launch a Plasma on Wayland session

OBSERVED RESULT
No keyboard shortcuts will work. E.g. you can't launch Kickoff by pressing the menu button, you can't open KRunner by pressing Alt + Space, etc.

EXPECTED RESULT

All keyboard shortcuts to work properly.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Alpine Linux edge
(available in About System)
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.12.5

ADDITIONAL INFORMATION

This system runs Alpine Linux, so it's based on Busybox and Musl rather than GNU Coreutils and glibc.
Comment 1 Arjen Hiemstra 2020-02-06 12:13:08 UTC
From what I recall (as the one who did some of the debugging), it basically boiled down to a race between KWin and KGlobalAccel. KWin will try to D-Bus activate KGlobalAccel which for some as yet unknown reason fails. This then leads to KWin not knowing about any global shortcuts. A bit later in session startup, other things will also try to D-Bus activate KGlobalAccel and succeed.
Comment 2 David Edmundson 2020-02-06 12:35:37 UTC
Can you try with D19004
Comment 3 Bart Ribbers 2020-02-06 12:44:22 UTC
Well it doesn't cleanly apply on Plasma Workspace 5.17.5, probably because startplasmacompositor nowadays is startplasma-wayland.

However, just running "startplasma-wayland" without "dbus-run-session" in a TTY makes it complain that it can not start D-Bus.

> not a reply org.freedesktop.locale1 QDBusMessage(type=Error, service="org.freedesktop.DBus", error name="org.freedesktop.DBus.Error.ServiceUnknown", error message="The name org.freedesktop.locale1 was not provided by any .service files", signature="s", contents=("The name org.freedesktop.locale1 was not provided by any .service files") )
> startplasmacompositor: Could not start D-Bus. Can you call qdbus?
Comment 4 Bart Ribbers 2020-09-07 10:41:38 UTC
Created attachment 131462 [details]
"ps ux" output of a fresh Wayland session
Comment 5 Bart Ribbers 2020-09-07 10:42:00 UTC
Created attachment 131463 [details]
"env" output of a fresh Wayland session
Comment 6 Bart Ribbers 2020-09-07 10:42:16 UTC
Created attachment 131464 [details]
"qdbus" output of a fresh Wayland session
Comment 7 Bart Ribbers 2020-09-07 10:43:36 UTC
The output of "qdbus org.kde.KWin /kglobalaccel" was "'Service org.kde.KWin' does not exist"
Comment 8 Bart Ribbers 2020-09-07 10:48:07 UTC
Created attachment 131465 [details]
"kwin_wayland" output with "export `dbus-launch`" just before
Comment 9 Bart Ribbers 2020-09-07 10:52:47 UTC
Created attachment 131466 [details]
Strace output of "kwin_wayland"
Comment 10 Bart Ribbers 2020-09-07 10:55:19 UTC
Comment on attachment 131466 [details]
Strace output of "kwin_wayland"

Content of $DBUS_SESSION_BUS_ADDRESS (so you know what to grep for):

unix:abstract=/tmp/dbus-MtXGbvVMbv,guid=3ac1e07735b147e1fc7c994d5f560f63
Comment 11 Bart Ribbers 2020-09-07 10:59:11 UTC
Created attachment 131467 [details]
"strace -f" output of "kwin_wayland"
Comment 12 Bart Ribbers 2020-09-07 11:04:21 UTC
Created attachment 131468 [details]
"strace -fefault=prctl" output of "kwin_wayland"

Content of $DBUS_SESSION_BUS_ADDRESS (so you know what to grep for):

unix:abstract=/tmp/dbus-MtXGbvVMbv,guid=3ac1e07735b147e1fc7c994d5f560f63
Comment 13 Fabian Vogt 2020-09-07 14:05:50 UTC
[15:45] <fvogt> Just remove CAP_SYS_NICE and it'll work
[15:45] <PureTryOut[m]> And how would I do that?
[15:47] <fvogt> setcap /usr/bin/kwin_wayland cap_sys_nice=
[15:48] <fvogt> Actually, just setcap -r /usr/bin/kwin_wayland
[15:49] <PureTryOut[m]> You're right, that fixed it! :tadad

[15:54] <fvogt> kwin_wayland's CAP_SYS_NICE makes _dbus_check_setuid trigger and so it ignores environment variables
[15:57] <fvogt> It works on glibc because it only checks the suid/euid
[15:57] <fvogt> On musl, issetugid is available and that doesn't like capabilities

Ideally, kwin gets rid of its CAP_SYS_NICE. It's effectively a backdoor anyway.
Comment 14 Fabian Badoi 2021-06-16 07:47:28 UTC
I also experience this bug. If I log in to a Wayland session, global keyboard shortcuts don't work. They work fine in X11 sessions.

Fabian Vogt's solution from here works for me: https://bugs.kde.org/show_bug.cgi?id=417227#c13

System details:
Distributor ID: Neon
Description:    KDE neon User Edition 5.22
Release:        20.04
Codename:       focal
Comment 15 David Edmundson 2023-06-20 23:02:45 UTC
I have a recollection that we spoke at akademy and it's no longer an issue? Is that correct?
Comment 16 Bart Ribbers 2023-06-21 07:05:09 UTC
It is not, but only because at Alpine Linux we now ship a workaround, https://git.alpinelinux.org/aports/tree/community/kwin/APKBUILD#n108. The same workaround is applied at powerdevil to make that launch at all, https://git.alpinelinux.org/aports/tree/community/powerdevil/APKBUILD#n73.

Pretty sure this workaround has other unforeseen consequences, so I rather have it fixed properly.
Comment 17 Bug Janitor Service 2023-07-06 03:45:11 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 18 Sławek 2023-09-20 06:21:47 UTC
I hit the same issue (probably) on Fedora 38 and KDE Plasma 5.27.8. No custom shortcuts works for me at all and I see that KGlobalAccel isn't running. When I want to run it I see error:

/usr/bin/kglobalaccel5
kf.dbusaddons: Couldn't register name 'org.kde.kglobalaccel' with DBUS - another process owns it already!

And when I check what process owns tis name in dbus:

qdbus  org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID org.kde.kglobalaccel
2238

ps aux | grep 2238         
slaweq      2238  0.0  0.3 3641764 214824 ?      Sl   wrz19   0:30 /usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-0 --xwayland-fd 8 --xwayland-fd 9 --xwayland-display :0 --xwayland-xauthority /run/user/1000/xauth_oawZej --xwayland
Comment 19 Fabian Vogt 2023-09-20 06:25:00 UTC
(In reply to Sławek from comment #18)
> I hit the same issue (probably) on Fedora 38 and KDE Plasma 5.27.8. No
> custom shortcuts works for me at all and I see that KGlobalAccel isn't
> running. When I want to run it I see error:
> 
> /usr/bin/kglobalaccel5
> kf.dbusaddons: Couldn't register name 'org.kde.kglobalaccel' with DBUS -
> another process owns it already!
> 
> And when I check what process owns tis name in dbus:
> 
> qdbus  org.freedesktop.DBus /org/freedesktop/DBus
> org.freedesktop.DBus.GetConnectionUnixProcessID org.kde.kglobalaccel
> 2238
> 
> ps aux | grep 2238         
> slaweq      2238  0.0  0.3 3641764 214824 ?      Sl   wrz19   0:30
> /usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-0 --xwayland-fd 8
> --xwayland-fd 9 --xwayland-display :0 --xwayland-xauthority
> /run/user/1000/xauth_oawZej --xwayland

That's all exactly as expected: kwin_wayland itself "contains" kglobalacceld.
That kwin registered itself on the bus also means your issue is unrelated to this bug, where kwin does not contact DBus at all.