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 offline mode – Build snaps while saving data

As part of the snap creation cycle, the Snapcraft tool creates isolated build instances inside which all of the necessary work – download of sources, compilation, packaging, etc. – is done in a safe manner, without touching the host system. While there are many advantages to the use of the virtual machines (via Multipass) or […]

Snapcraft experimental login – new, secure Web-based authentication method

Some Snapcraft operations mandate that users identify themselves. For example, if you want to push your snap to the Snap Store, you need to login on the command line. The process relies on the internal login mechanism built into Snapcraft. A preview functionality for a new Web-based authentication flow is available as an experimental feat […]

Snap usage metrics now available on the command line

For years now, developers and publishers could view how well their snaps are performing in terms of usage and popularity through the Snap Store Web interface, using the metrics tab. This functionality allows people to examine the cause and effect of their work, like software updates, marketing campaigns, or other events. But it requires m […]