Snap is a software
packaging
Packaging is the science, art and technology of enclosing or protecting products for distribution, storage, sale, and use. Packaging also refers to the process of designing, evaluating, and producing packages. Packaging can be described as a co ...
and
deployment system developed by
Canonical for
operating systems that use the
Linux kernel and the
systemd
systemd is a software suite that provides an array of system components for Linux operating systems. Its main aim is to unify service configuration and behavior across Linux distributions; Its primary component is a "system and service manager ...
init
In Unix-based computer operating systems, init (short for ''initialization'') is the first process started during booting of the computer system. Init is a daemon process that continues running until the system is shut down. It is the direct ...
system. The packages, called ''snaps'', and the tool for using them, ''snapd'', work across a range of
Linux distribution
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading one ...
s and allow
upstream software developers to distribute their applications directly to users. Snaps are self-contained applications running in a sandbox with mediated access to the host system. Snap was originally released for
cloud applications
but was later ported to also work for
Internet of Things
The Internet of things (IoT) describes physical objects (or groups of such objects) with sensors, processing ability, software and other technologies that connect and exchange data with other devices and systems over the Internet or other comm ...
devices
and desktop applications.
Functionality
Snap Store
The Snap Store allows developers to publish their snap-packaged applications.
All apps uploaded to the Snap Store undergo automatic testing, including a
malware
Malware (a portmanteau for ''malicious software'') is any software intentionally designed to cause disruption to a computer, server, client, or computer network, leak private information, gain unauthorized access to information or systems, depri ...
scan. However, the scan does not catch all issues. In one case in May 2018, two applications by the same developer were found to contain a
cryptocurrency
A cryptocurrency, crypto-currency, or crypto is a digital currency designed to work as a medium of exchange through a computer network that is not reliant on any central authority, such as a government or bank, to uphold or maintain it. It i ...
miner which ran in the background during application execution. When this issue was found, Canonical removed the applications from the Snap Store and transferred ownership of the Snaps to a trusted third-party which re-published the Snaps without the miner present.
Although the Snap sandbox reduces the impact of a malicious app, Canonical recommends users only install Snaps from publishers trusted by the user.
Universal Linux packages
''Snaps'' are
self-contained
Self-sustainability and self-sufficiency are overlapping states of being in which a person or organization needs little or no help from, or interaction with, others. Self-sufficiency entails the self being enough (to fulfill needs), and a self-s ...
packages that work across a range of
Linux distribution
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading one ...
s. This is unlike traditional Linux package management approaches, which require specifically adapted packages for each Linux distribution.
The snap
file format
A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free.
Some file formats ...
is a single compressed
filesystem using the
SquashFS format with the extension
.snap
. This filesystem contains the application, libraries it depends on, and declarative metadata. This metadata is interpreted by snapd to set up an appropriately shaped secure
sandbox
A sandbox is a sandpit, a wide, shallow playground construction to hold sand, often made of wood or plastic.
Sandbox or Sand box may also refer to:
Arts, entertainment, and media
* Sandbox (band), a Canadian rock music group
* Sandbox ( ...
for that application. After installation, the snap is mounted by the host operating system and decompressed on the fly when the files are used.
Although this has the advantage that snaps use less disk space, it also means some large applications start more slowly.
A significant difference between Snap and other universal Linux packaging formats such as
Flatpak is that Snap supports any class of Linux application such as desktop applications, server tools, IoT apps and even system services such as the printer driver stack.
To ensure this, Snap relies on
systemd
systemd is a software suite that provides an array of system components for Linux operating systems. Its main aim is to unify service configuration and behavior across Linux distributions; Its primary component is a "system and service manager ...
for features such as running socket-activated system services in a Snap. This causes Snap to work best only on distributions that can adopt that
init system.
Configurable sandbox
Applications in a Snap run in a container with limited access to the host system. Using ''Interfaces'', users can give an application mediated access to additional features of the host such as recording audio, accessing USB devices and recording video. These interfaces mediate regular Linux APIs so that applications can function in the sandbox without needing to be rewritten. Desktop applications can also use the XDG Desktop Portals, a standardized API originally created by the
Flatpak project to give sandboxed desktop applications access to host resources. These portals often provide a better user experience compared to the native Linux APIs because they prompt the user for permission to use resources such as a webcam at the time the application uses them. The downside is that applications and toolkits need to be rewritten in order to use these newer APIs.
The Snap sandbox also supports sharing data and
Unix sockets between Snaps. This is often used to share common libraries and application frameworks between Snaps to reduce the size of Snaps by avoiding duplication.
The Snap sandbox heavily relies on the
AppArmor Linux Security Module from the upstream
Linux kernel
The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
. Because only one "major"
Linux Security Module
Linux Security Modules (LSM) is a framework allowing the Linux kernel to support without bias a variety of computer security models. LSM is licensed under the terms of the GNU General Public License and is a standard part of the Linux kernel sinc ...
(LSM) can be active at the same time,
the Snap sandbox is much less secure when another major LSM is enabled. As a result, on distributions such as
Fedora
A fedora () is a hat with a soft brim and indented crown.Kilgour, Ruth Edwards (1958). ''A Pageant of Hats Ancient and Modern''. R. M. McBride Company. It is typically creased lengthwise down the crown and "pinched" near the front on both sides ...
which enable
SELinux by default, the Snap sandbox is heavily degraded. Although Canonical is working with many other developers and companies to make it possible for multiple LSMs to run at the same time, this solution is still a long time away.
The Snap sandbox prevents snapped desktop applications from accessing the themes of the host operating system to prevent compatibility issues. In order for Snaps to use a theme, it also needs to be packaged in a separate Snap. Many popular themes are packaged by the Snap developers but some themes are not supported yet and uncommon themes have to be installed manually. If a theme is not available as a Snap package, users have to resort to choosing the best matching theme available. Work is ongoing to make it easier for third parties to package themes in a Snap and to automatically install uncommon system themes.
Automatic and atomic updates
Multiple times a day, snapd checks for available updates of all Snaps and installs them in the background using an
atomic operation. Updates can be reverted and use
delta encoding to reduce their download size.
Publishers can release and update multiple versions of their software in parallel using ''channels''. Each channel has a specific ''track'' and ''risk'', which indicate the ''version'' and ''stability'' of the software released on that channel. When installing an application, Snap defaults to using the
latest/stable
channel, which will automatically update to new major releases of the software when they become available. Publishers can create additional channels to give users the possibility to stick to specific major releases of their software. For example, a
2.0/stable
channel would allow users to stick to the 2.0 version of the software and only get minor updates without the risk of backwards incompatible changes. When the publisher releases a new major version in a new channel, users can manually update to the next version when they choose.
The schedule, frequency and timing of automatic updates can be configured by users. For example, this command will check for updates on the last Friday from 23:00 to 01:00.
$ sudo snap set system refresh.timer=fri5,23:00-01:00
Users can also pause automatic updates for a certain period of time, or indefinitely. Updates are automatically paused on metered connections.
Snapcraft
Snapcraft is a tool for developers to package their programs in the Snap format. It runs on any Linux distribution supported by Snap,
macOS and
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. Snapcraft builds the packages in a
Virtual Machine using Multipass, in order to ensure the result of a build is the same, regardless of which distribution or operating system it is built on. Snapcraft supports multiple build tools and programming languages, such as
Go,
Java,
JavaScript,
Python,
C/
C++ and
Rust. It also allows importing application metadata from multiple sources such as
AppStream,
git, shell scripts and
setup.py
files.
Adoption
Snap initially only supported the all-Snap Ubuntu Core distribution, but in June 2016, it was ported to a wide range of Linux distributions to become a format for universal Linux packages. Snap requires
Systemd
systemd is a software suite that provides an array of system components for Linux operating systems. Its main aim is to unify service configuration and behavior across Linux distributions; Its primary component is a "system and service manager ...
which is available in most, but not all, Linux distributions. Other
Unix-like systems (e.g.
FreeBSD
FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
) are not supported.
ChromeOS does not support Snap directly, only through Linux distros installed in it that support Snap, such as
Gallium OS
GalliumOS is a Linux distribution for ChromeOS devices, developed by the community-supported GalliumOS project. The distribution is made for Chrome hardware including Chromebook, Chromebox, Chromebit and Chromebase. GalliumOS beta1 was released on ...
.
A number of Linux distributions support Snap out of the box such as
Ubuntu (and its derivatives, such as
Kubuntu
Kubuntu ( ) is an official flavor of the Ubuntu operating system that uses the KDE Plasma Desktop instead of the GNOME desktop environment. As part of the Ubuntu project, Kubuntu uses the same underlying systems. Kubuntu shares the same repositor ...
and
Xubuntu),
Manjaro,
Zorin OS, KDE Neon,
Solus Solus may refer to:
*Solus or Soluntum, an ancient city of Sicily
* ''Solus'' (comics), an American comic book series
*Solus (operating system), an operating system based on the Linux kernel
* ''Solus'' (moth), a genus of moths in the family Saturn ...
and Li-f-e. Snap is also available for many other distributions such as
CentOS
CentOS (, from Community Enterprise Operating System; also known as CentOS Linux) is a Linux distribution that provides a free and open-source community-supported computing platform, functionally compatible with its upstream source, Red Hat En ...
,
Debian
Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of D ...
,
Elementary OS,
Fedora
A fedora () is a hat with a soft brim and indented crown.Kilgour, Ruth Edwards (1958). ''A Pageant of Hats Ancient and Modern''. R. M. McBride Company. It is typically creased lengthwise down the crown and "pinched" near the front on both sides ...
,
GalliumOS
GalliumOS is a Linux distribution for ChromeOS devices, developed by the community-supported GalliumOS project. The distribution is made for Chrome hardware including Chromebook, Chromebox, Chromebit and Chromebase. GalliumOS beta1 was released ...
,
Kali Linux,
Linux Mint,
OpenEmbedded,
Parrot Security OS,
Pop!_OS,
Raspbian,
Red Hat Enterprise Linux and
openSUSE.
A number of notable Desktop software development companies publish their software in the Snap Store, including
Google,
JetBrains,
KDE,
Microsoft (for Linux versions of e.g. .NET Core 3.1,
Visual Studio Code,
Skype, and
PowerShell),
Mozilla and
Spotify. Snaps are also used in
Internet-of-Things
The Internet of things (IoT) describes physical objects (or groups of such objects) with sensors, processing ability, software and other technologies that connect and exchange data with other devices and systems over the Internet or other comm ...
environments, ranging from consumer-facing products to enterprise device management gateways and
satellite communication networks. Finally, Snap is also used by developers of server applications such as
InfluxDB, Kata Containers,
Nextcloud and
Travis CI.
In 2019, Canonical decided to switch the
Chromium web browser
Chromium is a free and open-source web browser project, mainly developed and maintained by Google. This codebase provides the vast majority of code for the Google Chrome browser, which is proprietary software and has some additional features. ...
in future Ubuntu releases from an APT package to a Snap. They explained that Snap made it much easier to support Chromium on all supported Ubuntu releases. This allowed them to focus engineering resources on other parts of the Ubuntu desktop.
As a result of this decision, Ubuntu derivatives such as Linux Mint had to choose between maintaining their own version of the Chromium package or switching to the snapped version of Chromium maintained by Canonical.
Reception
Snap has received mixed reaction from the developer community.
On Snap's promotional site,
Heroku praised Snap's auto-update as it fits their fast release schedule well.
Microsoft mentions its ease of use and Snap being
YAML-based, as well as it being distribution-agnostic.
JetBrains says the Snap Store gives their tools more exposure.
Others have objected to the closed-source nature of the Snap Store. Clement Lefebvre (
Linux Mint founder and project leader) has written that Snap is biased and has a conflict of interest. The reasons he cited include it being governed by Canonical and locked to their store, and also that Snap works better on Ubuntu than on other distributions. He later announced that the installing of Snap would be blocked by
APT
Apt. is an abbreviation for apartment.
Apt may also refer to:
Places
* Apt Cathedral, a former cathedral, and national monument of France, in the town of Apt in Provence
* Apt, Vaucluse, a commune of the Vaucluse département of France
* A ...
in Linux Mint, although a way to disable this restriction would be documented.
See also
*
AppImage
*
Flatpak
*
Nix
Nix or NIX may refer to:
Places
* Nix, Alabama, an unincorporated community, United States
* Nix, Texas, a ghost town in southwestern Lampasas County, Texas, United States
* Nix (moon), a moon of Pluto
People
* Nix (surname), listing people with ...
*
Portable application creators
*
ROX uses directories (
AppDirs) as application bundles.
*
Zero Install, a similar project
*
List of Linux package management systems
This is a list of notable software package management systems, categorized first by package format (binary, source code, hybrid) and then by operating system family.
Binary packages
The following package management systems distribute apps in binar ...
References
External links
Official websiteA technical comparison between snaps and debs
{{Linux package management systems
Free software
Linux installation software
Linux package management-related software
Operating system technology
Package management systems
Software distribution
Ubuntu