flatpak / flatpak

Linux application sandboxing and distribution framework
https://flatpak.org
GNU Lesser General Public License v2.1
4.23k stars 404 forks source link

XCB could not connect to display, module not missing #4043

Closed DaAwesomeP closed 3 years ago

DaAwesomeP commented 3 years ago

Linux distribution and version

OpenSUSE Leap 15.2 w/ KDE

Flatpak version

Flatpak 1.6.3

Description of the problem

Cannot start desktop apps.

Steps to reproduce

This is related to #3357, but not the same (no missing library). I have tried removing ~/.Xauthority and rebooting to no avail. I can sometimes start the app if it is the very first thing I do when I login. I have not gotten any responses on the OpenSUSE Forums.

App was installed via the KDE Discover app. Starting as the .desktop shortcut does:

$ /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=telegram-desktop --file-forwarding org.telegram.desktop

(process:2): Telegram-WARNING **: 16:41:04.926: Unfortunately, GTK integration conflicts with qgtk2 platformtheme and style. Therefore, QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE will be unset.
Telegram-Message: 16:41:04.928: This can be ignored by setting TDESKTOP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY environment variable to any value, however, if qgtk2 theme or style is used, this will lead to a crash.
Telegram-Message: 16:41:04.928: GTK integration can be disabled by setting TDESKTOP_DISABLE_GTK_INTEGRATION to any value. Keep in mind that this will lead to clipboard issues and tdesktop will be unable to get settings from GTK (such as decoration layout, dark mode & more).
No protocol specified
qt.qpa.xcb: could not connect to display :99.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Launching with QT_DEBUG_PLUGINS=1:

$ QT_DEBUG_PLUGINS=1 /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=telegram-desktop --file-forwarding org.telegram.desktop

(process:2): Telegram-WARNING **: 16:46:15.814: Unfortunately, GTK integration conflicts with qgtk2 platformtheme and style. Therefore, QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE will be unset.
Telegram-Message: 16:46:15.815: This can be ignored by setting TDESKTOP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY environment variable to any value, however, if qgtk2 theme or style is used, this will lead to a crash.
Telegram-Message: 16:46:15.815: GTK integration can be disabled by setting TDESKTOP_DISABLE_GTK_INTEGRATION to any value. Keep in mind that this will lead to clipboard issues and tdesktop will be unable to get settings from GTK (such as decoration layout, dark mode & more).
QFactoryLoader::QFactoryLoader() checking directory path "/usr/share/runtime/lib/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqeglfs.so"
Found metadata in lib /usr/lib/plugins/platforms/libqeglfs.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "eglfs"
        ]
    },
    "archreq": 0,
    "className": "QEglFSIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimal.so"
Found metadata in lib /usr/lib/plugins/platforms/libqminimal.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "archreq": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimalegl.so"
Found metadata in lib /usr/lib/plugins/platforms/libqminimalegl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimalegl"
        ]
    },
    "archreq": 0,
    "className": "QMinimalEglIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("minimalegl")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqoffscreen.so"
Found metadata in lib /usr/lib/plugins/platforms/libqoffscreen.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "archreq": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqvnc.so"
Found metadata in lib /usr/lib/plugins/platforms/libqvnc.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "vnc"
        ]
    },
    "archreq": 0,
    "className": "QVncIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("vnc")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqwayland-egl.so"
Found metadata in lib /usr/lib/plugins/platforms/libqwayland-egl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland-egl"
        ]
    },
    "archreq": 0,
    "className": "QWaylandEglPlatformIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("wayland-egl")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqwayland-generic.so"
Found metadata in lib /usr/lib/plugins/platforms/libqwayland-generic.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland"
        ]
    },
    "archreq": 0,
    "className": "QWaylandIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("wayland")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqwayland-xcomposite-egl.so"
Found metadata in lib /usr/lib/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland-xcomposite-egl"
        ]
    },
    "archreq": 0,
    "className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("wayland-xcomposite-egl")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqwayland-xcomposite-glx.so"
Found metadata in lib /usr/lib/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland-xcomposite-glx"
        ]
    },
    "archreq": 0,
    "className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("wayland-xcomposite-glx")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqxcb.so"
Found metadata in lib /usr/lib/plugins/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/app/bin/platforms" ...
loaded library "/usr/lib/plugins/platforms/libqxcb.so"
No protocol specified
qt.qpa.xcb: could not connect to display :99.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
SchnWalter commented 3 years ago

I've had the same issue on a freshly installed OS. The error went away after I've renamed the hostname in yast from ws.local to ws and restarted the OS.

Before the change:

$ hostname
ws.local

$ echo $XAUTHLOCALHOSTNAME
ws

$ inxi -SG
System:    Host: ws.local Kernel: 5.3.18-lp152.57-default x86_64 bits: 64 Desktop: KDE Plasma 5.18.6
           Distro: openSUSE Leap 15.2
Graphics:  Device-1: Intel Xeon E3-1200 v2/3rd Gen Core processor Graphics driver: i915 v: kernel 
           Display: x11 server: X.Org 1.20.3 driver: modesetting unloaded: fbdev,vesa resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa DRI Intel Ivybridge Desktop v: 4.2 Mesa 19.3.4

$ flatpak run -v org.mozilla.firefox
F: No installations directory in /etc/flatpak/installations.d. Skipping
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/theuser/.local/share/flatpak
F: Opening user flatpak installation at path /home/theuser/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/theuser/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Cleaning up unused container id 2051451656
F: Allocated instance id 611432905
F: Add defaults in dir /org/mozilla/firefox/
F: Add locks in dir /org/mozilla/firefox/
F: Allowing x11 access
F: Allowing pulseaudio access
F: Pulseaudio user configuration file '/home/theuser/.config/pulse/client.conf': Error opening file /home/theuser/.config/pulse/client.conf: No such file or directory
F: Running 'bwrap --args 33 /usr/bin/xdg-dbus-proxy --args=35'
F: Running 'bwrap --args 33 firefox'
Gtk-Message: 07:22:59.072: Failed to load module "unity-gtk-module"
Gtk-Message: 07:22:59.072: Failed to load module "canberra-gtk-module"
No protocol specified
Error: cannot open display: :99.0

Depending on the application that you run (firefox vs telegram vs spotify), it will report this error or the error from #3357 and I found this other issue that might also be related: #1821

L.E.2 It seems that yast lan doesn't properly update the environment when the hostname is changed. Neither does hostnamectl; you most probably need a restart.

smcv commented 3 years ago

From https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/issues/53 (reported as a bug in a tool that recycles Flatpak's Xauth setup code), it seems that openSUSE has a patch with the following behaviour:

This probably means that Flatpak's xauth_entry_should_propagate() needs to either look at XAUTHLOCALHOSTNAME and use that (if set) as the hostname; or additionally propagate entries whose hostname is the part of the struct utsname.nodename up to and not including the first dot; or both.

Desktop environments or OSs could fix this by doing the equivalent of xhost "+si:localuser:$(id -nu)", which tells Xorg to use SO_PEERCRED-based authentication and accept all connections from the uid that owns this X server, during Xorg startup. GNOME's gdm does that, but apparently KDE Plasma does not.

DaAwesomeP commented 3 years ago

Hi all, Sorry to dig up a closed issue, but I want to confirm if what I am seeing is the same issue or a new one. Still on OpenSUSE Leap 15.2

$ flatpak run org.telegram.desktop 

(telegram-desktop:2): lib_base-WARNING **: 22:35:49.745: Unfortunately, GTK integration conflicts with qgtk2 platformtheme and style. Therefore, QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE will be unset.
lib_base-Message: 22:35:49.747: This can be ignored by setting DESKTOP_APP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY environment variable to any value, however, if qgtk2 theme or style is used, this will lead to a crash.
lib_base-Message: 22:35:49.747: GTK integration can be disabled by setting DESKTOP_APP_DISABLE_GTK_INTEGRATION to any value. Keep in mind that this will lead to some features being unavailable.
Gtk-Message: 22:35:49.795: Failed to load module "unity-gtk-module"
Gtk-Message: 22:35:49.795: Failed to load module "canberra-gtk-module"
Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :99.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
$ flatpak --version
Flatpak 1.10.2

I did try reinstalling the app to no avail. When I reinstalled it performed the following:

 1. [✓] org.freedesktop.Platform.GL.default             20.08             u            flathub           46.7 MB / 98.3 MB
 2. [✓] org.freedesktop.Platform.Locale                 20.08             i            flathub           17.7 kB / 322.2 MB
 3. [✓] org.freedesktop.Platform.VAAPI.Intel            20.08             u            flathub            9.7 MB / 11.6 MB
 4. [✓] org.freedesktop.Platform.ffmpeg-full            20.08             u            flathub            4.1 MB / 4.1 MB
 5. [✓] org.freedesktop.Platform                        20.08             i            flathub           96.2 MB / 267.0 MB
 6. [✓] org.telegram.desktop.Locale                     stable            i            flathub            4.9 kB / 572.1 kB
 7. [✓] org.telegram.desktop                            stable            i            flathub           77.3 MB / 79.0 MB
smcv commented 3 years ago

You are getting a new, different message Invalid MIT-MAGIC-COOKIE-1 key.

Mart-Bogdan commented 11 months ago

I had this error, and reboot helped me.

Occurred after I did many logouts in short sequence. (was testing different DEs)

pizdjuk commented 9 months ago

I have exactly the same error on Linux Mint 20 with MATE