A base snap is a special kind of snap that provides a run-time environment with a cardinal set of libraries that are common to most applications. They’re transparent to users, but they need to be considered and specified when building a snap.
There are currently six supported bases:
core24
: the newest base, built from Ubuntu 24.04 LTS.core22
: built from Ubuntu 22.04 LTS.core20
: built from Ubuntu 20.04 LTS.core18
: the previous standard base for snap building, based on Ubuntu 18.04 LTS.core
: based on Ubuntu 16.04 ESM, not to be confused with core16
(see below).bare
: an empty base that’s useful with fully statically linked snaps and when testing.Older releases of core
were occasionally referred to as core 16, but core
and core16
are now two distinct packages.
In most Ubuntu bases (except core
), snapd and its associated tools are provided by their relevant snaps.
core16 should no longer be used. With no current stable release, its beta and candidate releases are classed as experimental, and packages previously using it should be moved to a more recent base.
Bases are defined by adding the base
keyword to a snap’s snapcraft.yaml followed by the base name.
For example, to specify core20
, use the following:
base: core20
To specify core22
, use the following
base: core22
The latest releases of Snapcraft do not support older bases. Prior major Snapcraft releases are still supported and can be installed from Snapcraft’s tracks.
To build core18
snaps, install snapcraft 7 from the 7.x track:
$ snap install snapcraft --channel 7.x
core
To build core
snaps, install snapcraft 4 from the 4.x track:
$ snap install snapcraft --channel 4.x
For snaps using core, we highly recommend reading Snapcraft and Extended Security Maintenance for essential support details.
The base snap mounts itself as the root filesystem within your snap such that when your application runs, the base’s library paths are searched directly after the paths for your specific snap.
Compatibility mode and ESM Support
When building a snap with no specified base, Snapcraft will operate in compatibility mode. This is essentially a prior (2.43-era) version of Snapcraft and, consequently, snapcraft will lose the functionality of newer releases. See Features incompatible with bases for details.
This compatibility mode is no longer supported starting in Snapcraft 5.0. Snapcraft 4 can be installed from the 4.x track on the Snap Store (snap install snapcraft --channel 4.x
). See Snapcraft and Extended Security Maintenance for essential support details.
core22
is the currently recommended base for the majority of snaps. But much like choosing a distribution base for a project or server, the best base for an application is dependent on an application’s requirements and which plugins or extensions a base supports. If there are specific dependencies that cannot be easily met with core22
then core20
is a valid and supported alternative.
Snapcraft extensions are a great way to easily bundle a set of common requirements into a snap, such as for running KDE Plasma or GNOME applications, but you need to select a base that’s supported by the extension you require. See Supported extensions for a list of which extensions support which bases.
Base support was added with the release of Snapcraft 3. As noted above, snaps created before this, and snaps not using the base:
keyword, can still be built but they cannot use specific new features. Instead, snaps built without bases inherit attributes from their respective build environments.
Snaps that don’t use bases can often migrate to one without too much difficulty. See Upgrading snapcraft for more details on potential differences.
While it is possible to build your own base snap, its publisher needs to take responsibility for its maintenance and updates. In particular:
Base snaps can be either bootable or non-bootable. The former needs to include systemd while the latter can be leaner.
The base
keyword on its own does not take into account the creation of bases. Instead, with older versions of snapcraft, the name
keyword was arbitrarily used to determine the build environment:
name: core18
type: base
# base: is not set elsewhere
The above example uses name
to specify the creation of an Ubuntu 18.04 (core18) based build environment.
But the above fails if a base has yet to be bootstrapped, or is otherwise unavailable. For example, the following will currently generate a `launch failed: Unable to find an image matching “futurecore” error:
name: futurecore
type: base
# base: is not set elsewhere
In snapcraft 7 and newer, a build-base
keyword can be used to explicitly define the base to use for the build environment where the base has not yet been bootstrapped.
To solve the above issue, for example, use the following:
name: futurecore
type: base
build-base: core24
# base: is not set elsewhere
Last updated 3 months ago.