Switching to Firefox’s Deb Installation on Ubuntu 22.04+: A Guide to Avoiding Snap Packages

Ubuntu’s distributions, starting from version 22.04, have started packaging Firefox as a Snap package. Snap packages are Ubuntu-specific, containerized software packages that include dependencies needed for the software to run. However, due to personal preference or issues regarding their functionality, some users may prefer to install Firefox as a traditional Deb package.

In this tutorial you will learn:

  • Ubuntu’s shift to packaging Firefox as a Snap from version 22.04 onwards.
  • The advantages and structure of Snap packages in Ubuntu.
  • Step-by-step instructions for installing Firefox as a traditional Deb package using Apt or PPA.
  • Precautions to take to avoid losing bookmarks when switching from Snap to APT version of Firefox.
Instructions for installing Firefox as a traditional Deb package using Apt or PPA
Instructions for installing Firefox as a traditional Deb package using Apt or PPA
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 22.04 or higher
Software Mozilla Firefox Browser
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

This article provides step-by-step instructions on how to install Firefox as a Debian (deb) package using an Apt repository or Personal Package Archive (PPA) instead of the Snap package.

Important Caution
Before proceeding, it’s important to note that if you switch from the Snap to the APT version of Firefox, you might lose your bookmarks unless they’re synced with your Firefox account.
  1. Add Firefox’s PPA to Your SystemThe first step is to add Mozilla’s Firefox PPA to your system. This is the personal archive where the Firefox Debian files are stored. You can add this archive to your system by using the following command:
    sudo add-apt-repository ppa:mozillateam/ppa
  2. Prioritize the Apt Version of Firefox Over the Snap VersionAfter adding the PPA to your system, you must set the priority to favor the apt Firefox version instead of the Snap one. You can achieve this by using the following commands:
    echo '
    Package: *
    Pin: release o=LP-PPA-mozillateam
    Pin-Priority: 1001
    
    Package: firefox
    Pin: version 1:1snap1-0ubuntu2
    Pin-Priority: -1
    ' | sudo tee /etc/apt/preferences.d/mozilla-firefox
    

    In case you want to understand what this multi-liner code does, it creates a file under the /etc/apt/preferences.d/ directory with a configuration that prioritizes the Firefox version in the LP-PPA-mozillateam repository over the Snap version.

  3. Remove the Snap VersionTo remove the Snap version of Firefox use the following command:
    sudo snap remove firefox

    In case you encounter an error during the removal, you may have to disable the hunspell service, which is used by the Firefox Snap package, and then try removing Firefox snap once again. The required commands are:

    sudo systemctl stop var-snap-firefox-common-host\x2dhunspell.mount
    sudo systemctl disable var-snap-firefox-common-host\x2dhunspell.mount
  4. Install Firefox using AptYou can install the Apt version of Firefox using the command:
    sudo apt install firefox

    Once you finish the installation check your Ferefox version:

  5. Avoid Automatic Re-installation of the Snap VersionTo ensure that unattended upgrades do not reinstall the Snap version of Firefox, include the following command:
    echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

    This command disables automatic Firefox updates from the Snap repository.

Revert back to the Snap installation of Firefox, follow the steps below:

  1. Remove the Firefox PPA
    sudo add-apt-repository -r ppa:mozillateam/ppa
  2. Remove the apt pinning:
    sudo rm -rf /etc/apt/preferences.d/mozilla-firefox
  3. Remove the apt version of Firefox and reinstall the Snap version:
    sudo apt remove firefox && sudo snap install firefox

Conclusion

Although Ubuntu is increasingly moving towards Snap packages, you can still install traditional Debian packages using Apt or PPA repositories. By following the above steps, you can install Firefox as a traditional Deb package on Ubuntu 22.04 or later versions. Whether you choose to use Snap or Deb packages will ultimately depend on your personal preference and specific requirements.



Comments and Discussions
Linux Forum