Why Ubuntu Uses Firefox Snap and How to Switch to APT

This article explores the reasons behind Canonical and Mozilla's decision to transition Ubuntu's default Firefox web browser from a traditional Debian (.deb) package to a universal Snap package. Additionally, it provides a straightforward, step-by-step guide for users who prefer to remove the Snap version and install the native .deb package directly from Mozilla's official APT repository.

Why Ubuntu Switched Firefox to a Snap Package

Starting with Ubuntu 21.10 and continuing into Long Term Support (LTS) releases like 22.04 and 24.04, Firefox is installed as a Snap package by default. Even if you run sudo apt install firefox, Ubuntu uses a transitional package that installs the Snap version in the background. This decision was made in direct collaboration with Mozilla for several key reasons:

  • Faster Security Updates: Previously, when Mozilla released an update, Canonical engineers had to repackage it into .deb formats for every currently supported version of Ubuntu (e.g., 20.04, 22.04, 23.10) and test it against different system libraries. With Snap, Mozilla can push a single update directly to all Ubuntu users simultaneously the moment it is ready.
  • Consistent Runtime Environment: Because Snaps bundle their own dependencies, Firefox runs on the exact same libraries across all Ubuntu versions. This eliminates bugs caused by older system libraries in older Ubuntu LTS releases and allows users on older systems to benefit from the latest compiler optimizations.
  • Enhanced Security through Sandboxing: Snap packages run in a strictly confined sandbox using AppArmor and Seccomp. This isolates the browser from the rest of the operating system, limiting the potential damage if the browser is compromised by a security vulnerability.
  • Reduced Maintenance Overhead: Maintaining and backporting complex browser updates across multiple operating system releases required significant developer time. Switching to Snap freed up Ubuntu maintainers to focus on other parts of the operating system.

How to Switch to Mozilla's Official APT Repository

While the Snap version has improved significantly since its initial release, some users still prefer the traditional .deb package for faster cold-start times, better integration with custom system themes, or compatibility with specific native messaging host extensions (like certain password managers).

Mozilla now maintains its own official APT repository. Follow these steps to completely replace the Firefox Snap with the official .deb package.

1. Remove the Firefox Snap Package

Open your terminal and remove the existing Snap installation of Firefox:

sudo snap remove firefox

2. Import the Mozilla APT Repository Signing Key

First, create a directory to store APT repository keys if it does not already exist:

sudo install -d -m 0755 /etc/apt/keyrings

Next, download and import the official Mozilla signing key. (Ensure you have wget installed):

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

3. Add the Mozilla Repository to Your System

Add the official Mozilla APT repository to your system's software sources list:

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

4. Configure APT Pinning to Prioritize Mozilla's Package

By default, Ubuntu's repositories contain a transitional package that will force the Snap version to reinstall during a system update. You must tell the APT package manager to prioritize packages coming from Mozilla's servers over Ubuntu's servers:

echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | sudo tee /etc/apt/preferences.d/mozilla

5. Prevent Unattended Upgrades from Reinstalling the Snap

To ensure background system updates do not overwrite your preference, block the Ubuntu Firefox package specifically:

echo 'Unattended-Upgrade::Origins-Pattern { "site=packages.mozilla.org"; };' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

6. Install the Native Firefox Deb Package

Finally, update your package lists and install Firefox. APT will now pull the traditional .deb package directly from Mozilla:

sudo apt update && sudo apt install firefox

You now have the native .deb version of Firefox installed, which will update seamlessly alongside the rest of your system packages during standard APT updates.