As a storage space pauper and metered internet user, I hate Snap packages (Flatpaks too!). However, there is something to be said for a self-contained application, like not polluting my system with packages not “meant” for it, for example, just to run one application. The more packages installed, the larger the attack surface becomes if someone tries to compromise your system. There are also problems with Snap packages, for instance, one cannot just add a few files to one installed on your system. For example, say I installed ADOM, and there is a texture pack that was just released, I cannot add it to the application. I have to wait for the flatpak packager to do it, or I have to package my own. Can you see the pattern here? For me, it’s wasteful-ness. Wasted time, wasted space, wasted bandwidth, et cetera, and I hate wasteful. But! Snap management is great.

The reason I use Ubuntu instead of Fedora is that I was stuck in dependency hell as a young lad, when Fedora 1 launched, when all I wanted to do was play a mp3 file. This (dependency) hell is a real problem for package maintainers, that is why you often find that a package is outdated on a certain release. For instance, when I was on Ubuntu 14.04, I thought VLC was outdated and I had to update to 16.04 to get the latest version so I could use a feature, or something. To develop truly portable packages, Canonical created the Snapcraft framework implementing application sandboxing and auto-updates.

The way that works is that Snaps isolate applications in lightweight containers giving them just enough access while enabling updating individual applications without impacting the system. Supposedly, the Snap Store ‘reviews publisher verification, enforces code checks, vulnerability scanning and manual approval to enhance security’. This alone, should tip the scales in favour of Snaps over, say, Flatpaks. Though there has been malware in the Snap store before!

Whether you love or hate them, let’s talk about how to handle them.

To search, use the “find” keyword, like so:

snap find <keyword>

Useful fields are displayed like publisher name and a brief one-line description.

Verified publishers get a green check mark.

Installation works just as you’d expect, with the “install” keyword.

Example:

sudo snap install enpass

But it does not end there! We can also add flags to the end of that.

They are: –beta Install beta channel releases –candidate Early access to upcoming releases –classic Disable confinement giving full system access –dangerous Disable all security checks during install –edge Bleeding edge nightly builds –jailmode Force strict confinement.

Sometimes you may see them referred to as “modes”. I’m not going to repeat what is on the official website: https://snapcraft.io/docs/install-modes

I encourage everyone to go through the Snapcraft pages above, as it will be a lot more in-depth than anything I’m going to chat about. As a newbie, you don’t need to know every use case. What we will cover is probably the 80/20 case.

To see what you currently have installed, you use the “list” keyword.

snap list

(nothing fancy!)

Now, if you, or the maintainer, enabled one of these flags, it will show up under notes, the last column. Let’s use Sublime Text as an example (output shown above)

To update your snaps, it is not “update”, but “refresh”. If your network is set to metered (like mine), the auto-updates will not happen from the App Center.

So it stands to reason that “sudo snap refresh” is all you need, but did you know that you can update a single application, all on its own?

sudo snap refresh pinta

This should give you an output of the version change. I do not have any updates to show, but the output will be in the following format:

pinta refreshed from xxxxx.xx.x to xxxxx.xx.x

If the new snap is broken, you can then simply copy that version number and roll back, using the –channel keyword:

sudo snap refresh pinta –channel=xxx.xx

If something went *really wrong, you can disable the snap with the “disable” keyword, like so:

sudo snap disable pinta

It’s not gone, it is still there, but let’s say it interfered with the display, this now gives you the opportunity to upgrade or downgrade your display drivers and try again, thus avoiding wasting bandwidth with uninstall and re-install. Once you are done, you simply “enable” it again, the same way you disabled it.

Let’s say you run out of space, and your system will not run a GUI (this happened to my cousin recently). You can uninstall any snap with the “remove” keyword. Before you do, I suggest that you check to see if you have any older versions still hovering in the background. This does happen and it’s not a bad thing!

Go ahead and list all your snaps, like so:

snap list –all

Your configuration files for your Snaps are in /var/snap/

The command “snap remove –purge” - should remove these, but sometimes some stay behind, you can simply delete the corresponding folder, but since it is not owned by you, you will need root permissions. Snap folders in the virtual file system are read-only, so you don’t have to worry about leftover files sitting somewhere and filling up your system when you uninstall / purge a Snap.

The nice thing about the commands I have stepped you through here, is that they are the same on other distros like Fedora or Arch, meaning that you have to learn only one way.

For any newbie, this is the basics you need to know for snap on the command-line. I don’t think I’ll go any deeper as the Ubuntu documentation is very thorough.

As always, mistakes to: misc@fullcirclemagazine.org