Bug 1031501 - system:snappy/snapd: Snaps can't access X11 screen on KDE Tumbleweed
system:snappy/snapd: Snaps can't access X11 screen on KDE Tumbleweed
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE.org
Classification: openSUSE
Component: 3rd party software
unspecified
Other Other
: P5 - None : Major (vote)
: ---
Assigned To: Simon Fels
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-29 13:27 UTC by Linus Kardell
Modified: 2017-06-07 12:43 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Linus Kardell 2017-03-29 13:27:52 UTC
When trying to launch a graphical snap it fails to access the X11 screen and thus fails to launch. For example:

    > keepassxc 
    No protocol specified
    QXcbConnection: Could not connect to display :0
    Avbruten (SIGABRT)

    > dwarf-fortress 
    Gtk-Message: Failed to load module "canberra-gtk-module"
    No protocol specified
    Display not found and PRINT_MODE not set to TEXT, aborting.

This is on openSUSE Tumbleweed with KDE Plasma 5.9.2

snap interfaces give this: https://pastebin.com/vqLxV0zd
Comment 1 Simon Fels 2017-03-29 14:59:07 UTC
I can reproduce this also on 42.2 with latest snapd packages from http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_42.2/

simon@linux-82h5:~> keepassxc 
No protocol specified
QXcbConnection: Could not connect to display :0
Aborted

Looking into possible reasons for this.
Comment 2 Simon Fels 2017-03-29 15:59:41 UTC
I took one more step and installed Gnome Shell in my 42.2 virtualbox and there those applications work as they should. Wondering if there is something different in the gtk/qt libs we ship in Ubuntu KDE can't deal with. Those get included by default on those snaps.
Comment 3 Simon Fels 2017-03-30 07:43:07 UTC
Ok, I've found the reason or the not starting application. 

$ snap run --shell krita
krita$ export XAUTHORITY=/home/$USER/.Xauthority
krita$ $SNAP/command-krita.wrapper
..

With this krita starts up fine. So the reason is that the XAUTHORITY environment variable is not setup properly.
Comment 4 Simon Fels 2017-03-30 08:24:29 UTC
After some more research the real problem comes down to XAUTHORITY being set to /tmp/xauth-1000-_0 which can't be passed into the snap environment as each snap gets its private /tmp. The environment variable is correctly set in the snap environment but no application can access the referenced xauth file as it is not available.


This needs a change in snap-confine to correctly pass the current xauth file into the snap environment. Filed an upstream bug for this at https://bugs.launchpad.net/snapd/+bug/1677513
Comment 5 Simon Fels 2017-04-26 07:54:55 UTC
A fix for this was merged upstream. See https://github.com/snapcore/snapd/pull/3177 for more details. Will be released with 2.25
Comment 6 Linus Kardell 2017-05-29 11:38:40 UTC
I'm still getting this issue with 2.25 on Tumbleweed.
Comment 7 Simon Fels 2017-06-07 12:43:29 UTC
Resolved in the latest 2.25 packages for snapd.