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.
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.