Problem launching QT snaps in Wayland

Since the last 2 or 3 revisions I have a problem trying to start the snap for qownnotes. I’m using Ubuntu 18.04.1 and Wayland and now when I try to start it I get this error:

$ qownnotes
Fatal: This application failed to start because it could not find or load the Qt platform plugin "wayland-egl".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem. ((null):0, (null))

And here’s the info about snapd:

$ snap --version
snap    2.35
snapd   2.35
series  16
ubuntu  18.04
kernel  4.15.0-33-generic

I’ve opened an issue in the qownnotes repo: https://github.com/pbek/QOwnNotes/issues/1004 But it seems a problem related to snapd + Ubuntu 18.04 + Wayland. Any ideas?

Thanks!

Well, I’ve just compiled and uploaded musescore version 2.3.2 using launchpad and I’m seeing the same error when trying to launch musescore now:

$ musescore.mscore 
This application failed to start because it could not find or load the Qt platform plugin "wayland-egl".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem.

Is the wayland QPA plugin included in the snap? Should be in $SNAP/usr/lib//qt/plugins/platform/ If not, add “qtwayland5” to the staged packages.

1 Like

Well, it did work: with qtwayland5 package in stage they do work now, the problem is that the apps look awful now under wayland…Is there any way to force the old behavior (to use Xwayland I guess)?
I’ve also tried to build a snap with core18 (so it’s using Qt 5.9.5) but the result is the same…

You could set the DISABLE_WAYLAND environment variable to force x11 support. Something like this should do:

app:
  command: ....
  environment:
    DISABLE_WAYLAND: 1

Would you mind sharing what looks awful? Fonts wrong? Sizing? Are icons not using the correct theme?
Thanks
-G

1 Like

Thanks for the tip! That did the trick!

These are examples of the Keepassxc snap compiled with base: core18 & qtwayland5; with DISABLE_WAYLAND=1 (using Xwayland I guess):

And with no variable set (using Wayland-EGL):

And those are the messages I get when doing the latest:

$ keepassxc
QSocketNotifier: Can only be used with threads started with QThread
Using Wayland-EGL
EGL not available
Cannot find EGLConfig, returning null config
Using the 'xdg-shell-v6' shell integration
...

@pachulo screenshots perfect, thank you. Icon themes look ok, but text sizes and theme colours are wrong. I’ll need to investigate that.
Thanks again!
-G

2 Likes

Could it be something related to Qt?
http://blog.qt.io/blog/2018/05/29/whats-new-in-qt-5-11-for-the-wayland-platform-plugin/#comment-1203650

Apart from the ugliness, copy seems to neither work…If so, I think it’s sensible to set the DISABLE_WAYLAND=1 env as the default for now…

Can I include that in the QOwnNotes snap config already, without fear of damaging anything? :slight_smile:

Yeah! With that and the inclusion of the qtwayland5 package in stage it should be good to go!

Try plugging the gsettings interface. Based on the screenshots, it looks like the app is following the standard Ubuntu GTK theme on X11 but not Wayland. GTK uses a different method of selecting a theme for the X11 and Wayland backends, and the Wayland backend requires access to GSettings.

1 Like

Thanks for the tip but as far as I can tell, is already connected:

:gsettings chromium,gnome-calculator,gnome-characters,gnome-logs,gnome-system-monitor,keepassxc

Ubuntu 18.04 has package qt5-gtk-platformtheme that should fix the theme issue, but I am running into errors when building on 18.04. The errors have to do with the desktop-qt5 cloud part still building in 16.04 so there ends up being conflicts in staged files between the app and cloud part files.

@sigill I’ve tried what you say with Keepassxc:

And my build went OK:

but the app still looks quite ugly.

It does look like your build worked. I saw the shared object at /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so. Perhaps you need to force using it by running keepassxc with environment variable QT_QPA_PLATFORMTHEME=gtk3? You can see info on QT plugin loading by setting QT_DEBUG_PLUGINS=1. Also, to rule out permission issues, you may want to try installing the snap in devmode.

1 Like

Well, it seems that the QT_QPA_PLATFORMTHEME=gtk3 option did indeed change something: now the application starts as ugly as before, but as you start working with it some stuff begins to look GTK-themed.

Quite strange behaviour, but I’m guessing it’s maybe a problem with QT 5.9.5 implementation for Wayland, because parts of the application not being re-drawn and so are also happening when QT_QPA_PLATFORMTHEME=gtk3 is not used…And besides that, stuff like copy pasting things neither work when using the Wayland implementation.

As a package author I was trying your suggestion to add qtwayland5 to the stage-packages, but that didn’t seem to work. See my changes: https://github.com/bitcoin-core/packaging/compare/ce9ef1ab990a05bb12b85f3f6a07219cd9350397...d192c73457adbaf83ad160e9ced0404b3bed79e1#diff-5fde7a6d86053f0e1d88c0a2a238941f

Is there anything else I could try? (The package is available under bitcoin-core under latest/edge)

1 Like

I’m having this problem with Heimer (https://github.com/juzzlin/Heimer) and Ubuntu 22.04.

I added qtwayland5 to the state-packages and the application started again on Ubuntu 22.04, but with a UI that was a mess. I ended up adding DISABLE_WAYLAND: 1 to app environment that seemed to “fix” the problem.