snap_package_manager

Snap Package Manager

Installing

Snap Commands

Snap

snap: The snap command lets you install snaps, configure snaps, refresh snaps and remove snaps.

Snaps are Linux packages that work across many different Linux distributions, enabling secure delivery and operation of the latest Linux apps and Linux utilities.

Usage: snap <command> [<options>…]

Commands can be classified as follows:

Basics

History

Daemons

Commands

Configuration

Account

Permissions

Snapshots

Other

Development

Snap development:

For more information about a command, run 'snap help <command>'.

For a short summary of all snap commands, run 'snap help --all'.

Install

Refresh

Remove

Version

Fair Use Source: https://snapcraft.io

Snap packages have become increasingly popular since they provide an easy way to install software on any Linux distribution. This a brief overview of the Snap package format.

NOTE TO ARCH USERS: When I installed snapd I meant to mention this. If 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.

$ systemctl enable –now apparmor.service $ systemctl enable –now snapd.apparmor.service

<ref name=“:6” />

}}

Snap is a software packaging and deployment system developed by Canonical for the Linux operating system. The packages, called snaps, and the tool for using them, snapd, work across a range of Linux distributions 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<ref name=“:6”>

</ref> but was later ported to work for Internet of Things devices<ref>

</ref><ref>

</ref> and desktop<ref>

</ref><ref>

</ref> applications too.

Functionality

Snap Store

The Snap Store allows developers to publish their applications directly to users.<ref name=“:1”>

</ref> With traditional Linux package management approaches like APT or YUM, the applications are packaged and distributed as part of the operating system. This creates a delay between application development and its deployment for end-users.<ref name=“:2”>Upgrading packaged Ubuntu application unreasonably involves upgrading entire OS Bug #578045 on bugs.launchpad.net/ubuntu by John King (2010-05-10)</ref><ref name=“:3”>Linus Torvalds on the problems of distro packaging Linus Torvalds on DebConf 2014</ref> In contrast, application developers can publish their applications in the Snap Store and get them directly to users without any intervention from distribution maintainers.

All apps uploaded to the Snap Store undergo automatic testing, including a malware scan. However, Snap apps do not receive the same level of verification as software in the regular Ubuntu archives. In one case in May 2018, two applications by the same developer were found to contain a cryptocurrency 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.<ref>

</ref><ref>

</ref><ref name=“:4”>

</ref> Although the Snap sandbox reduces the impact of a malicious app, Canonical recommends users only install Snaps from publishers trusted by the user.<ref>

</ref><ref>

</ref>

Because packages in the Snap Store are maintained by developers themselves, distribution maintainers cannot ensure packages meet quality standards and are timely updated. In one case, Microsoft left an outdated version of Skype in the Snapcraft store for over a year.<ref>

</ref>

Although the Snap Store by Canonical is currently the only existing store for snaps, Snap itself can be used without a store. Snap packages can be obtained from any source, including the website of a developer. Red Hat employee Adam Williamson and Linux Mint project lead Clement Lefebre have criticized Canonical for keeping some server side parts of the Snap Store closed-source.<ref>

</ref> Clement states that this creates a conflict of interest which harms the neutrality of Snap given that Canonical develops Ubuntu.<ref>

</ref>

Universal Linux packages

Snaps are self-contained packages that work across a range of Linux distributions. This is unlike traditional Linux package management approaches, which require specifically adapted packages for each Linux distribution.<ref>

</ref><ref>

</ref>

The snap file format 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 for that application. After installation, the snap is mounted by the host operating system and decompressed on the fly when the files are used.<ref>

</ref><ref name=“:5”>

</ref> Although this has the advantage that snaps use less disk space, it also means some large applications start slower.<ref>

</ref>

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.<ref name=“:1” /><ref>

</ref><ref>

</ref> As a result of this, Snap relies on systemd for features such as running socket-activated system services in a Snap.<ref>

</ref> This causes Snap to only work on distributions that use this init system.<ref>

</ref>

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

Snapcraft documentation|url=https://snapcraft.io/docs/supported-interfaces|access-date=2020-08-05|website=Snapcraft|language=en}}</ref><ref>

</ref><ref>

</ref> These interfaces mediate regular Linux API's 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.<ref>

</ref><ref>

</ref> These portals often provide a better user experience compared to the native Linux API's because they prompt the user for permission to 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 API's.

The Snap sandbox also supports sharing data and Unix sockets between Snaps.<ref>

</ref> This is often used to share common libraries and application frameworks between Snaps to reduce the size of Snaps by avoiding duplication.<ref>

</ref><ref>

</ref>

The Snap sandbox heavily relies on the AppArmor Linux Security Module from the upstream Linux kernel. Because only one Linux Security Module (LSM) can be active at the same time, the Snap sandbox is much less secure when another LSM is enabled. As a result, on distributions such as Fedora 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 LSM's to run at the same time, this solution is still a long time away.<ref>

</ref><ref>

</ref><ref>

</ref>

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

</ref> but some themes are not supported yet<ref>

ORDINATECHNIC|url=https://www.ordinatechnic.com/distribution-reviews/Kubuntu/kubuntu-2004-lts-review|access-date=2020-07-19|website=www.ordinatechnic.com}}</ref> 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.<ref>

</ref> Work is ongoing to make it easier for third parties to package themes in a Snap and to automatically install uncommon system themes.<ref>

</ref>

Automatic and atomic updates

Multiple times a day, snapd checks for available updates of all Snaps and installs them in the background using atomic operation. Updates can be reverted<ref>

</ref><ref>

</ref> and use delta encoding to reduce their download size.<ref name=“:0”>

</ref><ref>

</ref><ref>

</ref>

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

</ref><ref>

</ref><ref>

</ref><ref name=“:5” />

Although automatic updates cannot be turned off, there are many ways to configure updates to suit particular needs. User can choose to remain on a specific major version of the software by specifying the channel, they can configure the update interval to have time to manually check updates, and they can hold updates for up to 60 days. In addition, updates are also automatically disabled on metered connections.<ref>

</ref><ref>

</ref> Even with these controls, a number of users have voiced their complaints about the lack of an option to turn automatic updates completely off.<ref>

</ref>

Snapcraft

<ref name=“:6” />

}}

Snapcraft is a tool for developers to package their programs in the Snap format.<ref>

</ref> It runs on any Linux distribution supported by Snap, macOS<ref name=“:7” /> and Microsoft Windows.<ref>

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

</ref> Snapcraft supports a great number of 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.<ref name=“:7”>

</ref><ref>

Snapcraft documentation|url=https://snapcraft.io/docs/using-external-metadata|access-date=2020-08-05|website=Snapcraft|language=en}}</ref>

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

</ref> Snap requires functionality (systemd), available in Linux, some other Unix-like systems do not have, so e.g. FreeBSD doesn't have Snap. Chrome OS doesn't support Snap directly, only through Linux distros installed in it that suppport Snap, such as Gallium OS.<ref>

Snapcraft documentation|url=https://snapcraft.io/docs/installing-snap-on-galliumos|access-date=2020-08-18|website=Snapcraft|language=en}}</ref>

A number of Linux distributions support Snap out of the box such as Ubuntu (and e.g. Kubuntu),<ref>

|date=2016-04-18|title=Ubuntu 16.04 will support 'Snaps' alongside Deb packages for improved software installation|url=https://www.pcworld.com/article/3056668/ubuntu-1604-will-support-snaps-alongside-deb-packages-for-improved-software-installation.html|access-date=2020-08-08|website=PCWorld|language=en}}</ref> Manjaro,<ref>

</ref> Zorin OS,<ref>

The official Zorin Blog|url=https://zoringroup.com/blog/2019/03/20/and-the-next-version-of-zorin-os-is/|access-date=2020-08-05|language=en-US}}</ref> KDE Neon,<ref>

</ref> Solus<ref>

</ref> and Li-f-e.<ref>

Enterprise|language=en}}</ref> Snap is also available for many other distributions such as Arch Linux, CentOS, Debian, Elementary OS, Fedora, GalliumOS, Kali Linux, Linux Mint, OpenEmbedded, Parrot Security OS, Pop!_OS, Raspbian, Red Hat Enterprise Linux and openSUSE.<ref>

Snapcraft documentation|url=https://snapcraft.io/docs/installing-snapd|access-date=2020-08-05|website=Snapcraft|language=en}}</ref>

A number of notable Desktop software development companies publish their software in the Snap Store, including Google,<ref>

</ref> JetBrains,<ref>

JetBrains|url=https://blog.jetbrains.com/idea/2017/11/install-intellij-idea-with-snaps/|access-date=2020-08-05|website=JetBrains Blog|language=en-US}}</ref> KDE,<ref>

</ref> Microsoft (for Linux versions of e.g. .NET Core 3.1,<ref>

</ref> Visual Studio Code, Skype,<ref>

</ref> and PowerShell), Mozilla<ref>

|date=2016-04-25|title=Mozilla will provide Firefox as a Snap package for Ubuntu, cutting out the middleman|url=https://www.pcworld.com/article/3060143/mozilla-will-provide-firefox-as-a-snap-package-for-ubuntu-cutting-out-the-middleman.html|access-date=2020-08-05|website=PCWorld|language=en}}</ref> and Spotify.<ref>

</ref> Snaps are also used in Internet-of-Things environments, ranging from consumer-facing products<ref>

</ref> to enterprise device management gateways<ref>

</ref> and satellite communication networks.<ref>

</ref><ref>

</ref> Finally, Snap is also used by developers of server applications such as InfluxDB,<ref>

</ref> Kata Containers,<ref>

</ref> Nextcloud<ref>

</ref> and Travis CI.<ref>

</ref>

In 2019, Canonical decided to switch the Chromium web browser 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.<ref>

</ref><ref name=“:1” /> 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. Clement Lefebre, Linux Mint founder and project leader,<ref>

</ref> cited this as the reason why Linux Mint 20 blocks users from installing Snap.<ref>

</ref> Since Snap is still available in the Linux Mint repositories, users can still install it after manually removing the restrictions.<ref>

</ref>

GNOME Software removed Snap support in July of 2019, due to code quality issues, lack of integration (specifically, that the user can't tell what Snap is doing after they click “install” and that it generally ignores GNOME's settings), and the fact that it competes with the GNOME-supported Flatpak standard.<ref>

</ref> This doesn't mean Snaps can't be installed in Fedora or other GNOME Software using distributions, only that Snap needs to be installed first. Ubuntu also used GNOME Software up to Ubuntu 20.04, and vice versa, there Flatpak support can be added.

See also

References

YouTube Videos

Cloud Monk recommends the following YouTube video:

GitHub Tags

External Sites

Main

Interesting Articles

Support Resources, FAQs, Q&A, Docs, Blogs

Search Engines

Repos and Registries

Courses

Books

Vidcasts-Podcasts

snap_package_manager.txt · Last modified: 2020/11/20 01:13 (external edit)

Page Tools