Canberra-gtk-module – it can sing you sweet sounds and de-stress your jagged up neurons, or even be a reason to destroy your whole night’s sleep. Yes you heard it right. It essentially is a library that plays event sounds on your system when you do stuff. but hopefully, errors based on it should not make you lose sleep. It is meant to be relaxing, anyway.
Canberra-gtk module is a revamped version of the libcanberra library available in linux, and is designed to play event sounds on your system specifically for the GTK+ widgets. It plays a sound whenever you press a button on the screen, or a notification pops up, etc. It will make you aware of what is happening on your screen, at least, that’s what it’s meant for along with the chill jibes it may give you (until it turns out to be a horrific tone, as witnessed on some old machines). If you happen to see the failed to load message, don’t freak out just yet. It’s probably way easier than you might think.
Oh and by the way, I’m assuming you’re using a Linux distribution. Otherwise, why would you even be reading this, right?
Causes for “Failed to load canberra-gtk-module” error
Canberra-gtk-module in 32 bit vs 64 bit architecture
First and foremost, the CPU architecture has a word for itself to speak. In many cases, it is apparent that applications libraries installed for the 64bit architecture will never be recognised by a 32bit one. What this means is that, let’s say, you have the canberra-gtk-module installed in your system, which is of the 64bit version. Now, you’ve just installed a GTK+ program which is a 32bit version program, on your 64bit machine.
In this scenario, when you try to run the program, it’ll throw you the error, despite having already installed the module. As mentioned already, the 32bit program will not recognise the 64bit canberra-gtk-module library. Try installing another 64bit version program and run it, to see it for yourself. Therefore, for this reason, you may need to have both versions of the module installed, and you’ll learn how to do that in the How to fix “failed to load canberra-gtk-module” section.
Different GTK Versions using canberra-gtk-module
Ahem. So this one’s a bit more complicated. Before you proceed, it’s best you learn a few things about what GTK actually is. It is basically a toolkit for making GUI programs. It provides pre-designed and pre-configured elements to be directly inserted on a program, for easier and faster implementation. Now the thing here is there are several versions of GTK, which people use in an unorganized manner. No. the people are not unorganized (well they are sometimes, but that’s not what I’m trying to say), but the version usage is.
Different people have different versions of the toolkit installed in their machines, based on the applications they use and the programs that require the specified gtk version. Problem arises when an old application does not support newer GTK versions like GTK3 or GTK4, and needs the older versions like GTK/GTK2 instead. This is because GTK3 and GTK4 have removed a lot of features and widgets that were available in the older versions, and so have the APIs. On the other side of the spectrum, there are users who have GTK3/GTK4 installed in their machines, and then require to install an application that requires GTK/GTK2, they will need to have all the different versions installed in their system. There are old applications that can still be used under GTK4, as it has good backward compatibility, but many programs simply don’t run.
All of the above contributes to our main problem here, which is the canberra-gtk-module. Just like there are different versions of gtk, there are many different versions of the module as well. If you are using Ubuntu/Debian, try running the following command in your terminal to see the blitz:
$ apt search libcanberra-gtk*
How beautiful is that? Even if you may have one version of the module installed, it might still not be recognised by a given application, due to this version mismatch massacre.
How to fix “failed to load canberra-gtk-module”
Install the module
In spite of the two causes mentioned above, there’s one very common reason for getting the error. It is not having the module installed at all in your system. Sounds rough? It does, so install it already before it’s too late!
Linux distributions have a horde of package managers. The command to install the canberra-gtk-module will differ from distro to distro. Some of them are listed below:
$ sudo pacman -Syu libcanberra
$ sudo apt-get update $ sudo apt-get -y install libcanberra-gtk3-module $ sudo apt-get -y install libcanberra-gtk0-module
$ sudo yum makecache $ sudo yum -y install libcanberra-gtk3 $ sudo yum -y install libcanberra-gtk2
$ sudo dnf makecache $ sudo dnf -y install libcanberra-gtk3 $ sudo dnf -y install libcanberra-gtk2
If you’ve noticed closely, you must have seen that other than in Arch Linux, I’ve included more than one version of the canberra-gtk-module in the rest. You may not need more than one version rightnow, but it’s best if you have both installed. There’s one thing to keep in mind however. Let’s say, you only have GTK3 installed in your system, and don’t have any applications that require GTK2 or below. In this case, you can omit the other version and only install the module by using the command that has “gtk3” mentioned explicitly. If you still prefer to install both versions just to be safe, you should note that the module will also install the older version of gtk along with itself, which will take up a lot of storage space on your disk, unnecessarily.
Besides the casual installation, you might also be facing that CPU architecture problem. This problem is mostly apparent in Ubuntu and Debian, while other distros don’t really seem to pose it whatsoever. You may wish to search for the 32bit version of the package in your package manager, if it has one. For now, to install the 32bit version of canberra-gtk-module in Ubuntu and or Debian, you’d use the following command:
sudo apt-get install libcanberra-gtk-module:i386
All of the above should hopefully solve the problem for most users. If it still does not, please refer to the section that follow.
Create links to the module
I’m not particularly very sure about this one, but a few users have reported that this method works for them. If solely installing the module does not help, you might find luck by symlinking to the path of the module’s installation folder. Do this by using the following command:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so /usr/lib/libcanberra-gtk-module.so
The above works if the version of the canberra-gtk-module is for GTK2 and below. Note that this will not work for GTK3. You’ll need to use the following command for that instead:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcanberra-gtk3-module.so /usr/lib/libcanberra-gtk-module.so
The above command will work in case you’re trying to use the gtk3 version of canberra-gtk-module in a program that requires the gtk2 version of it. This is basically a way to surpass having to install all the different versions of canberra-gtk-module. If this still does not work, however, yous should find luck using this command to the very least:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcanberra-gtk3-module.so /usr/lib/libcanberra-gtk3-module.so
Set path variable for GTK
In some cases, your installation of GTK itself might not be loaded by the system’s PATH variable. If you’re in Ubuntu, you can use the following command to set a variable for GTK that’ll help your system recognise it’s directory:
$ export GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-2.0
or if it is gtk3, use this command:
$ export GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-3.0
Phew! If the above commands have helped you, you don’t need to thank me. I know how frustrating it is when you’re unable to run important applications for the sake of a small dependency that plays event sounds. Like literally. Many people even simply turn their sounds off for better focus, like I do myself. I don’t even have sound drivers installed in my system, but I still require this dependency for my GTK applications to run. It might not sound like a big deal, but it actually is! And that’s how softwares works anyway. They first load all the libraries in the beginning of their execution, which is why even a simple dependency not being found during startup could essentially mean that you’ll not be able to run the program. Cheese.