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.
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.