Aww, snap

Share on:

In the olden days…

When you need a program or application it has to get installed some how. We used to just copy the file over from floppies or tape (before that software for me was delivered on cassette tape or cartridge). That was because we only needed the executable. There weren’t supporting files for most software, and if there was the application handled the media for you. How many people remember needing 2 floppy drives to run a word processor? One for you documents and the other for the code, dictionaries and fonts (if it was on the newer side).

As time went on I remember unpacking tar balls or zip files for installing software. One often required building, the other you just kind of trusted. With windows we got installers that sometimes worked and sometimes you wished would stop trying to. On Linux we got package managers that would take care of dependencies and provide a clean upgrade path and make sure you didn’t do something stupid without really trying hard.

As our systems have gotten more complex and more interdependent it got hard to get the latest software. Apps, or the OS, may require that old version to function right. I stopped using Gentoo as my desktop because a few key tools were not getting updated. I also think that Python 2 lived much longer than it should have because so many Linux distros used Python 2.X for internal tools and too many people just learned to use it because it was there.

The ghost of software now…

Now we have incredible package management systems and repositories of software, but many tools are out of date before they are made available to the user. Even the large distros can’t spend the time to keep both the software and dependencies moving forward and still test for stability. It’s not uncommon for the default from the OS to be a few versions behind. That’s fine if you aren’t pushing the envelope, but really gets to be a problem when you want that new feature or have a dependency that requires the newer version.

Sure you can go and install from source. Aren’t we hard core Unix users? Yes, but I may not have the time to keep track of the new releases and keep building it to keep things up to date. If it’s a security patch can I keep in front of that wave, and do I really want to do that by hand for a casual project (or few hundred running around)? NO! I would run Linux from Scratch if that was the case. We all need the help of these package management systems to keep our systems up to date in a timely manner.

Solution ???

We started to see portable applications on Windows that could just be copied over and run from user space. This made windows software way to easy to install for many enterprise networks. Python has virtual environments where they make a fake OS file tree to carry around files just for themselves and not affect the installed version. There are countless cases, and for the most part they have worked for the user. Linux desktop executables though have not had a similar option that was fully managed until recently though.

Ubuntu realized they could not keep up with making some software run and stay current. These applications were causing cascading changes and tweaks that were just not sustainable. They wanted to take applications like Chromium (Open source Chrome browser) and keep it self contained. This way they could just release a single version of the app that runs across a range of Ubuntu versions and patch levels. Their solution was Snappy. Now called Snap.

The goal is admirable and the user experience is almost serene at first glance. Hit the install button, or run the install command. Software is installed, runs and keeps getting updated. What’s not to like?

Stray socks

The problem comes in when you need to use the system as an admin or systems programmer. These applications come in the form of snaps. There is a manager that senses what you need and mounts a fake OS file tree for the app to play in. A Potemkin OS worthy of North Korea. It mounts these snaps like little fake hard drives through what is known as “loop” devices.

If you haven’t heard of a loop device you can be forgiven. They are not a user concept, but they are an amazing tool that turns any old file into a block device (hard drive, CD ROM, thumb drive, etc) as far as the OS is concerned. You can do really cool things with them and I have been for decades. It used to be that the OS provided 8 or 16 of these and you did your work on those.

Now I have anywhere from a half dozen to just shy of a hundred snaps using up my loop devices. Sure I can cope, but it makes things a mess. If I want to debug what’s going on there are a bunch of entries for things like fonts and little tools in the same output as say my primary encrypted hard drive (loop devices is often how drives are protected).

That’s not the end of it. Common tools like df and mount now output a ton of junk I don’t need when I just need to see one line. (Note: mount has been getting bad at the kernel level for some time, but that is another topic) Here are examples of what I’m talking about from a VM I run my WiFi from.

output of ‘df’

output of ‘mount’

If I need to see how much space is left on a device or the mount options for a critical file system I have to look through this mess. There is only 1 drive in these outputs! It’s like the designers of Snappy think tools like df and mount are obsolete. Must be nice living in that world, because from down here it looks awful up in that tower.

To top it off, that snap manager that is running takes up a good bit of memory and each of these loops aren’t free. Sure on a modern desktop it’s at the who cares level of resource consumption, but on a micro server in the cloud it can be significant.

It’s a good idea

I will say it over and over, the concept is a sound one. Being able to install software and keep it up to date with out blowing up the rest of the system has spurred VMs and containers at the system level and we do need something at the desktop application level. I just don’t need the baggage in this case.

MacOS has Homebrew (and it is available for linux now). There is Flatpack and others. I haven’t gone and looked at how each of them work or what warts they have internally, but maybe I should. Knowing there is a solid option that doesn’t litter could make my day.