apt
gives the chance to pin a package. Further details about pinning are available using the terminal command man 5 apt_preferences
.
The "Pin-Priority" parameter, in your specific case, can be used to prevent the re-installation of snapd
package by giving it a negative priority.
Create a file no-snap.pref
by issuingin a terminal:
sudo -H gedit /etc/apt/preferences.d/no-snap.pref
and then copy the following content in it:
# To install snapd, specify its version with 'apt install snapd=VERSION'
# where VERSION is the version of the snapd package you want to install.
Package: snapd
Pin: release a=*
Pin-Priority: -10
You can still install snapd
if you want, but you need to explicitly set the package version in the sudo apt install
command: you don't need to delete the /etc/apt/preferences.d/no-snap.pref
file.
I've tested this procedure from 20.04 to 20.10 + 20.10 to 21.04 + 21.04 to 21.10 transitions. However, consider that for the GNOME variant of Ubuntu, the number of packages distributed as snap is increasing, and for some of them the decision has been taken not by Canonical but by the package distributor itself (for instance, Mozilla for firefox
). In the future the removal of snapd
may not be harmless.