How to replace the Firefox Snap with the DEB version on Ubuntu!

Ubuntu is one of the most popular Linux distribution of all time. When you say Linux in public, chances are high that people will reply Ubuntu to you (assuming they know about Linux at all). Recent developments in Ubuntu Linux, and the direction in which the distribution seems to be going, has been quite controversial.

Ubuntu is switching from the more traditional apt package manager, which is used by Debian (which serves as a base for Ubuntu) to a more ‘sandboxed’ Snap package manager. Now, sandboxing applications can be essential for privacy and security reasons, but there are several problems associated with the Snap package manager. The back-end of this package manager is not open-source, and the first time launch of the applications installed with this tool are slow.

Ubuntu has also replaced the default Firefox web browser from being the APT package to being a Snap package, which can be annoying for some people. Therefore, in this tutorial, we will try to remove the Snap version of Firefox and then install the DEB package on our Ubuntu system.

Removing Firefox Snap

To remove the Snap version of Firefox from Ubuntu, just open a Terminal window and type the following command:

sudo snap remove firefox

Yes, it’s that easy to uninstall snap, now let’s proceed to adding the Firefox repository and installing Firefox DEB.

Installing Firefox DEB from Mozilla’s repo

Once the snap package is removed, you have to add the APT keyring with this command:

sudo install -d -m 0755 /etc/apt/keyrings
Uninstalling Firefox Snap From Ubuntu
Uninstalling Firefox Snap From Ubuntu

Finally, import the Mozilla signing key from their website (make sure that wget is installed):

wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null

And then you can add the Mozilla signing key to the sources.list file with this command:

echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
Add Source From Mozilla To Your PC
Add Source From Mozilla To Your PC

Now, the thing is, even if you try to install Firefox using the APT package manager, Ubuntu will automatically switch to the Snap package manager and tries to install the Snap version. So to avoid that, you can set the DEB package to be the priority instead of the Snap package. You can do that by typing the following command in the Terminal:

echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000

Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1' | sudo tee /etc/apt/preferences.d/mozilla

Ubuntu also provides a ‘fake’ DEB package which links to the snap package, so we have to remove that as well. Run the following command in your Terminal window:

sudo apt update && sudo apt remove firefox
Uninstalling The 'fake' Firefox
Uninstalling The ‘fake’ Firefox

Finally, you can install Firefox using the following command:

sudo apt install firefox
Installing Firefox From Mozilla's Repository
Installing Firefox From Mozilla’s Repository

Finally, you can use the DEB version of Firefox on Ubuntu from the Application menu, make sure to pin it to the dock for quick access.

Wrapping Up

While replacing the DEB version of Firefox with the snap package is okay, forcefully installing the Snap application when you explicitly typed sudo apt install Firefox in the terminal should not be the case on Ubuntu. A Linux distribution should do exactly what is typed in the Terminal and if it does not do that, people should switch to a different distribution. Of course, the change is in the backend and the users who are not aware about this issue won’t probably care and continue using Ubuntu.

If you do not encounter any issue while using the Snap package, then you can continue using it as well, otherwise switch to either the LibreWolf browser or switch to any Ubuntu based distribution such as Linux Mint.