Snap packages brand it possible to conveniently install software applications on your Linux organisation. Perfect when your Linux distribution’s bundle director does not offering a specific awarding or the right version. Application developers now merely need to bundle their software in one case and publish information technology on the Snapcraft website. Snaps also have a disadvantage: they automatically update to a newer version in the background. This article explains how to disable this automatic Snap update feature.
Think of a
equally a software packet that you tin can install on your Linux system in a convenient way. Note that I wrote
Linux organisation, and not a specific Linux distribution. Snaps offer a Linux distribution agnostic method for installing software. A Snap package runs in a sandbox environment, isolated from the rest of your Linux arrangement. When installing a Snap packet, yous simply snap it on to your Linux organisation, without negatively effecting it. As in no library or dependency conflicts. It only works.
Canonical, the developer, maintainer and publisher of the popular Ubuntu distribution, developed the packaging engineering science backside Snaps. They also maintain the Snapcraft website, the online Snap package repository. Information technology’s the place to go to when looking for software packaged every bit a Snap.
The Ubuntu distribution supports Snaps out-of-the-box. For other Linux distributions, you just need to install the
package. Y’all can find detailed installation instructions here.
Benefits of Snap packages
Linux users can benefit from Snaps, because it allows them to conveniently install software (or a specific version of software) not offered by their distribution’s online parcel repository. For Linux application developers, Snaps offer benefits too. They simply demand to package their software once as a Snap and so publish it on Snapcraft.
Disadvantages of Snap packages
Unfortunately, Snaps come with one major issue that bothers some Linux users (including myself): Snaps update automatically in the background. Then without your explicit input, all of a sudden a new software version gets installed. One of the reasons I prefer Linux over other operating systems, is that it gives me total control. I decide when and what gets installed.
Peculiarly when you run Snaps on a server, these automated Snap updates are a deal-breaker. Server administrators run CentOS, Debian or Ubuntu LTS on a server for a reason, every bit opposed to a rolling release distribution. They want version stability for their server software. That server needs to run 24/seven with as little assistants effort as possible. They only want security patches for software, not new versions.
Imagine running the Snap version of the LXD container manager. Then all of a sudden a new version of LXD gets automatically installed, without your consent, and potentially breaks some functionality on your containers. That’s nightmare stuff for server administrators.
Can you disable the automatic Snap update?
This leads to the question: Tin you disable this automatic Snap update feature? The short answer to this question is: no. Luckily there are some workarounds available. Hence, the goal of this article is to explain these workarounds.
What do you need
Snaps work on all Linux distributions. Therefore, you but need Linux running somewhere to implement the workarounds, presented in this article. That said, I do recommend Ubuntu for this article. Simply considering Ubuntu offers support for Snap packages past default. In preparation for this article, I freshly installed Ubuntu Desktop 20.04 in a VirtualBox virtual auto. The post-obit two tutorials contain detailed instructions on setting up a similar environment:
- How to install Ubuntu Desktop 20.04 LTS in VirtualBox
- Install VirtualBox guest additions in Ubuntu 20.04
Workaround i: Utilise Flatpaks instead of Snaps
Instead of Snaps, you could consider using Flatpaks. The idea backside Flatpaks is similar to that of Snaps. Flatpaks also piece of work on all Linux distributions and run in an isolated sandbox environment. Only like the Snapcraft website for Snaps, y’all can notice Flatpaks on the Flathub website. In the past I dedicated an entire article to the ins-and-outs of using Flatpaks: How to install Flatpak applications from Flathub.
The following list highlights the main differences between Snaps and Flatpaks:
- The Flatpak applied science is developed and maintained past an independent community. Snaps are backed by Canonical, a corporate entity.
- In dissimilarity with Snaps, Flatpaks exercise not automatically update. You are in full command of when yous update your installed Flatpaks.
Considering y’all are in total control of when you update a Flatpak, Flatpaks offer a viable workaround for disabling the automated Snap update characteristic. You just need to find out if a Flatpak packaged version is bachelor for your software application. Point your spider web browser to the Flathub website to detect out.
Workaround 2: Install a Snap from a specific channel
There is a large overlap between the software offerings on the Snapcraft and Flathub websites, simply information technology’s not 100%. Because of this, information technology tin happen that you can only install a certain software application equally a Snap and not a Flatpak. The previously mentioned LXD software serves every bit a good case. LXD enables you to create and install software in containers. Think of it as a light-weight alternative to virtual machines. Y’all can currently only install LXD as a Snap and not a Flatpak.
It’south common to use LXD on servers. Especially on servers, the automatic Snap update feature is typically not desired. Luckily a workaround exists: Instead of installing the latest version of a Snap, you tin install the Snap from a specific aqueduct. Think of a channel as a branch for a specific version of the software. If you install the Snap from the channel, y’all nevertheless get automatic updates, but merely those that apply to the channel’s version. These typically contain security fixes and not characteristic or version changes. With other words, exactly what yous want as a Linux organization ambassador.
Installing the LXD Snap from a specific channel
I’ll utilize the LXD Snap to farther explicate this workaround. Unremarkably, you would head over to the Snapcraft website and locate the LXD Snap and its installation instructions:
sudo snap install lxd
command installs the latest version and the Snap update feature will automatically install a newer version, when available. So
what we want.
We want to install from a specific channel. Commencement, nosotros need to notice out the available channels. Open up the concluding and run this command:
snap info [SNAP NAME]
In the example instance of LXD:
snap info lxd
By default, a Snap installs from the
channel. In the screenshot in a higher place, this would be LXD version iv.13. At present if yous expect closely, yous notice that channel
also offers LXD version iv.13. If we install LXD from the
aqueduct, information technology will always stay on this channel. This finer means that you lot nonetheless go automatic updates for security fixes for the version y’all installed. However, the LXD Snap will not update to a new version. Exactly what nosotros want.
To install a Snap from a specific channel, the following command syntax works:
sudo snap install --aqueduct [Channel] [SNAP Proper name]
In our case for LXD verion 4.thirteen:
sudo snap install --channel 4.thirteen/stable lxd
Later on completion of the Snap installation, you tin can run the
command to check the version and channel of the Snap:
Upgrade or downgrade the LXD Snap to a different channel
Using the presented workaround, yous can change the channel that an installed Snap tracks. This ways that you tin determine if and when to update (or downgrade) to a different version of the Snap. The syntax for this:
sudo snap refresh --channel [Aqueduct] [SNAP Name]
Sticking with the LXD Snap as an example, nosotros can downgrade to version 4.12 by running command:
sudo snap refresh --aqueduct 4.12/stable lxd
With Snap packages you can easily and conveniently install software on your Linux arrangement. Especially handy when your distribution does not offering the software yous want to install or not the version you desire. Snaps work on all Linux distributions, making them a great option for those that bask distro-hopping.
The one feature most Snaps that not everyone loves, is that they automatically update in the groundwork. This includes updates to new versions the moment the publisher releases these to the Snapcraft website. Unfortunately, you cannot completely disable this automatic Snap update characteristic. This article presented two workarounds for this:
- Use a Flatpak instead of a Snap.
- Install the Snap from a specific channel.
Personally, I combine both workarounds. So when installing a Linux arrangement, I follow these steps:
- Install as much software as possible, using the Linux distribution’south package director.
- Try to install the remaining software from Flathub as a Flatpak.
- If not available on Flathub, locate the software on Snapcraft and install the Snap from a specific aqueduct.