libcanberra-gtk0 should recommend Gtk2 and Gtk3 module to fix: Gtk-Message: Failed to load module "canberra-gtk-module"

Bug #872172 reported by Daniel Hahler
42
This bug affects 10 people
Affects Status Importance Assigned to Milestone
libcanberra (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Trying to run any Gtk 3 application in Oneiric, I am getting the following message/error:
  % ubuntu-bug
  Gtk-Message: Failed to load module "canberra-gtk-module"

libcanberra-gtk-module only ships this file:
  /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so

When setting the GTK_PATH explicitly, it fails to load like this:
  % export GTK_PATH=:/usr/lib/gtk-2.0
  % ubuntu-bug

  (apport-gtk:12816): Gtk-WARNING **: GTK+ module /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so cannot be loaded.
  GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.
  Gtk-Message: Failed to load module "canberra-gtk-module"

The fix/workaround appears to be installing libcanberra-gtk3-module, or removing libcanberra-gtk-module, which is only being installed as a recommendation for transmission-gtk (in this case):

  % aptitude why libcanberra-gtk-module
  i libcanberra-gtk0 Recommends libcanberra-gtk-module
  % aptitude search '?depends(libcanberra-gtk0)' | awk '{print $2}'
  balsa
  gnome-panel
  gnome-session-canberra
  gnubg
  gok
  libbrasero-media1
  libcanberra-gtk-dev
  libcanberra-gtk-module
  libcanberra-gtk0-dbg
  libcheese-gtk18
  metacity
  transmission-gtk
  wallch
  xchat-gnome

I think that libcanberra-gtk0 should not only recommend the Gtk 2 module, but also the Gtk 3 one.
So the "Recommends: libcanberra-gtk-module" should become "Recommends: libcanberra-gtk-module, libcanberra-gtk3-module".

WORKAROUND:
  1. sudo apt-get install libcanberra-gtk3-module
  or
  2. sudo apt-get purge libcanberra-gtk-module

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: libcanberra-gtk-module 0.28-0ubuntu10
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic-pae 3.0.4
Uname: Linux 3.0.0-12-generic-pae i686
ApportVersion: 1.23-0ubuntu3
Architecture: i386
Date: Tue Oct 11 10:12:05 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
ProcEnviron:
 LC_TIME=de_DE.UTF-8
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/usr/bin/zsh
SourcePackage: libcanberra
UpgradeStatus: Upgraded to oneiric on 2011-09-29 (11 days ago)

Revision history for this message
Daniel Hahler (blueyed) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libcanberra (Ubuntu):
status: New → Confirmed
Revision history for this message
Migrus (migrus123) wrote :

I had the reverse, only the gtk3 version was installed and firefox was complaining when started from an xterm.
Using your description in reverse, 'apt-get install libcanberra-gtk0' made that error go away.

Revision history for this message
RickKnight (rick-knight) wrote :

I had the same problem running GTK apps. I tried removing libcanberra but that didn't solve the problem for me. I read the post here from Migrus and tried his solution, installing libcanberra-gtk0. It worked. No more libcanberra errors.

Revision history for this message
atimonin (atimonin) wrote :

apt-get remove libcanberra-gtk0 solves the problem for me

Revision history for this message
Daniel Hahler (blueyed) wrote :

This is not an error (anymore) for me (reporter), on a fresh install of Ubuntu Precise.

Changed in libcanberra (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Low
Revision history for this message
Martijn Lievaart (j-launchpad-net-rtij-nl) wrote :

apt-get install libcanberra-gtk0 solves the problem for me. Weird, others solved it by removing this package?

Revision history for this message
Bagus Tris (bagustris) wrote :

apt-get install libcanberra-gtk-model works for me.

Revision history for this message
Viktor Mileikovskyi (v-mil) wrote :

This problem may appear in amd64 system trying to use i386 program.
For me the problem solution is:

sudo apt-get install libcanberra-gtk-module:i386 libcanberra-gtk0:i386

If it does not work try reinstalling libcanberra-gtk0 AT YOUR OWN RISK. The uninstallation causes removing of possibly very important packets for You. Please analyze a packet list at step 2. If any problems after step 3 (power loss or bug) POSSIBLE YOU WILL HAVE A SYSTEM WITHOUT A DESKTOP.

1. Run but don't confirm at prompt [Y/N]
sudo apt-get remove libcanberra-gtk0

2. Carefully analyze apt-get answer and find a list of packets to be removed. The lines maybe different from computer to computer. For example:

Packets to be REMOVED:
  gnome-session-canberra gnome-session-fallback libcanberra-gtk-module
  libcanberra-gtk0 metacity ubuntu-desktop

If You will not restore these packets possibly You will have great problems.

3. Copy this packet list to Your favorite text editor

4. Answer "Y"

5. Run the command after replacing <list> with saved list (with spaces between elements) of removed packets at step 3:

sudo apt-get install <list> libcanberra-gtk0

For previous example

sudo apt-get install gnome-session-canberra gnome-session-fallback libcanberra-gtk-module
  libcanberra-gtk0 metacity ubuntu-desktop libcanberra-gtk0

Revision history for this message
Thor-Henrik Kvandahl (kvandahl) wrote :

apt-get install libcanberra-gtk* did not work for me.
Upgrade to 22.04 LTS did not work for me either.

My workaround was to remove Firefox snap completely and install install Firefox using apt as described below:

sudo snap remove firefox
cd ~/snap
rm -r firefox

sudo gedit /etc/apt/preferences.d/firefox-no-snap
add lines below:
Package: firefox*
Pin: release o=Ubuntu*
Pin-Priority: -1

sudo apt purge firefox
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt-get update
sudo apt install firefox

echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

Sources:
https://www.debugpoint.com/2021/09/remove-firefox-snap-ubuntu/
https://ubuntuhandbook.org/index.php/2022/03/install-firefox-esr-ubuntu/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.