1

I'm considering replacing snap with flatpak. What happens during a version upgrade of Ubuntu? Is the Ubuntu upgrade programmed to reinstall snap and what is the risk of pinning or holding snap from being reinstalled?

I would like to avoid having to purge snap on every upgrade and don't want to risk ending up with a broken system because some key system component has become a snap package.

9
  • 2
    Check here: How to uninstall snap? If you pin the snap package, it won't be reinstalled. I've tested it from 20.04 to 20.10, 20.10 to 21.04 and 21.04 to 21.10 transitions. Mar 4, 2022 at 10:00
  • Ubuntu 22.04 doesn't yet exist; it's currently the development release Ubuntu jammy and remains that until it reaches RC state which isn't expected until after 14 April 2022, and isn't on-topic here until release on 21 April 2022. discourse.ubuntu.com/t/jammy-jellyfish-release-schedule/23906 Please refer askubuntu.com/help/on-topic. For support issues with Ubuntu jammy you'll need to use a #ubuntu-next or #ubuntu+1 site (IRC, UF etc) Ubuntu jammy is still in alpha; yes feature freeze has hit, but changes can still occur with SRUs so it's still a partial unknown
    – guiverc
    Mar 4, 2022 at 10:13
  • 3
    You may eventually lose printing: CUPS is in the (slow, methodical) process of transitioning from deb to snap. The developers cite too few volunteers to maintain and package and test multiple versions for different releases of Ubuntu -- the snap offers a significant reduction in their workload. More volunteers to do the work would, of course, preserve the deb option.
    – user535733
    Mar 4, 2022 at 10:48
  • 1
    @Lorenz Keel, why not post as an answer?
    – vanadium
    Mar 4, 2022 at 14:03
  • @vanadium the question may be considered duplicated, so I preferred not to post an answer, but nonetheless I've put one, with some lines about pinning (so that it's not exactly a duplicate of the link I posted before). Mar 4, 2022 at 14:15

1 Answer 1

3

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 issuing in 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.

2
  • Note that if you are using the GNOME desktop variant of Ubuntu Desktop you will be sacrificing a lot of functionality as it's mostly snapped now instead of debian packaged. This will cause some issues if you aren't careful.
    – Thomas Ward
    Mar 4, 2022 at 14:51
  • @Thomas Ward, for what concerns me, I'm fully aware. However, I'll add a note in my answer. Mar 4, 2022 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .