Prevent Firefox from being installed as snap package

Though being a long-time Ubuntu user, I still prefer softwares distributed as deb packages to snap. Every time upgrading to new Ubuntu version, I have to repeat the task of removing Firefox snap and install Firefox from deb.

When installing Firefox from APT repositories (like PPA or Mozilla APT repository), we have to set some configuration to prevent Ubuntu from installing Firefox snap again.

This snippet is introduced on Mozilla help page to do that:

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

But it is not reliable. Sometimes the repository is slow to update and doesn't provide Firefox package for your new Ubuntu yet. You will have to look for other repositories and the configuration above no longer works.

It is better that, we set the "snap" package to lower priority with this snippet:

Package: firefox
Pin: version 1:1snap*
Pin-Priority: -1

Now check with apt policy:

$ apt policy firefox
firefox:
  Installed: (none)
  Candidate: 132.0.2+build2-0ubuntu0.24.10.1~mt1
  Version table:
     1:1snap1-0ubuntu6 -1
        500 http://mirrors.nivacloud.net/ubuntu oracular/main amd64 Packages
     132.0.2+build2-0ubuntu0.24.10.1~mt1 500
        500 https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu oracular/main amd64 Packages

The packages from PPA will be installed by default.