Snap
Snap types & Ubuntu Core
Not every snap is the same kind of thing. A handful of special-purpose
snap types are what make Ubuntu Core possible at all — a Linux
distribution built entirely out of snaps, with no apt,
where even the kernel and bootloader configuration update and roll
back exactly like an application does.
- What it is
- The 5 snap types (app, base, gadget, kernel, snapd) that together assemble into a bootable, atomically-updatable OS.
- Mental model
- 4 system snaps ARE the OS; everything else is an application snap running on top of them.
- Key numbers
- Exactly one gadget, one kernel, one base, one snapd per device — but any number of application snaps.
- Reach for it when
- Building an Ubuntu Core image, porting to new hardware (a new gadget snap), or packaging an edge-AI inference snap.
The five formal snap types
The type: field in snapcraft.yaml
accepts exactly five values. If you omit it, you get app.
type: | Contains | Role |
|---|---|---|
| app | An application and its bundled dependencies. | What you install to run your own software — the overwhelming majority of snaps in the store. |
| base | A minimal root filesystem (core libraries, no kernel) — e.g. core22, core24. | The runtime foundation every strictly-confined app-type snap mounts alongside itself. |
| gadget | Bootloader configuration, partition layout (gadget.yaml), device tree overlays. | Device-specific: describes the hardware target and how the device boots. |
| kernel | The Linux kernel image, modules, and initrd. | What the bootloader actually boots into. |
| snapd | The snapd daemon itself. | Distributed as a snap so the snap manager can be updated and rolled back the same way as everything else. |
"System snap" vs. "application snap"
These two terms aren't values of type: — they're
everyday shorthand for grouping the five formal types by role:
| System snaps | Application snaps | |
|---|---|---|
| Formal types | base, gadget, kernel, snapd | app |
| Who installs them | Chosen once, at image build time, by whoever assembles the Ubuntu Core image for a device model. | Anyone, any time — installed and removed like a normal package. |
| What they do | Collectively are the operating system — boot chain, kernel, and base userspace. | Run on top of the OS the system snaps provide. |
| Typical count on a device | Exactly one of each (one gadget, one kernel, one base, one snapd). | As many as the device needs. |
In other words: on an Ubuntu Core device, the four system snaps are the OS image, and everything else on the device is an application snap running on top of them.
Gadget snap, in depth
The gadget snap is the one piece of an Ubuntu Core image that's
genuinely specific to a board. It carries its own manifest,
meta/gadget.yaml, describing:
- volumes — the on-disk partition layout: bootloader region, a
system-bootpartition (boot assets), asystem-datapartition (writable state), sizes and offsets. - bootloader stanza — which bootloader the board uses (
u-boot,grub,piboot, ...) and its config, tying straight back to U-Boot. - structure roles — marks which partition is
system-boot, which issystem-data, etc., so snapd knows where to write updates. - device tree — board-specific
.dtb/overlays, the same device tree concept covered in Linux → Boot.
Building a new board target usually means writing a new gadget snap, not touching the kernel or base snaps at all — the split is deliberate, so board-specific bring-up work stays isolated from the rest of the OS.
Kernel snap, in depth
Packages the kernel image, loadable modules, and initrd that the bootloader (configured by the gadget snap) actually boots. On secure devices it's signed, and forms one link in the same chain of trust described in Bootloader fundamentals — the gadget's bootloader stanza verifies the kernel snap's signature before jumping to it. Updating the kernel snap is an atomic, rollback-capable operation exactly like updating an application snap.
Base and snapd snaps
The base snap (e.g. core22) supplies the
minimal userspace — C library and friends — that runs on top of the
kernel and underneath every application snap; on an Ubuntu Core
device it effectively is the root filesystem. The
snapd snap ships the snap daemon itself, so the
component responsible for updating everything else can also be
updated and rolled back the same way.
How they combine to boot Ubuntu Core
Two properties fall out of this directly: atomic, transactional updates (each snap is a whole immutable image — an update either fully applies or fully doesn't) and automatic rollback (if a freshly-updated kernel or base snap fails a health check on boot, the bootloader falls back to the previous working revision without operator intervention — critical for devices nobody can walk up to and re-flash).
Inference snaps
"Inference snap" isn't a formal type: — it's a common
real-world pattern for how edge-AI workloads get packaged: an
ordinary type: app snap purpose-built to run a machine
learning inference engine (and often a model) on the device, as
opposed to an app snap that's, say, a web server or a CLI tool.
They show up constantly on NPU-equipped boards (e.g. an i.MX8MP)
running Ubuntu Core.
What tends to make an inference snap look different from a typical app snap:
- Runtime and model split across two snaps, connected by the
contentinterface (see Packaging → Plugs and slots) — the inference engine binary ships in one snap, the trained model ships in another, and they're updated independently. A model retrain doesn't require rebuilding or re-certifying the engine, and vice versa. - Hardware-specific interfaces — access to a GPU or NPU device node, camera, or other accelerator, each requiring its own interface connection under strict confinement rather than broad system access.
- Fleet-safe update story — the same atomic update/rollback model described above is exactly what makes it reasonable to push a new inference engine build to a fleet of remote, physically inaccessible devices: a bad update rolls itself back instead of bricking hardware nobody can drive to.
Real-world applications
- Industrial gateways and PLCs — Ubuntu Core's atomic updates and rollback are a strong fit for devices deployed in factories, where a bad update failing safely matters enormously.
- Edge-AI camera/vision systems — the inference-snap pattern (engine and model split via the
contentinterface) is exactly how many NPU-equipped edge devices structure their ML pipeline. - Digital signage and retail kiosks — a locked-down, remotely-updatable OS with strict confinement suits unattended public-facing hardware.
- Telecom/network appliances — Ubuntu Core devices are used as small-footprint routers and network functions where every layer needs to be independently, safely updatable.
Gotchas
- A device model only ever has one gadget and one kernel snap active — "which board is this" and "which kernel build" are both single decisions, not something an app snap can override.
- Changing the gadget snap's partition layout on an already-deployed fleet is not a normal update — it typically requires re-imaging, since existing partitions can't be silently resized. Get the
gadget.yamlvolume layout right before mass deployment. - An inference snap that hardcodes a model path inside its own snap directory defeats the point of splitting engine and model via the
contentinterface — check that the model is actually read from the shared content path, not bundled and forgotten.