problem with running apps from snap

Hey everyone,
i’m new to suse and i using openSuse Leap 15.03
my problem is i can’t running any software installed using snap

for example i wanna run the Okular from snap but i get this error :

$ snap run okular
qt.qpa.xcb: could not connect to display :1.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, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.


Aborted (core dumped)


again for Postman :


$ snap run postman 
The disableGPU setting is set to undefined
Not disabling GPU
The futex facility returned an unexpected error code.Aborted (core dumped)


can anyone help me how to fix this problem?

thanks a lot

Hello, seeing you are new here, welcome to the openSUSE forums.

Maybe you camn describe more in detail what you are doing. E.g. most people would start Ocular simply from the main menu of their desktop (it is a GUI program after all). so why are you tryng to run ocular using snap, it is normally installed at system installation. Or are you just using it as an example?

In your case it is not even clear if you are running a desktop and when yes, you did not specify which one.

As the message says, the program (probably ocular) can not find, or has no permission to use, a graphical display (display 1:0).

P.S. the name of this distribution is openSUSE (not openSuse) and the version is Leap 15.3 (not 15.03). You can see the proper spellings all over the the web-sites. And mind that precision is crucial in computer handling and thus misspelling can be a sign of sloppy working with computers also :wink:

the Okular was added to my application menu but when I was trying to open it, nothing happened so I’m running using CLI to see what is the problem
and it’s for just an example to show my problem with snap(actually my main problem is I can’t run any software installed using the snap store not only Okular that was an example , with GUI or even with CLI ), any software I installed using snap was added to my application menu but I can’t run them and you can see my output while I’m trying to run using CLI interface

I’m using Xfce desktop and if any commands need to be run for more information tell me to run them

 
output of snap version command 

$ snap --version 
snap           2.54.4-lp152.1.1
snapd          2.54.4-lp152.1.1
series         16
opensuse-leap  15.3
kernel         5.3.18-150300.59.54-default

this is another output of telegram-desktop when i want run using snap:


$ snap run telegram-desktop
No protocol specified
qt.qpa.xcb: could not connect to display :0.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, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.


Aborted (core dumped)

Why are you using snapd from Leap 15.2 on Leap 15.3?

oh you right IDK why i install the wrong version but now i upgrade it to 15.3 but the problem still exist, after upgrade should i do anything else? i used this link for upgrade to correct version

$snap --version
snap           2.54.4-lp153.1.1
snapd          2.54.4-lp153.1.1
series         16
opensuse-leap  15.3
kernel         5.3.18-150300.59.54-default



i tested an CLI program like **links **it’s running without any problem, but GUI program like VLC, telegram-desktop, Okular and … still have that problem

Are you starting those programs from within a terminal emulator that is running within the Xfce desktop?

i tested both, when I trying to open from Xfce desktop applications and I click over the app icon nothing happened!

any icon in application menu run a command under the hood so when i click over telegram-desktop icon it’s run this command:


env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/telegram-desktop_telegram-desktop.desktop /snap/bin/telegram-desktop -- %u 

and if i run this manually in terminal it’s should not have different and the result should be same i think (i run this command again and get the previous error message)

I randomly copy a few command from other forums and my problem solved !!! but IDK how :frowning:

I run all of this command and IDK which one fixed my problem :sarcastic:


$ xhost +si:localuser:root
$ xhost +SI:localuser:root
$ xhost +local:
$ xhost + 
$ xhost +localhost &
$ xhost +localhost


the reference of those command : link

As I said, there is no access to the display 1:0. You now granted access. But that should not be needed if you start it from within the current Xfce session (using a terminal emulator that run also inside that session.

And running all of them is a bit overdone. I hope you are aware that you now allow all in the world to open windows on your session.

i created a file in **/etc/profile.local **to add access for xhost after reboot

add this 2 line in that file:


xhost +si:localuser:root
xhost +local:

and now after reboot everything work fine.

thanks to everyone’s responses on this thread :kiss:

I cannot reproduce it. I installed snapd from [noparse]system:snappy[/noparse], started snapd and snapd.apparmor services, installed okular snap (snap install okular). After that “snap run okular” starts Okular window. I use lightdm with automatic logon and display number is [noparse]:0.0[/noparse], not [noparse]:1.0[/noparse] as in your case.

If you are interested in finding root cause, some random shots. Post full protocol of

loginctl
snap info okular
env | grep -E 'DISPLAY|XAUTHORITY'
snap run --shell okular
env | grep -E 'DISPLAY|XAUTHORITY'

this is the output of those commands:



$ loginctl 
SESSION  UID USER    SEAT  TTY
      2 1000 mohamad seat0    


1 sessions listed.




$ snap info okular

name:      okular
summary:   Document Viewer
publisher: KDE✓
store-url: https://snapcraft.io/okular
contact:   https://bugs.kde.org/enter_bug.cgi?product=neon&component=Snaps
license:   unset
description: |
  Okular is a universal document viewer developed by KDE. Okular works on
  multiple platforms, including but not limited to Linux, Windows, Mac OS X,
  \*BSD, etc.
  
  Features:
  
  - Supported Formats: PDF, PS, Tiff, CHM, DjVu, Images, DVI, XPS, ODT,
  Fiction Book, Comic Book, Plucker, EPub, Fax
  - Sidebar with contents, thumbnails, reviews and bookmarks
  - Annotations support
commands:
  - okular
snap-id:      SfUqQ280Y4bJ0k64qtBKTTXq5ml46tvQ
tracking:     latest/stable
refresh-date: today at 16:33 +0330
channels:
  latest/stable:    20.12.3        2021-03-18 (109) 157MB -
  latest/candidate: 20.12.3        2021-03-22 (110) 157MB -
  latest/beta:      ↑                                     
  latest/edge:      master+05338b0 2020-05-06  (99)  18MB -
installed:          20.12.3                   (109) 157MB -




$ env | grep -E 'DISPLAY|XAUTHORITY'

DISPLAY=:0.0
XAUTHORITY=/home/mohamad/.Xauthority



$ snap run --shell okular
bash: /etc/profile.d/ls.bash: Permission denied
bash: /etc/profile.d/alias.bash: Permission denied
bash: /etc/profile.d/bash_completion.sh: Permission denied
bash: /etc/bash_command_not_found: Permission denied
bash: /etc/profile.d/vte.sh: Permission denied



$ env | grep -E 'DISPLAY|XAUTHORITY'

XAUTHORITY=/home/mohamad/.Xauthority
DISPLAY=:0.0


$ sudo lightdm --version
lightdm 1.30.0

$ X -version


X.Org X Server 1.20.3
X Protocol Version 11, Revision 0
Build Operating System: openSUSE SUSE LINUX
Current Operating System: Linux . 5.3.18-150300.59.54-default #1 SMP Sat Mar 5 10:00:50 UTC 2022 (1d0fa95) x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-5.3.18-150300.59.54-default root=UUID=ce8ccd0a-1455-44d9-861c-368245d9d85f splash=silent mitigations=auto quiet
Build Date: 14 December 2021  12:00:00PM
 
Current version of pixman: 0.34.0
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.









Everything looks pretty much OK. What happens if you now do

xhost -
snap run okular

I comment these command on **/etc/profile.local **

#xhost +si:localuser:root
#xhost +local:

and reboot my PC then run your commands:



$ xhost -
access control enabled, only authorized clients can connect


$ snap run okular
No protocol specified
qt.qpa.xcb: could not connect to display :0.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, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.


Aborted (core dumped)



but if again i remove the comment of those command on **/etc/profile.local file and again reboot my PC, it’s will work fine and after running snap run okular **it show me the Okular window

At least it is now trying to use display 0:0, which is “normal”.

What is full output of

systemctl status snapd\*

this is full output of that command:


$ systemctl status snapd\*
● snapd.apparmor.service - Load AppArmor profiles managed internally by snapd
     Loaded: loaded (/usr/lib/systemd/system/snapd.apparmor.service; enabled; vendor preset: disabled)
     Active: active (exited) since Sat 2022-03-12 19:46:11 +0330; 1h 5min ago
    Process: 911 ExecStart=/usr/lib/snapd/snapd-apparmor start (code=exited, status=0/SUCCESS)
   Main PID: 911 (code=exited, status=0/SUCCESS)


● snapd.service - Snap Daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-03-12 19:46:25 +0330; 1h 5min ago
TriggeredBy: ● snapd.socket
   Main PID: 982 (snapd)
      Tasks: 8 (limit: 4915)
     CGroup: /system.slice/snapd.service
             └─982 /usr/lib/snapd/snapd


● snapd.socket - Socket activation for snappy daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.socket; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-03-12 19:46:11 +0330; 1h 5min ago
   Triggers: ● snapd.service
     Listen: /run/snapd.socket (Stream)
             /run/snapd-snap.socket (Stream)
      Tasks: 0 (limit: 4915)
     CGroup: /system.slice/snapd.socket



Everything running as expected

The only way I can reproduce it is to point XAUTHORITY to the wrong file. Could you please do


snap run --shell okular
env | grep -E 'DISPLAY|XAUTHORITY'
cp /home/mohamad/.Xauthority /home/mohamad/.Xauthority.snap
exit
xauth -inf /home/mohamad/.Xauthority list
xauth -inf /home/mohamad/.Xauthority.snap list
hostnamectl

If value of XAUTHORITY is something else, replace /home/mohamad/.Xauthority with the corresponding value of $XAUTHORITY.

the copy command says my **Permission denied **(even with sudo)



**mohamad@:~> snap run --shell okular 
**bash: /etc/profile.d/ls.bash: Permission denied
bash: /etc/profile.d/alias.bash: Permission denied
bash: /etc/profile.d/bash_completion.sh: Permission denied
bash: /etc/bash_command_not_found: Permission denied
bash: /etc/profile.d/vte.sh: Permission denied

**mohamad@:/home/mohamad> env | grep -E 'DISPLAY|XAUTHORITY'**
XAUTHORITY=/home/mohamad/.Xauthority
DISPLAY=:0.0


**mohamad@:/home/mohamad> cp /home/mohamad/.Xauthority /home/mohamad/.Xauthority.snap**
cp: cannot create regular file '/home/mohamad/.Xauthority.snap': Permission denied


**mohamad@:/home/mohamad> sudo cp /home/mohamad/.Xauthority /home/mohamad/.Xauthority.snap**
bash: /usr/bin/sudo: Permission denied

**mohamad@:/home/mohamad> exit 
****exit**



**mohamad@:~> xauth -inf /home/mohamad/.Xauthority list
**
./unix:0  MIT-MAGIC-COOKIE-1  7e0d017eb149cae2b958cd0cd4521ec9
localhost/unix:0  MIT-MAGIC-COOKIE-1  f82a779a8cf99b3ec0c051b359b0795b



**mohamad@:~>  xauth -inf /home/mohamad/.Xauthority.snap list**
./unix:0  MIT-MAGIC-COOKIE-1  7e0d017eb149cae2b958cd0cd4521ec9
localhost/unix:0  MIT-MAGIC-COOKIE-1  f82a779a8cf99b3ec0c051b359b0795b

**mohamad@:~> hostnamectl**
   Static hostname: n/a
Transient hostname: .
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: 1d4284ae41ec47a693a5c13b443c1f8a
           Boot ID: 61cda516d98b49a2b1cbeeb833f3d934
  Operating System: openSUSE Leap 15.3
       CPE OS Name: cpe:/o:opensuse:leap:15.3
            Kernel: Linux 5.3.18-150300.59.54-default
      Architecture: x86-64




mohamad@:/home/mohamad> cp /home/mohamad/.Xauthority /home/mohamad/.Xauthority.snap
cp: cannot create regular file ‘/home/mohamad/.Xauthority.snap’: Permission denied

Post as User executed:

ls -al ~/
ls -al ~/.Xauthority