Snap is a software deployment and package management system. The packages are called ‘snaps’ and the tool for using them is ‘snapd’, which works across a range of Linux distributions and allows, therefore, distro-agnostic upstream software deployment. Snap was originally designed and built by Canonical.
snapd is a REST API daemon for managing snap packages. Users can interact with it by using the snap client, which is part of the same package.
Snaps can be confined using AppArmor which is now enabled in the default kernel. Consult relevant wiki pages to find steps for enabling AppArmor in your system
Installation
Install the snapd
pacman -S snapd
Tip: snapd installs a script in /etc/profile.d/snapd.sh to export the paths of binaries installed with the snapd package and desktop entries. Reboot once to make this change take effect.
Since version 2.36, snapd enabled AppArmor support for Arch Linux. In order to use it, you have to enable AppArmor in your system,
Note: If AppArmor isn’t enabled in your system then all snaps will run in devel mode which mean they will have same, unrestricted access to your system as apps installed from Arch Linux repositories.
Within the snapd package there is an automatic script that makes the start of the various services including AppArmor
Usage
The snap tool is used to manage the snaps.
Finding
To find snaps to install, you can query the Ubuntu Store with:
$ snap find searchterm
Installing
Once you found the snap you are looking for you can install it with:
# snap install snapname
This requires root privileges. Per user installation of snaps is not possible, yet. This will download the snap into /var/lib/snapd/snaps and mount it to /var/lib/snapd/snap/snapname to make it available to the system.
It will also create mount units for each snap and add them to /etc/systemd/system/multi-user.target.wants/ as symlinks to make all snaps available when the system is booted. Once that is done you should find it in the list of installed snaps together with its version number, revision and developer using:
$ snap list
You can also sideload snaps from your local hard drive with:
# snap install --dangerous /path/to/snap
Updating
To update your snaps manually use:
# snap refresh
Snaps are refreshed automatically according to snap refresh.timer setting.
To view the next/last refresh times use:
# snap refresh --time
To set a different refresh time, eg. twice a day:
# snap set core refresh.timer=0:00~24:00/2
See system options documentation page for details on customizing the refresh time.
Removing
Snaps can be removed by executing:
# snap remove snapname
Tips and tricks
Classic snaps
Some snaps (e.g. Skype and Pycharm) use classic confinement. However, classic confinement requires the /snap directory, which is not FHS-compliant. Therefore, the snapd package doesn’t ship this directory. However, if the user wants to, they can manually create a symlink from /snap to /var/lib/snapd/snap, to allow the installation of classic snaps:
# ln -s /var/lib/snapd/snap /snap
Graphical management
Both Gnome Software Center and KDE Discover can provide native snap support with the gnome-software-snap or discover-snap packages.
Gnome support snap
pacman -S gnome-software-snap
Kde support snap
pacman -S discover-snap