How To Revert Snaps & My Thoughts on Snaps

There was a post on Hacker News a few days ago that got some attention. One dev’s CLion snap updated and that update broke his plugins. So he ranted on how you have no control over Ubuntu’s ‘forced’ Snap system. I googled and found the ‘snap revert’ command in a few minutes so I thought I would write an article about it and my thoughts. There are a lot of negative, poor comments on the Snap system in general by Hacker News commentators.

First, for those who do not know; Snaps are a wonderful tool. They solve a lot of issues with modern Linux packaging systems that Windows users never have to deal with. I make good use of the Visual Studio Code and Hugo snaps to have the latest versions of these tools on my desktop.

On Windows, if an new version of software that you update breaks you can just uninstall and download the old installer like on oldversion.com. On Linux, once you update you are stuck with that version. I found that out the hard way on Manjaro when an update to Atom broke a common plugin. I had assumed it would be fixed quickly so I ignored it. Eventually the older Atom package was cleaned out of my package cache so I could not revert. As the weeks went by I found out it was a deeper issue in Chrome, which Atom as an Electron app depends on Chrome as it’s base. This update issue was eventually fixed with another update, but it took well over a month and it gave me anxiety as a Linux user.

Sure there are some things you can do to keep older versions of packages in traditional package systems. For Debian you can use apt pinning; if you know of the issue in advance. That doesn’t help if you discover the issue on your Debian based (Ubuntu/PopOS) workstation. You can revert on Arch family (Manjaro) workstations; assuming you have the old version in the cache, and assuming a dependency is not broken. Please do not even mention compiling from source. Setting the proper flags and installing the needed packages is enough to make most people move to Windows and not look back. And yes, I am aware that Windows is moving away from this with forced Windows system updates and the Microsoft Store. Just because Microsoft is doing it does not mean you should just accept it.

When you a professional you need to have control over the software you make your living off of. When you can freely download old versions of Blender, Gimp, or OBS to run on your Windows box it makes it difficult to recommend Linux to Windows users if they ask about this. (Do not get me wrong; when Windows Antivirus takes up 30% of CPU usage on a quad core-it makes it very easy to recommend Linux.) When you a professional that advocates for Free and Open Source Software that gives control to the users. It really sends a mixed message when you have so little control over the version of the software you install.

Snaps (and Flatpaks) really do help you on this. They allow you to easily revert to the last version.

Here’s how for Hugo (a static site generator):

  $ sudo snap revert hugo
hugo reverted to 0.74.2

and to move back to the latest version:

  $ sudo snap refresh hugo
hugo (extended/stable) 0.74.3 from Hugo Authors refreshed

This is so much easier for new users-especially when GNOME Software and KDE Discover have Snaps and Flatpaks integrated into their GUI selection screens. No random installers to download from websites they may never have heard from. It is just taken care of for them. The people that post to Hacker News may prefer the freedom to install what they want and worry about the slippery slope of an App Store and the walled garden that may come from it. But I still deal with family members that forget how to maximize a screen window on a desktop, a Windows 10 desktop.

Also, I found myself experimenting by trying out different distros like Fedora and Debian. I knew I could easily install an updated version of my tools on any distro. Canonical did a lot of good to the Linux desktop when they got several well know companies to make Snaps of their apps: Spotify, Discord, Slack, and Microsoft. Really reduced the burden and anxiety of distro hopping. Snaps are a rising tide that lifts all boats in the penguin waters.

There are issues with Snap.

1) you can only revert to the previous version, and, 2) only if you already had it on your computer.

I found 2) out after removing my vscode snap to try out the vscode flatpak and then reinstalling the snap:

  $ sudo snap revert code
error: cannot revert "code": no version to revert to

Also with 1). According to the docs: if you need to revert a version, and an update after the broken update is published, you will be ‘refreshed’ (updated) to the latest version. One commenter in Hacker News said that RockerChat had an issue with the Linux version and held off updates to the snap until it was fixed because of this limitation.

Some Snaps do have channels that you can set to.

For example you can set the blender snap to Blender’s first LTS release with:

  $ sudo snap install blender --channel=2.83lts/stable --classic

Blender actually keeps older unsupported versions in channels that you can switch to as a solution.

But apps with legacy channel options, or just LTS channel options, are few and far between. Most are like Firefox or Google Chrome. You only have one version or beta branches. If you do not like it, tough.

You should hear the stories of the Youtubers I watch complaining about Adobe Premiere’s forced updates on Windows.

That still makes me nervous. This is a container solution. It is trivial to keep older versions of apps compared to the overall work of making the container solution. You are an adult; if you want to run an older version and accept the risks, that is your choice. Often you have little choice when you have a deadline and a sudden update requires time to learn/fix plugins that you may not have right now.

As a solution I decided to take a quick look at Flatpak. The vscode flatpak was outdated but it does seem to have it’s own revert functionality that goes beyond one version.

  $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  $ sudo flatpak install flathub com.visualstudio.code
  $ sudo flatpak run com.visualstudio.code . # open vscode project in current folder

The flatpak runs in it’s own config folder so you do not need to worry about your current config being overwritten. Just set the config and other settings in ~/.var/app/com.visualstudio.code

You can view the older versions with:

  $ flatpak remote-info --log flathub com.visualstudio.code

and there are a lot of older versions.

I picked ‘Update code.deb to 1.39.1 (b368100d)’ for the ’lulz’ (1.47.3 was the latest at the time of writing and 1.47.1 was the current one installed by Flatpak):

  $ sudo flatpak update --commit=4f0a78a534afa92f2f614d02eba490b5b478ca1e95c1ed85e61a261751b0d907 com.visualstudio.code

it errored out on Kubuntu 20.04:

Error: com.visualstudio.code not installed
Updates complete.
error: There were one or more errors

Picked a more recent version (Update code.deb to 1.46.1-1592428892):

  $ sudo flatpak update --commit=ed3fd69932437f72c0598a878e4aa260ee3668fa3f375b244e3a07e9922d47a1 com.visualstudio.code

and I finished writing up this post in it.

Flatpak has it’s own issues that I will talk about in a future post. Canonical is offering the Snap service for free, but I do feel they should offer more options for legacy versions. Until they do, I feel Flatpak does have it’s place, despite being more difficult to use for console users and less adoption by vendors. I just feel more comfortable having this kind of control over the tools I use. Thanks to ajgringo619 for the great post on Stack Overflow.

Please see my privacy policy.