Xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb

Hello here,

my issue is pretty similar to Snap run: xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb , but none of the proposed solution helped me.

I migrated my app from qt5 and core20 to qt6 and core24. I am using the kde-neon-qt6 extension.

When running the application under Wayland, I get the following error. No problems in X11.

xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb
Segmentation fault (core dumped)

This is because the app looks in directories which do not provide a xkb configuration

newfstatat(AT_FDCWD, "/home/luke/snap/sayonara/x1/.config/xkb", 0x7fff69791470, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/luke/snap/sayonara/x1/.xkb", 0x7fff69791470, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/xkb", 0x7fff69791470, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/snap/sayonara/x1/qt6/usr/share/X11/xkb", 0x7fff69791470, 0) = -1 ENOENT (No such file or directory)

On the system, there exist proper configurations though, but they are not in xkb’s search paths.

/snap/sayonara/x1/usr/share/X11/xkb
/snap/sayonara/x1/etc/X11/xkb
/snap/gnome-42-2204/202/usr/share/X11/xkb
/snap/kde-qt6-core24-sdk/31/var/lib/xkb
/snap/core24/1349/etc/X11/xkb
/snap/kf6-core24/34/usr/share/X11/xkb

I can confirm my app is starting when setting XKB_ROOT_CONFIG manually.

snap run --shell sayonara
XKB_ROOT_CONFIG=/snap/sayonara/x1/usr/share/X11/xkb sayonara

The KDE neon extension does a few things which breaks the system for me.

1. Setting the runtime and XKB_CONFIG_ROOT

I cannot fix that by modifying environment in the snapcraft.yml since the extension overrides it again.

    environment:
      XKB_CONFIG_ROOT: $SNAP/usr/share/X11/xkb

2. Using layout

Because of this, I cannot set a layout for /usr/share/X11/xkb, since no conflicts are allowed.

layout:
  /usr/share/X11/xkb:
    symlink: $SNAP/usr/share/X11/xkb

What’s the clean solution here? Is it possible to add some path to xkb’s search paths?

Another workaround would be to wrap my binary into a script which sets the XKB_CONFIG_ROOT before launching my application. But that seems like a hack.

Thank you a lot.

When not using a layout or setting the environment in your snapcraft.yaml, do you actually see XKB_CONFIG_ROOT set at all from a shell inside the snap ?

Are all the plugs to kf6-core24 properly connected ?

You should not ship xkb yourself at all but consume it from the extension, looking a few lines up in your paste of desktop-exports there is actually a check that verifies if the platform extension plug is actually connected and only then it will export XKB_CONFIG_ROOT, to me it looks like the connection is not there and thus it will simply not export XKB_CONFIG_ROOT into your apps environment …

Hello @ogra ,

thanks for the reply.

kde-neon-qt6 uses kde-qt6-core24 (in contrast to kde-neon-6, which uses kf6-core24)

Environment

snap run –shell sayonara, and checking the environment, I get this:

$ env | grep XKB

QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
XKB_CONFIG_ROOT=/snap/sayonara/x1/qt6/usr/share/X11/xkb

QT_XKB_CONFIG_ROOT is correct, XKB_CONFIG_ROOT isn’t.

Connections

Connections LGTM. wayland, x11, all there. I also do not receive the error message you are referring to:

  echo "ERROR: not connected to the %PLATFORM_PLUG% content interface."

$ snap connections sayonara

Interface                    Plug                              Slot                            Notes
audio-playback               sayonara:audio-playback           :audio-playback                 -
content[gpu-2404]            sayonara:gpu-2404                 mesa-2404:gpu-2404              -
content[gtk-2-themes]        sayonara:gtk-2-themes             gtk-common-themes:gtk-2-themes  -
content[gtk-3-themes]        sayonara:gtk-3-themes             gtk-common-themes:gtk-3-themes  -
content[icon-themes]         sayonara:icon-themes              gtk-common-themes:icon-themes   -
content[kde-qt6-core24-all]  sayonara:kde-qt6-core24           kde-qt6-core24:kde-qt6-core24   manual
content[sound-themes]        sayonara:sound-themes             gtk-common-themes:sound-themes  -
desktop                      sayonara:desktop                  :desktop                        -
desktop-legacy               sayonara:desktop-legacy           :desktop-legacy                 -
home                         sayonara:home                     :home                           -
mpris                        -                                 sayonara:mpris                  -
network                      sayonara:network                  :network                        -
network-bind                 sayonara:network-bind             :network-bind                   -
network-manager-observe      sayonara:network-manager-observe  -                               -
opengl                       sayonara:opengl                   :opengl                         -
optical-drive                sayonara:optical-drive            :optical-drive                  -
removable-media              sayonara:removable-media          -                               -
unity7                       sayonara:unity7                   :unity7                         -
wayland                      sayonara:wayland                  :wayland                        -
x11                          sayonara:x11                      :x11                            -

Hmm, I’d see it exactly the other way around :slight_smile: Your extension mounts under $SNAP/qt6 (at least that is what I’d expect, I never package Qt stuff but it is the same behavior the gnome extension has), ships the xkb bits in usr/share/X11/xkb (relative to the qt6 mount point) and additionally injects a layout that maps this location to /usr/share/X11/xkb, so as long as the mount is actually in $SNAP/qt6 everything should be found as expected …

When inside your snap shell, do you see things underneath$SNAP/qt6, did you check what a simple ls /usr/share/X11/xkb inside that shell shows (this should follow the layout and end up showing the content of the shipped dir of the extension)?

Indeed this only works if a) the mount works (not sure if it does for locally side-loaded snaps without manual connection) and b) you did indeed not tinker with that location in any way in your snapcraft.yaml by adding environment or layout entries that point to the same location (and cause a clash)

Sorry, I wasn’t looking carefully enough. Of course you are correct, that /usr/share/X11/xkb is not the correct path, since it’s not in the snap context.

QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
XKB_CONFIG_ROOT=/snap/sayonara/x1/qt6/usr/share/X11/xkb

I jumped into the snap run --shell sayonara.

QT_XKB_CONFIG_ROOT does not exist

/usr/share exists, but /usr/share/X11 does not exist.

$ ls -l /usr/share/X11/xkb
ls: cannot access '/usr/share/X11/xkb': No such file or directory

XKB_CONFIG_ROOT does not exist

no xkb subdirectory

$ ls -l $SNAP/qt6/usr/share/X11
total 42
-rw-r--r--  1 root root 42077 Apr  8  2024 XErrorDB
drwxr-xr-x 64 root root  1174 Sep 16 06:51 locale
lrwxrwxrwx  1 root root    24 Sep 15 05:00 rgb.txt -> ../../../etc/X11/rgb.txt

This works

but not in the xkb search paths.

$ ls -l $SNAP/usr/share/X11/xkb
total 0
drwxr-xr-x  2 root root  282 Feb  5 09:46 compat
drwxr-xr-x  4 root root  403 Feb  5 09:46 geometry
drwxr-xr-x  4 root root  265 Feb  5 09:46 keycodes
drwxr-xr-x  2 root root  241 Feb  5 09:46 rules
drwxr-xr-x 14 root root 1606 Feb  5 09:46 symbols
drwxr-xr-x  2 root root  195 Feb  5 09:46 types

And I just had a look at the kde-qt6-core24-sdk directory, same content as inside the XKB_CONFIG_ROOT dir.

$ ls -l /snap/kde-qt6-core24-sdk/current/usr/share/X11/

drwxr-xr-x 64 root root  4096 Nov 18 17:05 locale
lrwxrwxrwx  1 root root    24 Nov 18 17:04 rgb.txt -> ../../../etc/X11/rgb.txt
-rw-r--r--  1 root root 42077 Apr  8  2024 XErrorDB

the core snap has with proper data

$ ls -l /snap/core/current/usr/share/X11/xkb

drwxr-xr-x  2 root root 4096 Sep 10 00:25 compat
drwxr-xr-x  4 root root 4096 Sep 10 00:25 geometry
drwxr-xr-x  4 root root 4096 Sep 10 00:25 keycodes
drwxr-xr-x  2 root root 4096 Sep 10 00:25 rules
drwxr-xr-x 13 root root 4096 Sep 10 00:25 symbols
drwxr-xr-x  2 root root 4096 Sep 10 00:25 types

That looks like a bug with the extension then, i guess it should ship the xkb data …

Looking at one of my own snaps that uses the gnome-46-2404 extension:

ogra@acheron:~$ snap run --shell mattermost-client-ogra -c ‘echo $XKB_CONFIG_ROOT’
/snap/mattermost-client-ogra/47/gnome-platform/usr/share/X11/xkb
ogra@acheron:~$ snap run --shell mattermost-client-ogra -c ‘ls $XKB_CONFIG_ROOT’
compat	geometry  keycodes  rules  symbols  types
ogra@acheron:~$

This is core 16 :slight_smile: things have been dropped from the newer bases …

Thank you a lot for your help :slightly_smiling_face: I think we came to the same conclusion then.

I’ll contact the devs of the extension then. Either they need to change the XKB_CONFIG_ROOT and stage xkb-data, or the content snap should ship a deployed xbd directory.

1 Like