Parallel installs for classic snaps

by Igor Ljubuncic on 20 February 2020

For a while now, snapd has supported the ability to install and use multiple instances of the same snap in parallel. This allows users to test features in new software releases side by side with the stable, production versions. Similarly, users can distribute their work or perhaps use custom settings across several distinct, isolated profiles in their applications. The only limitation was that snaps had to be strictly confined. Recently, the parallel install capability has been extended to snaps using classic confinement, too.

Enable experimental feature & test functionality

This is still an experimental feature for early adopters and tinkerers – it will be enabled by default in a future stable release of snapd. At the moment, you need to toggle the following option on the command line:

sudo snap set system experimental.parallel-instances=true

Once it’s enabled, you can install snaps in parallel, using a unique identifier to distinguish between different instances (or versions). You can also use aliases to streamline your work. For instance:

sudo snap install --classic --unaliased go_12 --channel=1.12/stable
sudo snap install --classic --unaliased go_13 --channel=1.13/stable
sudo snap alias go_12 go-1.12
sudo snap alias go_13 go-1.13

An important distinction is that previously, snaps used the same mount namespace as the host. Now, this is separate, with application code mounted on /snap/$SNAP_INSTANCE_NAME/, while the data is stored in /var/snap/$SNAP_INSTANCE_NAME/. You may still need to adjust some of your snaps, especially if they employ the client-server model, to make sure that they can function well if installed (and running) in parallel.

You can test this feature with one of the classic snaps available in the Snap Store, like Android Studio, Sublime Text, Powershell, Blender, Microk8s, and others. Or you can even try with snapcraft!

snap list | grep snapcraft
snapcraft_edge          3.9.2+git213.g1fdd243c      4119   edge     canonical*          classic
snapcraft_stable         3.9.8                       3970   stable     canonical*          classic

If you are a snap developer, this is an excellent way to test new features without compromising on your production setup. You can have the stable version of snapcraft installed for everyday builds, and then use the edge build to try out new stuff. You can also always switch between channels, all of which provides you with the necessary flexibility for development work.

Summary

The parallel install for classic snaps should further expand the freedom in how people they manage their software. Developers can promote new versions and early builds with greater confidence, while users have the ability to try the upcoming features without touching their stable setup. Classic snaps present their own challenges, as they have system-level access, which makes the parallel install option even more enticing and practical.

We welcome your thoughts and ideas. For any feedback or suggestions, please join our forum for a discussion.

Photo by Jamie Street on Unsplash.

Newsletter Signup

Related posts

Snapcraft:多应用客户端-服务端snap开发教程

在过去几个月我们发布了一些如何使用Rust,Java,C/C++和其他语言来开发snap桌面应用的文章。在这些从入门到精通的教程中,我们以一个代表性的snapcraft.yaml文件来介绍开发构建snap所需的具体细节。 今天,我们希望脱离这一过程,而将重点放在服务器端。我们将为你提供一个包含两个有趣组件的snapcraft.yaml的概述:a)它将拥有多个应用程序; 通常,snap包含一个应用程序。b)它具有简单的后台服务,其他应用程序可以连接到该服务。 我们一起来看一下。 Snapcraft yaml 以下是snapcraft.yaml文件的内容: apps: borg: command: bin/borg daemon: simple restart-conditi […]

Learn snapcraft by example – multi-app client-server snap

Over the past few months, we published a number of articles showing how to snap desktop applications written in different languages – Rust, Java, C/C++, and others. In each one of these zero-to-hero guides, we went through a representative snapcraft.yaml file and highlighted the specific bits and pieces developers need to successfully bui […]

Snapcraft tricks: Improve release flexibility with pull and build overrides

Sometimes, software projects are simple – one architecture, one version, one release. But often, they can be complex, targeting multiple platforms, and with different versions at that. If you are packaging your apps as snaps, you might wonder about the optimal way to accommodate a multi-dimensional release matrix. One yaml to rule them al […]