Failed to load module "canberra-gtk-module"

I am trying to build a snap containing just a simple PureBasic app that opens a WebViewGadget(). It does nothing apart from showing a website. I added the needed libs and the command to open the app.

I can run snapcraft and the snap builds without any problems. But when i install it and try to run snap-test, it opens an emtpy window and prints following errors to the console:

Gtk-Message: 11:57:37.998: Failed to load module "canberra-gtk-module"
Gtk-Message: 11:57:38.014: Failed to load module "canberra-gtk-module"
Gtk-Message: 11:57:39.193: Failed to load module "canberra-gtk-module"
Gtk-Message: 11:57:39.194: Failed to load module "canberra-gtk-module"
Could not create default EGL display: EGL_BAD_PARAMETER. Aborting...

I first thought it was a permission Problem. I already tried adding multiple plugs but none of them solved the problem so far. I had to manually redirect a path, that is why i am using layout and bind.

The following is my snap-test.yaml .

name: snap-test # you probably want to 'snapcraft register <name>'
base: core24 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Snapcraft test for example purebasic application with webview # 79 char long summary
description: |
  Simple PureBasic application that uses a WebViewGadget. Test to see if 
  we have the sae Problems as with flatpak.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

apps:
  snap-test:
    command: snap-test
    plugs:
      - browser-support
      - x11
      - wayland
      - alsa
      - audio-playback
      - audio-record
      - network
      - network-observe
      - opengl

layout:
  /usr/lib/x86_64-linux-gnu/webkit2gtk-4.1:
    bind: $SNAP/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1
parts:
  snap-test:
    source: .
    plugin: dump
    source-type: local
    stage-packages:
      - libx11-6
      - libcairo2
      - libgtk-3-0t64
      - libcanberra-gtk3-module
      - libjavascriptcoregtk-4.1-0
      - libwebkit2gtk-4.1-0
      - libegl1
      - libegl-mesa0

Does anyone have an Idea where to go from this or what typically causes this error ?

This is just a message, not an error, the Canberra module has been deprecated a long time ago, just ignore these lines, they are just noise…

The last line in your output is more interesting, it indicates that your app wants to use OpenGL but can not…

The easiest is to simply add the gnome extension to your apps: entry, it will take care for all this stuff (fonts, themes, gl support etc)

The extension gnome solved that problem as well as reducing my yaml file by quite a bit, thanks for that !

Now my app starts but the WebView does not display anything. Instead i get the following messages now:

touch: cannot touch '/home/user1/snap/snap-test/common/.cache/desktop-runtime-date': No such file or directory
libpxbackend-1.0.so: cannot open shared object file: No such file or directory
Failed to load module: /home/user1/snap/snap-test/common/.cache/gio-modules/libgiolibproxy.so

My yaml file currently looks like this :

name: snap-test # you probably want to 'snapcraft register <name>'
base: core24 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Snapcraft test for example purebasic application with webview # 79 char long summary
description: |
  Simple PureBasic application that uses a WebViewGadget. Test to see if 
  we have the sae Problems as with flatpak.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

apps:
  snap-test:
    command: snap-test
    plugs:
      - browser-support
    extensions:
      - gnome
      
parts:
  my-part:
    source: .
    plugin: dump
    source-type: local

I am running Ubuntu 24.04.1 btw.

Small update. If i run my installed snap with sudo it works just fine.

you want to add libproxy1v5 to your stage-packages in m̀y-part` …

Thank you!

I also needed to add the plug network-status and now everything is running fine.

1 Like

Do you need webkitgtk6?

No i am using libwebkit2gtk-4.1.

1 Like