popey/unsnap

Block future snapd installation (to avoid recommends pulling it back in)

rcj4747 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
I have an Ubuntu 22.04 (Jammy) without snaps thanks to unsnap but this morning unattended software updates installed snapd/firefoxz debs/snaps back on my system. The ubuntu-desktop package has an update to recommend firefox and while it's staged and not yet installed on my system, the apt resolver pulled it in early (it would have happened anyway I guess). At the root of the issue is a change in the ubuntu-desktop recommends focused on pulling in the firefox deb/snap for upgrades to Jammy that didn't consider explicit removal of snapd/firefox (or chose to favor one case over the other with the fix).

Describe the solution you'd like
I'd like to prevent future snapd installation through other package recommends/depends. One possible solution I've tested is blocking snapd installation via apt preferences:

$ cat  /etc/apt/preferences.d/snapd
# Configure apt to never install snapd
# P<0 prevents the version from being installed
Package: snapd
Pin: version *
Pin-Priority: -1

This makes it impossible to install snapd but users might forget how this was done if they do want to intentionally install it later.

$ sudo apt install snapd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package snapd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'snapd' has no installation candidate

Describe alternatives you've considered
You could also install a dummy snapd package with a very high epoch, not sure this is better.

Hello there 👋
Thanks for submitting your first issue to the unsnap project 🐛 We'll try and take a look at your issue soon ⏲

In the meantime you might want to join the popey's home Discord 🗣 where we discuss this project