NOTE: Removing snapd may impact the operation of Ubuntu Pro.
I don't currently use snaps, but have not had to work hard at avoiding them [1].
Getting rid of snaps in Ubuntu 22.04 LTS is basically a 4 step process:
$ sudo snap remove --purge firefox
$ sudo snap remove --purge snap-store
$ sudo snap remove --purge gnome-3-38-2004
$ sudo snap remove --purge gtk-common-themes
$ sudo snap remove --purge snapd-desktop-integration
$ sudo snap remove --purge bare
$ sudo snap remove --purge lxd
$ sudo snap remove --purge core20
$ sudo apt remove --purge snapd
Create /etc/apt/preferences.d/nosnap
:
Package: snapd
Pin: release a=*
Pin-Priority: -10
Just an example, in this case, Firefox, but the principle applies to any .deb package that has a corresponding snap. In this example, a preference is created for the PPA version from MozillaTeam.
Create an apt preference file for the package (/etc/apt/preferences.d/mozilla-firefox
):
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox
Add an exclusion to unattended upgrades (/etc/apt/apt.conf.d/51unattended-upgrades-firefox
):
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
For Desktop systems, you have to restore gnome-software related packages:
$ sudo apt install --install-suggests gnome-software
For Firefox (which in 22.04 is installed as a snap), you can either use the binary build (this is what I use, see instructions at https://support.mozilla.org/en-US/kb/install-firefox-linux), or add the Firefox developer's PPA. Here's how to install the PPA:
$ sudo add-apt-repository ppa:mozillateam/ppa
$ sudo apt update
$ sudo apt install -t 'o=LP-PPA-mozillateam' firefox
Q: What about dist-upgrade?
A: I guess we'll see when I have to upgrade to 24.04 LTS.
Q: Wait. How did you reinstall the Firefox .deb?
A: Don't, just use the tarfile from Mozilla.
Q: What will you do when Canonical removes apt and mandates the use of snaps for all software on Ubuntu?
A: Find another distro with commercial support (e.g., RedHat, where my journey started in 1995).
[1] Unlike the former Ubuntu community manager responsible for evangelizing snaps, I'm not convinced that flatpaks are the answer, particularly given their inability to properly deploy command line tools. Both apt and dnf (a/k/a yum) are quite capable (dnf having the edge in my mind with its built-in method for displaying history). What we really needed was for the distros to settle on one of those two as a standard, not create further confusion by introducing two more competing package managers that will only be used on -- at most -- 10% of computers.
Ji m. "How to Remove Snap Apps & Block Them in Ubuntu 22.04". UbuntuHandbook, 19 April 2022, https://ubuntuhandbook.org/index.php/2022/04/remove-snap-block-ubuntu-2204/.
Joey Sneddon. "How to Install Firefox as .Deb on Ubuntu 22.04 (Not a Snap)". OMG! Ubuntu!, 28 April 2022, https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04.
Arindam. "How to Remove Snap Packages in Ubuntu Linux". Debugpoint.com, https://www.debugpoint.com/remove-snap-ubuntu/.