(zenity:20204): cannot open display: :0

So, I’ve been receiving ever since I started using zenity in my app ( bash script ) after locally installing with snapcraft install --dangerous app-name.snap, apart from other commands this is the only one that raises this error and I’ve tried exporting the DISPLAY=:0 but it still does not help. I’m still not sure if this is a zenity error or a snapcraft app error, any help would be appreciated.


(process:21752): Gtk-WARNING **: 12:22:53.324: Locale not supported by C library.
	Using the fallback 'C' locale.
Unable to init server: Could not connect: Connection refused

(zenity:21752): Gtk-WARNING **: 12:22:53.327: cannot open display: :0

When writing software, a good huristic for finding problems is “it is something I did wrong”. In this case, it is probably your snap recipe that prevents X11 working.

indeed but I double checked everything and my script always seems to throw that error for zenity --notification --text "some text with $VARIABLES" comand. Perhaps, I should try using other notifying software like zenity.

It is still most likely you are missing something. What is the ouput of:

snap connections app-name | grep x11

It doesn’t output anything

Then your snap recipe is not plugging the x11 interface. Without that, X11 apps won’t work

How do I plugin the x11 interface?

You list x11 as a plug in your snapcraft.yaml

Alright I did that now I get the error I got before but something else along with it too,

(process:66504): Gtk-WARNING **: 16:16:32.747: Locale not supported by C library.
        Using the fallback 'C' locale.

(zenity:66504): dbind-WARNING **: 16:16:33.278: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-XBLgEYtofh: Permission denied

(zenity:66504): Gtk-WARNING **: 16:16:33.281: Failed to parse /etc/gtk-3.0/settings.ini: Permission denied
Gtk-Message: 16:16:33.661: Failed to load module "canberra-gtk-module"
Gtk-Message: 16:16:33.682: Failed to load module "canberra-gtk-module"
This option is not available. Please see --help for all possible usages.

to find what interfaces your snap needs you can do the following:

sudo snap install snappy-debug

then, while launching your app from a terminal, have the snappy-debug tool running in a second terminal …

in the snappy-debug terminal you will see suggestions about which plugs will help to solve the errors … (also note, not all plugs do auto-connect, some will need you t manually connect them with the snap connect ... command).


Hi, thanks for your suggestion but my doesn’t contain any kind of features which require me to connect plugs, all it does is send a simple notification but even after successfully building my app it doesn’t send the notification. If you wish to help me out here’s the github repo:

It does this by running a GTK application. These require more work to snap than a simple script. I don’t know if this is currently the best place to start, but there are some pointers here:

Can I not directly use that application by adding it in the stage-packages section?

for this you will definitely need to connect a plug (additionally to the x11 one) and snappy-debug will tell you which one …