GTK, an abbreviation for GNOME Toolkit, is an open-source and feature-rich development toolkit used for creating GUI applications. It’s free and open-source and offers a rich set of UI tools for creating stunning and immersive desktop applications and UI elements for desktop environments and window managers. With GTK, you can develop standalone desktop apps to complete application suites.
If you have been running Linux for a while, you might have bumped into the “failed to load module canberra-gtk-module” error on the terminal. This occurs on Linux desktops and, as you can infer, is caused by a missing GTK module known as the canberra-gtk-module.
So, what is this module and how can the error be fixed? Let’s find out.
What Is Canberra-gtk-module?
The canberra-gtk-module is a GTK module that is part of the Libcanberra library, which is an implementation of the XDG Sound Theme and is responsible for playing event sounds.
Ever noticed a conspicuous sound produced when you plug on and unplug a power cable on your system? Or when you connect a flash drive? Or when a program pop-up appears on the screen? This is the functionality that libcanberra provides. It enables short and crisp sounds in response to a system event. The Canberra GTK module integrates sound alerts with UI events such as button clicks, pop-ups, etc.
These system sounds are essential in providing feedback on what’s happening to your system. For example, if the power cable is disconnected, the system sound alerts you to plug it back.
Failed to load module “canberra-gtk-module
The primary reason for the occurrence of this error is the missing canberra-gtk-module. The error can also be caused when a GTK-based app requires the module but cannot load it for some reason.
The error is typically encountered when launching a GTK-based GUI application from the terminal and the above reasons happen. Having seen what results in this error, let us now focus on how you can go about resolving it.
Fix “failed to load module canberra-gtk-module” Error
The solution to this error is to install all the missing Canberra GTK modules on your Linux system. To do this, you need to install the libcanberra-gtk-module package on your Linux system. Thankfully most modern distributions provide the package of their respective repositories.
Install Libcanberra Module in Linux
On Ubuntu or Debian systems, first, update the local package index.
$ sudo apt update
Then install the Libcanberra library which provides all the modules required.
$ sudo apt install libcanberra-gtk-module libcanberra-gtk3-module -y
On Red Hat systems such as Fedora, RHEL, and Rocky Linux, update the local DNF cache.
$ sudo dnf makecache
Then install the Libcanberra library as shown.
$ sudo dnf -y install libcanberra-gtk3
On Arch-based Linux distros, run the following command.
$ sudo pacman -Sy libcanberra
The above commands should resolve any issues with do with the error.
Conclusion
As you have seen, the cause of the “failed to load module canberra-gtk-module” error is the missing libcanberra-gtk-module modules which can easily be installed using your distribution’s package manager.
It no longer functions on Ubuntu versions 23.* or 24.04. libcanberra has been effectively deprecated on Wayland-based systems. Despite being installed by default, it now only leads to confusing and irrelevant errors.
@Keith,
Thank you for your comment. It’s true that libcanberra is deprecated on Wayland-based systems, which includes the newer versions of Ubuntu like 23.* and 24.04. As you mentioned, it can cause confusing and irrelevant errors.
To resolve these issues on Ubuntu 23.* and 24.04, you can try removing libcanberra if it’s causing problems:
Alternatively, if you still need the functionality provided by libcanberra, you can install the necessary packages to ensure compatibility:
However, if you’re using Wayland, it’s often best to rely on more up-to-date libraries and frameworks designed to work seamlessly with it.
Thanks again for bringing this to our attention!
I do not understand what you’re saying.
I have the packages you mentioned installed on Ubuntu 24, but I still see that error in the syslog:
What’s wrong?