Snap (software) explained

Snap
Logo Alt:Snapcraft Logo
Programming Language:Go, C, Shell script, Python, JavaScript, NASL[1]
Operating System:Linux
License:GNU GPLv3 (Client & Runtime), proprietary (Backend)[2]

Snap is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel and the systemd init system. The packages, called snaps, and the tool for using them, snapd, work across a range of Linux distributions[3] 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[4] but was later ported to also work for Internet of Things devices[5] [6] and desktop[7] [8] applications.

Functionality

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.[9] [10] [11] 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.[12] [13] 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.[14] This is often used to share common libraries and application frameworks between Snaps to reduce the size of Snaps by avoiding duplication.[15] [16]

The Snap sandbox heavily relies on the AppArmor Linux Security Module from the upstream Linux kernel. Because only one "major" Linux Security Module (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 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.[17] [18] [19]

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[20] but some themes are not supported yet[21] 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.[22] Work is ongoing to make it easier for third parties to package themes in a Snap and to automatically install uncommon system themes.[23]

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[24] [25] and use delta encoding to reduce their download size.[26] [27] [28]

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.[29] [30] [31] [32]

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:00Users can also pause automatic updates for a certain period of time, or indefinitely.[33] [34] [35] Updates are automatically paused on metered connections.[36] [37]

Snapcraft

Snapcraft
Logo Alt:Snapcraft Logo
Repo:github.com/snapcore/snapcraft
Programming Language:Python, Shell script, C++, Go, Dart[38]
Operating System:Linux

Snapcraft is a tool for developers to package their programs in the Snap format.[39] It runs on any Linux distribution supported by Snap, macOS and Microsoft Windows.[40] Snapcraft builds the packages in a Virtual Machine using Multipass,[41] in order to ensure the result of a build is the same, regardless of which distribution or operating system it is built on.[42] 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.[43] [44]

Snap Store

The Snap Store allows developers to publish their snap-packaged applications.[45] All apps uploaded to the Snap Store undergo automatic testing, including a malware 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 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.[46] [47] [48] Although the Snap sandbox reduces the impact of a malicious app, Canonical recommends users only install Snaps from publishers trusted by the user.[49] [50]

Support

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.[51] [52]

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.[53] Although this has the advantage that snaps use less disk space, it also means some large applications start more slowly.[54] [55]

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.[56] [57] To ensure this, Snap relies on systemd for features such as running socket-activated system services in a Snap.[58] This causes Snap to work best only on distributions that can adopt that init system.[59]

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.[60] Snap requires Systemd which is available in most, but not all, Linux distributions. Other Unix-like systems (e.g. FreeBSD) are not supported.[61] ChromeOS does not support Snap directly, only through Linux distributions installed in it that support Snap, such as Gallium OS.[62]

Ubuntu and its official derivatives pre-install Snap by default, as well as other Ubuntu-based distributions such as KDE Neon, Solus, and Zorin OS.[63] Solus have currently planned to drop Snap, to reduce the burden of maintaining AppArmor patches needed for strict Snap confinement.[64] Zorin OS have removed Snap as a default package in the Zorin OS 17 release.[65] While other official Ubuntu derivatives such as Kubuntu, Xubuntu, and Ubuntu MATE have also shipped with the competing Flatpak as a complement, they will no longer do so beginning with Ubuntu 23.04, meaning that it must be installed manually by the user.[66]

A number of notable desktop software development companies publish their software in the Snap Store, including Google,[67] JetBrains,[68] KDE,[69] Microsoft (for Linux versions of e.g. .NET Core 3.1, Visual Studio Code, Skype,[70] and PowerShell), Mozilla[71] and Spotify.[72] Snaps are also used in Internet-of-Things environments, ranging from consumer-facing products[73] to enterprise device management gateways[74] and satellite communication networks.[75] [76] Finally, Snap is also used by developers of server applications such as InfluxDB,[77] Kata Containers,[78] Nextcloud[79] and Travis CI.[80]

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.[81]

Others have objected to the closed-source nature of the Snap Store. Clément Lefèbvre (Linux Mint founder and project leader[82] [83]) 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.[84] He later announced that the installing of Snap would be blocked by APT in Linux Mint,[85] [86] although a way to disable this restriction would be documented.[87]

On recent versions of Ubuntu, Canonical has migrated certain packages exclusively to Snap, such as Chromium and Firefox[88] web browsers.[89] The replacement of Firefox led to mixed reception from users due to performance issues with the Snap version, especially on startup.

See also

External links

Notes and References

  1. Web site: snapcore · GitHub . GitHub . 5 November 2022.
  2. Web site: What's The Deal With Snap Packages?. 24 June 2020. 13 February 2023.
  3. Web site: snapd package versions - Repology . Repology . 20 August 2021.
  4. Web site: Shuttleworth. Mark. 9 December 2014. Announcing Ubuntu Core, with snappy transactional updates!. 2020-08-07.
  5. Web site: Ubuntu Core and Snappy. Willis . Nathan . 2015-01-28. 2020-08-08. LWN.net.
  6. Web site: Canonical unveils Snappy Ubuntu Core, a lightweight operating system for your home - ExtremeTech. 2020-08-08. www.extremetech.com.
  7. Web site: Bhartiya. Swapnil. 2015-04-27. Is Ubuntu moving away from .deb packages? Here is the complete story. 2020-08-08. CIO. en.
  8. Web site: Vaughan-Nichols. Steven J.. The future of Linux desktop application delivery is Flatpak and Snap. 2020-08-08. ZDNet. en.
  9. Web site: Supported interfaces Snapcraft documentation. 2020-08-05. Snapcraft. en.
  10. Web site: 2019-06-06. Snapcraft confinement & interfaces. 2020-08-05. ReadySpace China. zh-hans. 2020-11-25. https://web.archive.org/web/20201125174521/https://readyspace.com.cn/snapcraft-confinement-interfaces/. dead.
  11. Web site: 2018-11-02. A guide to snap permissions and interfaces. 2020-08-05. ReadySpace Hong Kong. en-US. 2020-03-19. https://web.archive.org/web/20200319182537/https://readyspace.com.hk/a-guide-to-snap-permissions-and-interfaces/. dead.
  12. Web site: Flatpak's XDG-Desktop-Portal Adds Initial Support For Snaps - Phoronix. 2020-08-05. www.phoronix.com.
  13. Web site: Desktop Integration — Flatpak documentation. 2020-08-05. docs.flatpak.org.
  14. Web site: The content interface. 2020-04-29. Snapcraft. en.
  15. Web site: 2017-06-11. Snappy Is Finally Doing Something About Super Large App Sizes. 2020-08-07. OMG! Ubuntu!. en-GB.
  16. Web site: Bundling KDE. 2020-08-07. archive.fosdem.org. en.
  17. Web site: 2020-07-11. How Are SNAPS claiming to have no internet plug regulated?. 2020-08-06. snapcraft.io. en-US.
  18. Web site: LSM stacking and the future. Edge. Jake. 2019-11-20. 2020-08-06. LWN.net.
  19. Web site: Johansen. John. 3 February 2019. Containers with Different Security Modules.
  20. Web site: 2020-02-21. How to use the system GTK theme via the gtk-common-themes snap. 2020-08-06. snapcraft.io. en-US.
  21. Web site: Kubuntu 20.04 LTS Review ORDINATECHNIC. 2020-07-19. www.ordinatechnic.com.
  22. Web site: 2020-06-18. How to Change Snap App Theme on Ubuntu (With Examples). 2020-08-06. OMG! Ubuntu!. en-GB.
  23. Web site: 2020-05-25. Automatic theme snap installation notes. 2020-08-06. snapcraft.io. en-US.
  24. Web site: 2017-03-08. How to revert to a previous version of a snap package? wekan in this case. 2020-08-05. costales.github.io. en-us.
  25. Web site: A Beginners Guide to Snaps in Linux - Part 1. 2020-08-05. www.tecmint.com. 5 June 2020 . en-US.
  26. Web site: Snapcraft - Snaps are universal Linux packages. Snapcraft.
  27. News: Willis. Nathan. 28 January 2015. Ubuntu Core and Snappy. Linux Weekly News. 7 November 2015.
  28. Web site: Vaughan-Nichols. Steven J.. Ubuntu Snap takes charge of Linux desktop and IoT software distribution. ZDNet.
  29. Web site: Controlling snap releases with channels, tracks and branches – Part 1. 2020-08-07. Ubuntu. en.
  30. Web site: Controlling snap releases with channels, tracks and branches – Part 2. 2020-08-07. Ubuntu. en.
  31. Web site: Prakash. Abhishek. Using Snap Packages In Ubuntu & Other Linux [Complete Guide]]. 23 April 2016 . 2020-08-07. en-US.
  32. Web site: McKay . Dave . How to Work with Snap Packages on Linux . 2020-08-05 . How-To Geek . 18 March 2020 . en-US.
  33. Web site: Ljubuncic . Igor . 2022-11-15 . Hold your horses, I mean snaps! New feature lets you stop snap updates, for as long as you need . 2022-12-02 . Snapcraft . en.
  34. Web site: 2022-11-10 . You can finally disable Snap updates . 2022-12-02 . merlijn.sebrechts.be . en.
  35. Web site: Ubuntu snap updates will soon be able to be held temporarily and indefinitely . 2022-12-02 . Neowin . en.
  36. Web site: How To Change Snap Refresh (Update) Schedule. 2020-08-07. Linux Uprising Blog. 17 July 2019 . en-us.
  37. Web site: Pope. Alan. 3 March 2020. Controlling Snap Updates. YouTube.
  38. Web site: GitHub - snapcore/snapcraft: Package, distribute, and update any app for Linux and IoT. . GitHub . 5 November 2022.
  39. News: Brodkin. Jon. Adios apt and yum? Ubuntu's snap apps are coming to distros everywhere. 13 August 2016. Ars Technica.
  40. Web site: Nestor. Marius. Ubuntu's Snapcraft Snap Creator Tool Will Soon Get a Windows Installer. 2020-08-08. softpedia. 10 September 2019. en.
  41. Web site: Build options | Snapcraft documentation.
  42. Web site: 2019-03-15. Make your snap development faster. 2020-08-05. ReadySpace China. zh-hans. 2021-06-28. https://web.archive.org/web/20210628133641/https://readyspace.com.cn/make-your-snap-development-faster/. dead.
  43. Web site: Nestor. Marius. Canonical Releases Snapcraft 3.1 Snap Creator Tool with Various Improvements. 2020-08-05. softpedia. 30 January 2019. en.
  44. Web site: Using external metadata Snapcraft documentation. 2020-08-05. Snapcraft. en.
  45. Web site: Sanders . James . August 6, 2019 . Why Canonical views the Snap ecosystem as a compelling distribution-agnostic solution . 2020-08-05 . TechRepublic . en.
  46. Web site: 29 August 2018 . How Canonical Is Improving Ubuntu Linux Security . 2020-08-08 . eWEEK.
  47. Web site: 2018-05-13 . Malware Found on the Ubuntu Snap Store . 2020-07-19 . OMG! Ubuntu! . en-GB.
  48. Web site: 2018-05-15 . Trust and security in the Snap Store . 2020-08-05 . Snapcraft . en.
  49. Web site: Packages for Ubuntu . 2020-08-07 . Ubuntu . en.
  50. Web site: 2018-03-27 . Bogus apps in store . 2020-08-07 . snapcraft.io . en-US.
  51. Web site: Wallen . Jack . June 21, 2016 . Canonical changes the game by announcing universal snap packages . 2020-08-08 . TechRepublic . en.
  52. Web site: Kepes . Ben . 2016-06-14 . Snap! Do the Linux distros finally agree on something? . 2020-08-08 . Computerworld . en.
  53. Web site: 2019-11-14 . A technical comparison between the snap and the Flatpak formats . 2020-08-05 . ReadySpace Indonesia . en-US.
  54. Web site: 2019-10-29 . Squashfs performance effect on snap startup time . 2020-08-05 . snapcraft.io . en-US.
  55. Web site: McKay . Dave . What You Need to Know About Snaps on Ubuntu 20.04 . 2021-07-28 . How-To Geek . 30 April 2020 . en-US.
  56. Web site: 2018-03-09 . Call for testing: OpenPrinting's printing-stack-snap (Printing in a Snap) . 2020-08-05 . snapcraft.io . en-US.
  57. Web site: Canonical unveils 6th LTS release of Ubuntu with 16.04 . 22 April 2016 . Ubuntu Insights . Canonical Ltd..
  58. Web site: Services and daemons .
  59. Web site: WSL2- Ubuntu 20.04 Snap store doesn't work due to systemd dependency · Issue #5126 · microsoft/WSL . 2020-08-07 . GitHub . en.
  60. Web site: Lunden . Ingrid . 14 June 2016 . Ubuntu's container-style Snap app packages now work on other Linux distributions . 2020-08-08 . TechCrunch . en-US.
  61. Web site: Installing snapd Snapcraft documentation . 2022-04-25 . Snapcraft . en.
  62. Web site: Installing snap on GalliumOS Snapcraft documentation. 2020-08-18. Snapcraft. en.
  63. Web site: Installing snapd Snapcraft documentation . 2020-08-05 . Snapcraft . en.
  64. Web site: Snap deprecation issue . 2023-11-04 . GitHub . en.
  65. Web site: Zorin community manager express the plan to remove Snap as default package . 2023-12-13. Zorin Forum . 11 December 2023 . en.
  66. Web site: Ubuntu Flavors/Spins Will No Longer Be Able To Install Flatpak By Default . 2023-02-26 . www.phoronix.com . en.
  67. Web site: 2020-07-08. Google and Canonical bring Flutter apps to Linux and the Snap Store. 2020-08-05. VentureBeat. en-US.
  68. Web site: Install IntelliJ IDEA on Ubuntu with Snaps – IntelliJ IDEA Blog JetBrains. 2020-08-05. JetBrains Blog. 16 November 2017 . en-US.
  69. Web site: Month of KDE Applications Snaps – KDE neon Developers' Blog. 13 February 2019 . 2020-08-05. en-US.
  70. Web site: Vaughan-Nichols. Steven J.. Use Ubuntu's snap to install Skype on any Linux desktop. 2020-08-08. ZDNet. en.
  71. Web site: Hoffman. Chris. 2016-04-25. Mozilla will provide Firefox as a Snap package for Ubuntu, cutting out the middleman. 2020-08-05. PCWorld. en.
  72. Web site: 2017-12-30. Spotify Now Available as a Snap App on Ubuntu. 2020-08-05. OMG! Ubuntu!. en-GB.
  73. News: Ubuntu jumps into Internet of Things with Acer, GE, and Microsoft. 11 May 2015. ZDNet. sjvn-iot. Vaughan-Nichols. Stephen J.. 7 November 2015.
  74. Web site: Snappy Core unlocks IoT value within the Dell Edge Gateway 5000 Series. Ubuntu Insights. Canonical Ltd.. Sherman. Jordana. 7 November 2015.
  75. Web site: 2018-03-14. LimeSDR Mini takes off in satellites. 2020-08-05. LinuxGizmos.com.
  76. Web site: Ubuntu Core 18 released for secure, reliable IoT devices. 2020-08-05. Ubuntu. en.
  77. Web site: Install influxdb for Linux using the Snap Store. 2020-08-05. Snapcraft. en.
  78. Web site: Nestor. Marius. You Can Now Install Kata Containers VM as a Snap on Ubuntu, Other Linux Distros. 2020-08-05. softpedia. 27 July 2018. en.
  79. Web site: April 27, 2020. Jack . Wallen. How to install Nextcloud with SSL using snap. 2020-08-08. TechRepublic. en.
  80. Web site: Install travis-worker for Linux using the Snap Store. 2020-08-05. Snapcraft. en.
  81. Web site: SnapCraft homepage. snapcraft.io. July 23, 2021.
  82. Web site: Q&A: Clement Lefebvre: The man behind Linux Mint. computerworld.com. 21 October 2013 . May 31, 2023.
  83. Web site: Teams. linuxmint.com. January 7, 2020.
  84. Web site: Monthly News – June 2019. blog.linuxmint.com. 2 July 2019 . October 23, 2019.
  85. Web site: Lefèbvre . Clément . Monthly News – May 2020 . The Linux Mint Blog . June 2020 . The Mint Team . 10 June 2020.
  86. Web site: Linux Mint dumps Ubuntu Snap . 2022-12-03 . ZDNET . en.
  87. News: Anderson . Tim . Snapping at Canonical's Snap: Linux Mint team says no to Ubuntu store 'backdoor' . 10 June 2020 . The Register . Situation Publishing . 2 June 2020.
  88. Web site: Canonical Continues Working On Ubuntu's Firefox Snap Performance . 2023-02-26 . www.phoronix.com . en.
  89. Web site: Vaughan-Nichols . Steven J. . Ubuntu opens the door to talking with Linux Mint about Snap . 2020-08-08 . ZDNet . en.