Curious Minds

Clear answers to science and history questions

Snap Core: How It Works and Why It Matters

· 5 min read · Science

Snap Core is the base snap that provides a minimal Ubuntu environment for other snaps to run on, acting as the foundation for Snapcraft packages.

Background

The Snap ecosystem was created by Canonical to simplify software distribution on Linux. A snap is a self‑contained bundle that includes an application and all its dependencies. To keep snaps lightweight and secure, they run inside a confined environment. Snap Core supplies the operating‑system layer inside that confinement, essentially a stripped‑down Ubuntu system that other snaps build upon.

Snap Core versions mirror Ubuntu releases. For example, snap-core18 is based on Ubuntu 18.04 LTS, snap-core20 on Ubuntu 20.04 LTS, and snap-core22 on Ubuntu 22.04 LTS. Each core snap contains the kernel modules, libc, systemd, and a minimal set of utilities required for a snap to function.

How Snap Core Works

When you install a snap, the package manager pulls two layers:

  1. Base layer – the snap‑core snap that provides the OS foundation.
  2. Application layer – the snap’s own files and binaries.

The base layer is shared among many snaps, which reduces duplication on disk. Snap Core is mounted as a read‑only filesystem inside the snap container. The application layer is mounted read‑write, allowing the app to write its data to a separate, secure location. This separation keeps the core untouched, ensuring consistency across different snaps that use the same base.

Snap Core also implements the security confinement model. System calls that touch the host system are filtered by AppArmor profiles. Because the core is read‑only, the snap cannot alter system libraries, which protects the host from malicious or buggy applications.

Choosing the Right Snap Core

Developers select a base snap that matches the target operating system. The choice depends on:

  • Compatibility – newer snaps may require newer base libraries.
  • Stability – LTS bases (18.04, 20.04) are more stable for production.
  • Size – older bases are smaller but may lack recent security updates.
  • Feature set – some snaps need newer kernel modules only present in newer bases.

When packaging a snap, the developer specifies the base in the snapcraft.yaml file:

name: myapp
base: core20

The Snap Store automatically fetches the appropriate snap-core package during the build and deployment process.

Common Problems and Fixes

1. Missing Dependencies

If an application fails to start, it often lacks a library that exists in a newer base. Updating the base to a newer snap-core version usually resolves the issue.

2. Conflicting System Calls

Some snaps attempt to access host resources that the AppArmor profile blocks. Adding a plugs section to snapcraft.yaml grants the necessary permissions.

3. Disk Space Pressure

Because each base snap is shared, installing many different bases can consume significant disk space. Removing unused bases via snap remove --purge snap-core18 frees space.

4. Outdated Base

Snap Core receives security updates independently of the host OS. However, if the host is very old, some newer bases may not install. In that case, stick to the latest available base that the host supports.

Comparisons with Other Packaging Systems

Snap Core differs from traditional package managers like APT or RPM in several ways:

  • Isolation – Snap Core creates a containerized environment, whereas APT installs system‑wide libraries.
  • Versioning – Multiple versions of the same snap can coexist, each with its own base, unlike APT where only one package version is installed.
  • Rollback – Snap Core allows easy rollback to a previous snap revision if an update fails.
  • Distribution – Snap packages are cross‑distribution; the same snap runs on Ubuntu, Debian, Fedora, and others, thanks to Snap Core’s consistent base.

Costs and Licensing

Snap Core is free and open source. It is distributed under the GPLv3 license, the same license used by Ubuntu. Users and developers pay no fees for downloading or running snap-core packages. The Snap Store’s hosting and bandwidth are also free for public snaps.

Safety and Security Considerations

Snap Core’s read‑only nature and AppArmor confinement provide strong isolation. However, developers should:

  • Keep the base snap updated by specifying the latest LTS base.
  • Avoid using classic confinement unless necessary, as it bypasses the sandbox.
  • Test snaps on multiple base versions to ensure compatibility.
  • Use the snapcraft linter to catch common security issues before publishing.

Alternatives to Snap Core

Other Linux distribution packaging systems provide similar isolation:

  • Flatpak – uses a runtime (like org.freedesktop.Platform) instead of a base snap.
  • AppImage – bundles all dependencies but does not separate base and app layers.
  • Container images (Docker, OCI) – offer full OS isolation but are heavier for desktop applications.

Each alternative has its own strengths. Flatpak offers a larger ecosystem of runtimes; AppImage is simpler to distribute; container images provide the deepest isolation. Snap Core remains popular for its tight integration with Ubuntu and the Snap Store.

Frequently Asked Questions

What is the difference between snap-core and core?

“snap-core” refers to the actual snap package that contains the base OS. “core” is a shorthand used in snapcraft.yaml to specify the base. The two are the same thing, just different naming conventions.

Can I install snap-core manually on a non‑Ubuntu system?

Yes. Snap Core is designed to run on any Linux distribution that supports snapd. Installing snapd and then pulling the desired snap-core snap works on Debian, Fedora, Arch, and others.

Why do some snaps fail after an update?

Updates may introduce new dependencies or change the base snap. If the new base is incompatible with the application’s compiled libraries, the snap may crash. Rebuilding the snap with the updated base often fixes the issue.

Is snap-core secure against root exploits?

Snap Core’s confinement limits what a snap can do, but it does not protect against a compromised host system. Root access on the host can bypass all confinement. Snap Core is secure for untrusted applications, not for protecting the host from root.

How do I remove an unused snap-core version?

Use sudo snap remove --purge snap-core18 to delete the base snap. This frees disk space and removes the old base from the system.

In this article
  1. Background
  2. How Snap Core Works
  3. Choosing the Right Snap Core
  4. Common Problems and Fixes
  5. Comparisons with Other Packaging Systems
  6. Costs and Licensing
  7. Safety and Security Considerations
  8. Alternatives to Snap Core
  9. Frequently Asked Questions