sudo apt-get install chromium-browser for some reason installs not a proper apt-get package but is Installing the chromium snap

I am aware that blocking such installs will not magically establish a maintained package, and would result in an installation failure. But I prefer to get error and install manually - from source or in unlikely cases from snap.

I want to never install anything using snap (for start, due to Snap Store closed-source practice). Especially not silently when I install using apt-get.

How can I disable snaps in gnome-software centre? is not answering my question as I want to get rid of snap infestation in apt - not in gnome-software-center.

  • 1
    Look at this: askubuntu.com/q/1317194/1157519 – Levente Jun 12 at 7:45
  • 1
    @Levente Thanks! Unfortunately it is not helping - I want installation to fail if it would require installing snap with apt-get. – reducing activity Jun 12 at 7:55
  • 1
    The Chromium browser is not packaged as a deb and hasn't been for numerous releases (well before 20.04 anyway; 18.04 had it as a deb package but late 2018 it first appeared as snap - see discourse.ubuntu.com/t/… discourse.ubuntu.com/t/… ; May-2018). It's available as deb only as stub so users don't get errors telling them package isn't found (it just loads the snap for them). I find discover is pretty easy to pick snaps and debs – guiverc Jun 12 at 7:55
  • 4
    @guiverc I am fine with being unable to install Chromium with apt. In fact, if it requires snap - I want to be unable to do this. – reducing activity Jun 12 at 7:57
  • 1
    This is why I'm still on 18.04LTS, and will leave the Ubuntu world when it goes EOL. – RonJohn Jun 13 at 7:21

You have to remove snapd from the system by

sudo apt-get autopurge snapd

and then create special configuration file for APT, as LinuxMint did:

cat <<EOF | sudo tee /etc/apt/preferences.d/nosnap.pref
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html

Package: snapd
Pin: release a=*
Pin-Priority: -10

This will prevent Snaps installation in future.

  • Is it safe to immediately perform the autopurge? Many tutorials involve first disabling snap, removing the individual snaps, etc. Perhaps yes, but this may then leave unused files and folders behind. – vanadium Jun 12 at 9:40
  • 1
    The configuration script will do for us what is needed. – N0rbert Jun 12 at 9:50

You cannot stop apt from installing snap packages, because it is not apt, but the individual deb packages (in this case chromium-browswer) that trigger a snap installation. So apt on its own cannot control that: this is controlled by the available packages.

Thus, you need to check the packages before you install them, and refrain from installing them if it appears they are pulling in a snap.

To fully stop apt from installing snap packages, you actually would need to fully disable and remove snap. This is perfectly safe: your system will run fine without snap. The few default tools that are installed as snap, e.g. system monitor, characters and snap store, can easily be replaced by their .deb counterparts.

  • 3
    We could remove snapd and apt-mark hold it so it cannot be pulled in as a depency. – mook765 Jun 12 at 9:23
  • Yes, but it is not stated in the question that the user wants to remove snap completely. Anyway, the user makes his aversion to snap quite clear in the body, so I may want to add some information. – vanadium Jun 12 at 9:24
  • 2
    I guess that individual deb packages may do basically anything, so there is no feasible way other than removing snap altogether? – reducing activity Jun 12 at 13:56
  • Indeed, else you have no other option than to check every package. You can perfectly remove snap. I actually have it removed myself. Some of the system tools that are installed as snap (e.g system monitor, characters, but also software center) can be replaced by their .deb counterparts. – vanadium Jun 12 at 15:48
  • 2
    @reducingactivity: A package can contain scripts that can perform arbitrary actions, which are automatically executed at various points of the installation process. These scripts are just scripts like any other script, they can do what any other script can do, including, but not limited to, install other packages, send all of your data to Russia, or format your hard drive. APT cannot prevent any of this, since it does not know about the content of those scripts. – Jörg W Mittag Jun 13 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.