SlideShare a Scribd company logo
Snap :
the universal packaging format for Linux distros
Anthony Wong Engineering Manager, Canonical
Shenzhen University, 2 June 2018
Why a new packaging format?
As a user
● I want applications that are easy to install, keep up-to-date and
secure.
As a developer/publisher
● I want an easy and fast way to distribute my software for different
Linux distributions.
Snap - the universal packaging format for linux distros
Snap - the universal packaging format for linux distros
Snap Features
● Better security
● By default, snaps are confined. No network access, limited filesystem
access, etc.
● Interact with system and other snaps through fine-grained interfaces.
● Kernel sandbox features has matured over the years
● cgroups, namespace, seccomp, Apparmor
● But snap is not quite like container
● Provides strict, devmode and classic policies
● Self-contained
● All libraries are bundled
Snap Features
● Immutable: snap is a mounted read-only squashfs
● Multiple versions are kept on filesystem, can easily roll back to
previous version
● Auto-update by default
● Smaller size
● Squashfs is compressed and is mounted, not decompressed.
● Co-exist with existing packaging systems (deb, RPM, etc)
Snap Store
● Centralized software store
● No need to install third-party
repository or PPA
● Tracks
● different versions can co-exist in the
store
● each track has its own risk channels
(edge, beta, candidate, stable)
● Enterprise features such as update
control (paid service)
Snap Store
Snap Architecture
● Let's look at the hello-world snap
$ tree /snap/hello-world/current/
/snap/hello-world/current/
├── bin
│ ├── echo
│ ├── env
│ ├── evil
│ └── sh
└── meta
├── gui
│ └── icon.png
└── snap.yaml
● The important file that snapd cares is meta/snap.yaml
Snap Architecture
$ cat /snap/hello-world/current/meta/snap.yaml
name: hello-world
version: 6.3
architectures: [ all ]
summary: The 'hello-world' of snaps
description: |
This is a simple snap example that includes a few interesting binaries
to demonstrate snaps and their confinement.
* hello-world.env - dump the env of commands run inside app sandbox
* hello-world.evil - show how snappy sandboxes binaries
* hello-world.sh - enter interactive shell that runs in app sandbox
* hello-world - simply output text
apps:
env:
command: bin/env
evil:
command: bin/evil
sh:
command: bin/sh
hello-world:
command: bin/echo
Sandbox
● Every snap is sandboxed by snapd
● Snap can only see its own private mount namespace, like chroot
● Certain syscalls are blocked by seccomp, e.g. networking
● Process is isolated, e.g. you cannot send signals to other processes
owned by same user
● Every snap has its own /tmp
● Access to sensitive devices is blocked, e.g. /dev/video*, /dev/kmsg
● There are common and per-user writeable area to store data
● snapd interface allows snap to get more privileges.
snapd Interface
● If your snap needs to do something outside of confinement, you
need to use interface.
● An interface consists of a plug and a slot
● Slot is the provider, plug is the consumer
● Example slots are home, gsettings, network, x11, wayland,
pulseaudio. Many are offered by core snap.
● Run snap interface to find out more
snap.yaml of vlc
name: vlc
version: 3.0.3-1-3-gf09fd0d
summary: Read, capture, broadcast your multimedia streams
confinement: strict
grade: stable
apps:
vlc:
command: command-vlc.wrapper
plugs:
- unity7
- network
- network-bind
- home
- opengl
- pulseaudio
- mount-observe
- optical-drive
- camera
- removable-media
- screen-inhibit-control
- x11
- desktop
- desktop-legacy
slots:
- mpris
Advantages for Publishers
● Build once runs everywhere
● Give control back to publishers, not distro vendor
● No middle man to distribute your software, quick feedback loop
● Publishers to decide when to update, when to promote from
beta to stable.
Snapcraft for App publishers
● snapcraft provides a super easy way to package any kind of
applications
$ snapcraft plugins
ament dotnet jhbuild nodejs rust
ant dump kbuild plainbox-provider scons
autotools go kernel python tar-content
catkin godeps make python2 waf
catkin-tools gradle maven python3
cmake gulp meson qmake
copy jdk nil ruby
● snapcraft cleanbuild: build within LXD container
Sample snapcraft.yaml
name: hello
version: "2.10"
summary: GNU Hello, the "hello world" snap
description: GNU hello prints a friendly greeting.
This is part of the snapcraft tour at https://snapcraft.io/create/
confinement: strict
apps:
hello:
command: hello
parts:
gnu-hello:
plugin: autotools
source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
Snap - the universal packaging format for linux distros
How snap is made
Snapcraft websites
https://dashboard.snapcraft.io
https://build.snapcraft.io
https://forum.snapcraft.io
https://docs.snapcraft.io
Snap - the universal packaging format for linux distros
dashboard.snapcraft.io
build.snapcraft.io
build.snapcraft.io
build.snapcraft.io
Beautiful Frontpage for Snaps
https://snapcraft.io/<app_name>
Beautiful Frontpage for Snaps
https://snapcraft.io/electronic-wechat
Private Metrics for Your Snap
Thanks!
Anthony Wong
Engineering manager, Canonical

More Related Content

PPTX
Structural elucidation of sucrose
PPTX
Ppt on Organometallic Compounds-Zamir Shekh
ODP
Snaps on open suse
PDF
Ubuntu Core 技术详解
PPTX
Snap Packages on WSL2
PDF
Snappy Kamailio
PDF
TADHack Winner: Snappy Kamailio: Carnival of the Creators
PDF
如何在 Ubuntu 上更快、更便捷地部署物联网设备
Structural elucidation of sucrose
Ppt on Organometallic Compounds-Zamir Shekh
Snaps on open suse
Ubuntu Core 技术详解
Snap Packages on WSL2
Snappy Kamailio
TADHack Winner: Snappy Kamailio: Carnival of the Creators
如何在 Ubuntu 上更快、更便捷地部署物联网设备

Similar to Snap - the universal packaging format for linux distros (14)

PDF
Exploits of the Snapcraft Ninja
PDF
Oh, Snap! Snapping Your App
PDF
Automated Snap Package build processes without the Build Service
PDF
BKK16-406 Ubuntu Core - a snappy platform for Embedded, IoT and 96boards!
PPTX
Making OSM Snappy
ODP
Fedora15 lovelock-pres
PDF
Snap Your App
PDF
Ubucon 2016: Internet of self updated things
PDF
Online Meetup: Intro to LinuxKit
PDF
Docker: the road ahead
PDF
Snap Telemetry Framework & Plugin Architecture at GrafanaCon 2016
PDF
Docker on a Diet
PDF
Fedora Modularity
PDF
Universal Userland
Exploits of the Snapcraft Ninja
Oh, Snap! Snapping Your App
Automated Snap Package build processes without the Build Service
BKK16-406 Ubuntu Core - a snappy platform for Embedded, IoT and 96boards!
Making OSM Snappy
Fedora15 lovelock-pres
Snap Your App
Ubucon 2016: Internet of self updated things
Online Meetup: Intro to LinuxKit
Docker: the road ahead
Snap Telemetry Framework & Plugin Architecture at GrafanaCon 2016
Docker on a Diet
Fedora Modularity
Universal Userland
Ad

Recently uploaded (20)

PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
medical staffing services at VALiNTRY
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Introduction to Artificial Intelligence
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPT
Introduction Database Management System for Course Database
PPTX
history of c programming in notes for students .pptx
PPTX
L1 - Introduction to python Backend.pptx
PDF
top salesforce developer skills in 2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
How to Migrate SBCGlobal Email to Yahoo Easily
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How Creative Agencies Leverage Project Management Software.pdf
medical staffing services at VALiNTRY
How to Choose the Right IT Partner for Your Business in Malaysia
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Understanding Forklifts - TECH EHS Solution
Which alternative to Crystal Reports is best for small or large businesses.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Design an Analysis of Algorithms I-SECS-1021-03
Online Work Permit System for Fast Permit Processing
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Introduction to Artificial Intelligence
Upgrade and Innovation Strategies for SAP ERP Customers
Introduction Database Management System for Course Database
history of c programming in notes for students .pptx
L1 - Introduction to python Backend.pptx
top salesforce developer skills in 2025.pdf
Ad

Snap - the universal packaging format for linux distros

  • 1. Snap : the universal packaging format for Linux distros Anthony Wong Engineering Manager, Canonical Shenzhen University, 2 June 2018
  • 2. Why a new packaging format? As a user ● I want applications that are easy to install, keep up-to-date and secure. As a developer/publisher ● I want an easy and fast way to distribute my software for different Linux distributions.
  • 5. Snap Features ● Better security ● By default, snaps are confined. No network access, limited filesystem access, etc. ● Interact with system and other snaps through fine-grained interfaces. ● Kernel sandbox features has matured over the years ● cgroups, namespace, seccomp, Apparmor ● But snap is not quite like container ● Provides strict, devmode and classic policies ● Self-contained ● All libraries are bundled
  • 6. Snap Features ● Immutable: snap is a mounted read-only squashfs ● Multiple versions are kept on filesystem, can easily roll back to previous version ● Auto-update by default ● Smaller size ● Squashfs is compressed and is mounted, not decompressed. ● Co-exist with existing packaging systems (deb, RPM, etc)
  • 7. Snap Store ● Centralized software store ● No need to install third-party repository or PPA ● Tracks ● different versions can co-exist in the store ● each track has its own risk channels (edge, beta, candidate, stable) ● Enterprise features such as update control (paid service)
  • 9. Snap Architecture ● Let's look at the hello-world snap $ tree /snap/hello-world/current/ /snap/hello-world/current/ ├── bin │ ├── echo │ ├── env │ ├── evil │ └── sh └── meta ├── gui │ └── icon.png └── snap.yaml ● The important file that snapd cares is meta/snap.yaml
  • 10. Snap Architecture $ cat /snap/hello-world/current/meta/snap.yaml name: hello-world version: 6.3 architectures: [ all ] summary: The 'hello-world' of snaps description: | This is a simple snap example that includes a few interesting binaries to demonstrate snaps and their confinement. * hello-world.env - dump the env of commands run inside app sandbox * hello-world.evil - show how snappy sandboxes binaries * hello-world.sh - enter interactive shell that runs in app sandbox * hello-world - simply output text apps: env: command: bin/env evil: command: bin/evil sh: command: bin/sh hello-world: command: bin/echo
  • 11. Sandbox ● Every snap is sandboxed by snapd ● Snap can only see its own private mount namespace, like chroot ● Certain syscalls are blocked by seccomp, e.g. networking ● Process is isolated, e.g. you cannot send signals to other processes owned by same user ● Every snap has its own /tmp ● Access to sensitive devices is blocked, e.g. /dev/video*, /dev/kmsg ● There are common and per-user writeable area to store data ● snapd interface allows snap to get more privileges.
  • 12. snapd Interface ● If your snap needs to do something outside of confinement, you need to use interface. ● An interface consists of a plug and a slot ● Slot is the provider, plug is the consumer ● Example slots are home, gsettings, network, x11, wayland, pulseaudio. Many are offered by core snap. ● Run snap interface to find out more
  • 13. snap.yaml of vlc name: vlc version: 3.0.3-1-3-gf09fd0d summary: Read, capture, broadcast your multimedia streams confinement: strict grade: stable apps: vlc: command: command-vlc.wrapper plugs: - unity7 - network - network-bind - home - opengl - pulseaudio - mount-observe - optical-drive - camera - removable-media - screen-inhibit-control - x11 - desktop - desktop-legacy slots: - mpris
  • 14. Advantages for Publishers ● Build once runs everywhere ● Give control back to publishers, not distro vendor ● No middle man to distribute your software, quick feedback loop ● Publishers to decide when to update, when to promote from beta to stable.
  • 15. Snapcraft for App publishers ● snapcraft provides a super easy way to package any kind of applications $ snapcraft plugins ament dotnet jhbuild nodejs rust ant dump kbuild plainbox-provider scons autotools go kernel python tar-content catkin godeps make python2 waf catkin-tools gradle maven python3 cmake gulp meson qmake copy jdk nil ruby ● snapcraft cleanbuild: build within LXD container
  • 16. Sample snapcraft.yaml name: hello version: "2.10" summary: GNU Hello, the "hello world" snap description: GNU hello prints a friendly greeting. This is part of the snapcraft tour at https://snapcraft.io/create/ confinement: strict apps: hello: command: hello parts: gnu-hello: plugin: autotools source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
  • 18. How snap is made
  • 25. Beautiful Frontpage for Snaps https://snapcraft.io/<app_name>
  • 26. Beautiful Frontpage for Snaps https://snapcraft.io/electronic-wechat
  • 27. Private Metrics for Your Snap