Software:Snap

From HandWiki
Short description: Software deployment system for Linux by Canonical
Snap
Snapcraft Logo
Written inGo, C, Shell script, Python, JavaScript, NASL[1]
Operating systemLinux
LicenseGNU 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

Snap Store

The Snap Store allows developers to publish their snap-packaged applications.[9] 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.[10][11][12] Although the Snap sandbox reduces the impact of a malicious app, Canonical recommends users only install Snaps from publishers trusted by the user.[13][14]

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.[15][16]

The command snap list here shows that Skype and IntelliJ IDEA have been installed

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

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

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.[25][26][27] 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.[28][29] 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.[30] This is often used to share common libraries and application frameworks between Snaps to reduce the size of Snaps by avoiding duplication.[31][32]

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,[33] 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.[34][33][35]

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

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[40][41] and use delta encoding to reduce their download size.[42][43][44]

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.[45][46][47][18]

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.[48][49][50] Updates are automatically paused on metered connections.[51][52]

Snapcraft

Snapcraft
Snapcraft Logo
Repositorygithub.com/snapcore/snapcraft
Written inPython, Shell script, C++, Go, Dart[53]
Operating systemLinux

Snapcraft is a tool for developers to package their programs in the Snap format.[54] It runs on any Linux distribution supported by Snap, macOS[55] and Microsoft Windows.[56] Snapcraft builds the packages in a Virtual Machine using Multipass,[57] in order to ensure the result of a build is the same, regardless of which distribution or operating system it is built on.[58] 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.[55][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, Canonical will prohibit them from doing 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,[70] Visual Studio Code, Skype,[71] and PowerShell), Mozilla[72] and Spotify.[73] Snaps are also used in Internet-of-Things environments, ranging from consumer-facing products[74] to enterprise device management gateways[75] and satellite communication networks.[76][77] Finally, Snap is also used by developers of server applications such as InfluxDB,[78] Kata Containers,[79] Nextcloud[80] and Travis CI.[81]

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

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

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

See also

References

  1. "snapcore · GitHub". https://github.com/snapcore/. 
  2. "What's The Deal With Snap Packages?". 24 June 2020. https://hackaday.com/2020/06/24/whats-the-deal-with-snap-packages. 
  3. "snapd package versions - Repology". https://repology.org/project/snapd/versions. 
  4. Shuttleworth, Mark (9 December 2014). "Announcing Ubuntu Core, with snappy transactional updates!". https://www.markshuttleworth.com/archives/1434. 
  5. Willis, Nathan (2015-01-28). "Ubuntu Core and Snappy". https://lwn.net/Articles/630660/. 
  6. "Canonical unveils Snappy Ubuntu Core, a lightweight operating system for your home - ExtremeTech". https://www.extremetech.com/mobile/197801-canonical-unveils-snappy-ubuntu-core-a-lightweight-operating-system-for-your-home. 
  7. Bhartiya, Swapnil (2015-04-27). "Is Ubuntu moving away from .deb packages? Here is the complete story" (in en). https://www.cio.com/article/2914850/is-ubuntu-moving-away-from-deb-packages-here-is-the-complete-story.html. 
  8. Vaughan-Nichols, Steven J.. "The future of Linux desktop application delivery is Flatpak and Snap" (in en). https://www.zdnet.com/article/the-future-of-linux-desktop-application-delivery-is-flatpak-and-snap/. 
  9. 9.0 9.1 9.2 Sanders, James (August 6, 2019). "Why Canonical views the Snap ecosystem as a compelling distribution-agnostic solution" (in en). https://www.techrepublic.com/article/why-canonical-views-the-snap-ecosystem-as-a-compelling-distribution-agnostic-solution/. 
  10. "How Canonical Is Improving Ubuntu Linux Security". 29 August 2018. https://www.eweek.com/security/how-canonical-is-improving-ubuntu-linux-security. 
  11. "Malware Found on the Ubuntu Snap Store" (in en-GB). 2018-05-13. https://www.omgubuntu.co.uk/2018/05/ubuntu-snap-malware. 
  12. "Trust and security in the Snap Store" (in en). 2018-05-15. https://snapcraft.io/blog/trust-and-security-in-the-snap-store. 
  13. "Packages for Ubuntu" (in en). https://ubuntu.com/about/packages. 
  14. "Bogus apps in store" (in en-US). 2018-03-27. https://forum.snapcraft.io/t/bogus-apps-in-store/4703/9. 
  15. Wallen, Jack (June 21, 2016). "Canonical changes the game by announcing universal snap packages" (in en). https://www.techrepublic.com/article/canonical-changes-the-game-by-announcing-universal-snap-packages/. 
  16. Kepes, Ben (2016-06-14). "Snap! Do the Linux distros finally agree on something?" (in en). https://www.computerworld.com/article/3082766/snap-do-the-linux-distros-finally-agree-on-something.html. 
  17. "A technical comparison between the snap and the Flatpak formats" (in en-US). 2019-11-14. https://readyspace.co.id/en/a-technical-comparison-between-the-snap-and-the-flatpak-formats/. [yes|permanent dead link|dead link}}]
  18. 18.0 18.1 McKay, Dave. "How to Work with Snap Packages on Linux" (in en-US). https://www.howtogeek.com/660193/how-to-work-with-snap-packages-on-linux/. 
  19. "Squashfs performance effect on snap startup time" (in en-US). 2019-10-29. https://forum.snapcraft.io/t/squashfs-performance-effect-on-snap-startup-time/13920. 
  20. McKay, Dave. "What You Need to Know About Snaps on Ubuntu 20.04" (in en-US). https://www.howtogeek.com/670084/what-you-need-to-know-about-snaps-on-ubuntu-20.04/. 
  21. "Call for testing: OpenPrinting's printing-stack-snap (Printing in a Snap)" (in en-US). 2018-03-09. https://forum.snapcraft.io/t/call-for-testing-openprintings-printing-stack-snap-printing-in-a-snap/4406. 
  22. "Canonical unveils 6th LTS release of Ubuntu with 16.04". Canonical Ltd.. https://insights.ubuntu.com/2016/04/20/canonical-unveils-6th-lts-release-of-ubuntu-with-16-04/. 
  23. "Services and daemons". https://snapcraft.io/docs/services-and-daemons. 
  24. "WSL2- Ubuntu 20.04 Snap store doesn't work due to systemd dependency · Issue #5126 · microsoft/WSL" (in en). https://github.com/microsoft/WSL/issues/5126. 
  25. "Supported interfaces | Snapcraft documentation" (in en). https://snapcraft.io/docs/supported-interfaces. 
  26. "Snapcraft confinement & interfaces" (in zh-hans). 2019-06-06. https://readyspace.com.cn/snapcraft-confinement-interfaces/. 
  27. "A guide to snap permissions and interfaces" (in en-US). 2018-11-02. https://readyspace.com.hk/a-guide-to-snap-permissions-and-interfaces/. 
  28. "Flatpak's XDG-Desktop-Portal Adds Initial Support For Snaps - Phoronix". https://www.phoronix.com/scan.php?page=news_item&px=XDG-Desktop-Portal-Snapped. 
  29. "Desktop Integration — Flatpak documentation". https://docs.flatpak.org/en/latest/desktop-integration.html?highlight=portals#portals. 
  30. "The content interface" (in en). https://snapcraft.io/docs/content-interface. 
  31. "Snappy Is Finally Doing Something About Super Large App Sizes" (in en-GB). 2017-06-11. https://www.omgubuntu.co.uk/2017/06/gnome-platform-snap-development. 
  32. "Bundling KDE" (in en). https://archive.fosdem.org/2017/schedule/event/desktops_bundling_kde/. 
  33. 33.0 33.1 Edge, Jake (2019-11-20). "LSM stacking and the future". https://lwn.net/Articles/804906/. 
  34. "How Are SNAPS claiming to have no internet plug regulated?" (in en-US). 2020-07-11. https://forum.snapcraft.io/t/how-are-snaps-claiming-to-have-no-internet-plug-regulated/18755/25. 
  35. Johansen, John (3 February 2019). "Containers with Different Security Modules". https://archive.fosdem.org/2019/schedule/event/containers_lsm/. 
  36. "How to use the system GTK theme via the gtk-common-themes snap" (in en-US). 2020-02-21. https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235. 
  37. "Kubuntu 20.04 LTS Review | ORDINATECHNIC". https://www.ordinatechnic.com/distribution-reviews/Kubuntu/kubuntu-2004-lts-review. 
  38. "How to Change Snap App Theme on Ubuntu (With Examples)" (in en-GB). 2020-06-18. https://www.omgubuntu.co.uk/2020/06/change-snap-app-theme. 
  39. "Automatic theme snap installation notes" (in en-US). 2020-05-25. https://forum.snapcraft.io/t/automatic-theme-snap-installation-notes/14274/4. 
  40. "How to revert to a previous version of a snap package? wekan in this case" (in en-us). 2017-03-08. https://costales.github.io/posts/how-to-revert-to-previous-version-of/. 
  41. "A Beginners Guide to Snaps in Linux - Part 1" (in en-US). 5 June 2020. https://www.tecmint.com/install-snap-in-linux/. 
  42. "Snapcraft - Snaps are universal Linux packages". https://snapcraft.io/. 
  43. Willis, Nathan (28 January 2015). "Ubuntu Core and Snappy". Linux Weekly News. https://lwn.net/Articles/630660/. 
  44. Vaughan-Nichols, Steven J.. "Ubuntu Snap takes charge of Linux desktop and IoT software distribution". https://zdnet.com/article/ubuntu-snap-takes-charge-of-linux-desktop-and-iot-software-distribution/. 
  45. "Controlling snap releases with channels, tracks and branches – Part 1" (in en). https://ubuntu.com/blog/controlling-snap-releases-with-channels-tracks-and-branches-part-1. 
  46. "Controlling snap releases with channels, tracks and branches – Part 2" (in en). https://ubuntu.com/blog/controlling-snap-releases-with-channels-tracks-and-branches-part-2. 
  47. Prakash, Abhishek (23 April 2016). "Using Snap Packages In Ubuntu & Other Linux [Complete Guide"] (in en-US). https://itsfoss.com/use-snap-packages-ubuntu-16-04/. 
  48. Ljubuncic, Igor (2022-11-15). "Hold your horses, I mean snaps! New feature lets you stop snap updates, for as long as you need" (in en). https://snapcraft.io/blog/hold-your-horses-i-mean-snaps-new-feature-lets-you-stop-snap-updates-for-as-long-as-you-need. 
  49. "You can finally disable Snap updates" (in en). 2022-11-10. https://merlijn.sebrechts.be/blog/2022-11-10-turn-off-snap-updates/. 
  50. "Ubuntu snap updates will soon be able to be held temporarily and indefinitely" (in en). https://www.neowin.net/news/ubuntu-snap-updates-will-soon-be-able-to-be-held-temporarily-and-indefinitely/. 
  51. "How To Change Snap Refresh (Update) Schedule" (in en-us). https://www.linuxuprising.com/2019/07/how-to-change-snap-refresh-update.html. 
  52. Pope, Alan (3 March 2020). "Controlling Snap Updates". https://www.youtube.com/watch?v=gVZOBgTDJWc. 
  53. "GitHub - snapcore/snapcraft: Package, distribute, and update any app for Linux and IoT.". https://github.com/snapcore/snapcraft. 
  54. Brodkin, Jon. "Adios apt and yum? Ubuntu's snap apps are coming to distros everywhere". Ars Technica. https://arstechnica.com/information-technology/2016/06/goodbye-apt-and-yum-ubuntus-snap-apps-are-coming-to-distros-everywhere/. 
  55. 55.0 55.1 Nestor, Marius (30 January 2019). "Canonical Releases Snapcraft 3.1 Snap Creator Tool with Various Improvements" (in en). https://news.softpedia.com/news/canonical-releases-snapcraft-3-1-snap-creator-tool-with-various-improvements-524761.shtml. 
  56. Nestor, Marius (10 September 2019). "Ubuntu's Snapcraft Snap Creator Tool Will Soon Get a Windows Installer" (in en). https://news.softpedia.com/news/ubuntu-s-snapcraft-snap-creator-tool-will-soon-get-a-windows-installer-527336.shtml. 
  57. "Build options | Snapcraft documentation". https://snapcraft.io/docs/build-options. 
  58. "Make your snap development faster" (in zh-hans). 2019-03-15. https://readyspace.com.cn/make-your-snap-development-faster/. 
  59. "Using external metadata | Snapcraft documentation" (in en). https://snapcraft.io/docs/using-external-metadata. 
  60. Lunden, Ingrid (14 June 2016). "Ubuntu's container-style Snap app packages now work on other Linux distributions" (in en-US). https://techcrunch.com/2016/06/14/ubuntus-container-style-snap-app-packages-now-work-on-other-linux-distributions/. 
  61. "Installing snapd | Snapcraft documentation" (in en). https://snapcraft.io/docs/installing-snapd. 
  62. "Installing snap on GalliumOS | Snapcraft documentation" (in en). https://snapcraft.io/docs/installing-snap-on-galliumos. 
  63. "Installing snapd | Snapcraft documentation" (in en). https://snapcraft.io/docs/installing-snapd. 
  64. "Snap deprecation issue" (in en). https://github.com/getsolus/packages/issues/325. 
  65. "Zorin community manager express the plan to remove Snap as default package" (in en). https://forum.zorin.com/t/packaging-formats-and-their-use-in-zorin-os/31972/16. 
  66. "Ubuntu Flavors/Spins Will No Longer Be Able To Install Flatpak By Default" (in en). https://www.phoronix.com/news/Ubuntu-No-Flatpak-By-Default. 
  67. "Google and Canonical bring Flutter apps to Linux and the Snap Store" (in en-US). 2020-07-08. https://venturebeat.com/2020/07/08/google-canonical-ubuntu-flutter-apps-linux-support/. 
  68. "Install IntelliJ IDEA on Ubuntu with Snaps – IntelliJ IDEA Blog | JetBrains" (in en-US). https://blog.jetbrains.com/idea/2017/11/install-intellij-idea-with-snaps/. 
  69. "Month of KDE Applications Snaps – KDE neon Developers' Blog" (in en-US). https://blog.neon.kde.org/index.php/2019/02/13/month-of-kde-applications-snaps/. 
  70. .NET Core 3.1.0 Preview 2, .NET Foundation, 2019-11-08, https://github.com/dotnet/core/blob/master/release-notes/3.1/preview/3.1.0-preview2-install-instructions.md, retrieved 2019-11-08 
  71. Vaughan-Nichols, Steven J.. "Use Ubuntu's snap to install Skype on any Linux desktop" (in en). https://www.zdnet.com/article/use-ubuntus-snap-to-install-skype-on-any-linux-desktop/. 
  72. Hoffman, Chris (2016-04-25). "Mozilla will provide Firefox as a Snap package for Ubuntu, cutting out the middleman" (in en). https://www.pcworld.com/article/3060143/mozilla-will-provide-firefox-as-a-snap-package-for-ubuntu-cutting-out-the-middleman.html. 
  73. "Spotify Now Available as a Snap App on Ubuntu" (in en-GB). 2017-12-30. https://www.omgubuntu.co.uk/2017/12/spotify-now-available-snap-app-ubuntu. 
  74. Vaughan-Nichols, Stephen J. (11 May 2015). "Ubuntu jumps into Internet of Things with Acer, GE, and Microsoft". ZDNet. https://www.zdnet.com/article/ubuntu-jumps-into-internet-of-things-with-acer-ge-and-microsoft/. 
  75. Sherman, Jordana. "Snappy Core unlocks IoT value within the Dell Edge Gateway 5000 Series". Canonical Ltd.. https://insights.ubuntu.com/2015/10/21/snappy-core-unlocks-iot-value-within-the-dell-edge-gateway-5000-series/. 
  76. "LimeSDR Mini takes off in satellites". 2018-03-14. http://linuxgizmos.com/limesdr-mini-takes-off-in-satellites/. 
  77. "Ubuntu Core 18 released for secure, reliable IoT devices" (in en). https://ubuntu.com/blog/ubuntu-core-18-released-for-secure-reliable-iot-devices. 
  78. "Install influxdb for Linux using the Snap Store" (in en). https://snapcraft.io/influxdb. 
  79. Nestor, Marius (27 July 2018). "You Can Now Install Kata Containers VM as a Snap on Ubuntu, Other Linux Distros" (in en). https://news.softpedia.com/news/you-can-now-install-kata-containers-as-a-snap-on-ubuntu-and-other-linux-distros-522138.shtml. 
  80. Wallen, Jack (April 27, 2020). "How to install Nextcloud with SSL using snap" (in en). https://www.techrepublic.com/article/how-to-install-nextcloud-with-ssl-using-snap/. 
  81. "Install travis-worker for Linux using the Snap Store" (in en). https://snapcraft.io/travis-worker. 
  82. "SnapCraft homepage". https://snapcraft.io/. 
  83. "Q&A: Clement Lefebvre: The man behind Linux Mint". 21 October 2013. https://www.computerworld.com/article/2830308/q-a--clement-lefebvre--the-man-behind-linux-mint.html. 
  84. "Teams". https://linuxmint.com/teams.php. 
  85. "Monthly News – June 2019". https://blog.linuxmint.com/?p=3766. 
  86. Lefèbvre, Clément. "Monthly News – May 2020". The Mint Team. https://blog.linuxmint.com/?p=3906. Retrieved 10 June 2020. 
  87. "Linux Mint dumps Ubuntu Snap" (in en). https://www.zdnet.com/article/linux-mint-dumps-ubuntu-snap/. 
  88. Anderson, Tim (2 June 2020). "Snapping at Canonical's Snap: Linux Mint team says no to Ubuntu store 'backdoor'". The Register (Situation Publishing). https://www.theregister.com/2020/06/02/linux_mint_team_snap/. Retrieved 10 June 2020. 
  89. 89.0 89.1 "Canonical Continues Working On Ubuntu's Firefox Snap Performance" (in en). https://www.phoronix.com/news/Firefox-Snap-Performance-2. 
  90. Vaughan-Nichols, Steven J.. "Ubuntu opens the door to talking with Linux Mint about Snap" (in en). https://www.zdnet.com/article/ubuntu-opens-the-door-to-talking-with-linux-mint-about-snap/. 

External links