Specify a base¶
This guide describes how to declare, upgrade, and downgrade the base of a snap.
How to use a base¶
The base a snap will use is defined in the snap’s project file.
To use the core26 base for a snap:
base: core26
How to migrate to a higher base¶
See Change bases for details on migrating to a higher base.
How to use a deprecated base¶
The latest release of Snapcraft does not support older bases. Prior major Snapcraft releases are supported and can be installed from their respective tracks.
See base snaps for a list of which Snapcraft major releases support a particular base.
The Support schedule details the support timeline of each base.
core18¶
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
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.
How to develop supported and deprecated bases¶
When developing snaps using supported and deprecated bases at the same time, developers must use different versions of Snapcraft. There are a few options:
Refresh channels¶
Switch between Snapcraft releases by refreshing channels. snapd retains the
previously installed snap, so refreshing between two channels should not
require re-downloading Snapcraft.
snap refresh snapcraft --channel 7.x
snap refresh snapcraft --channel 8.x
Parallel installs¶
Multiple instances of Snapcraft can be installed with the experimental parallel installs feature in SnapD.
snap install snapcraft snapcraft_7 --channel 7.x
snap install snapcraft snapcraft_8 --channel 8.x
snapcraft_8 pack
Containers¶
Isolated development environments allow using different versions of Snapcraft simultaneously.
Snapcraft rocks are the recommended way to build snaps in a container.
How to bootstrap a base snap¶
The build-base key is used to bootstrap and create new bases.
To bootstrap the core28 base snap, use the following project file
snippet:
name: core28
type: base
build-base: core26
This snippet will do the following:
name: core28sets the snap’s name tocore28.type: basecreates a base snap.build-base: core26builds the snap inside an Ubuntu 26.04 build environment.basecannot be set in the project file
How to build a kernel snap¶
The build-base key is used to build kernel snaps for Ubuntu LTS
releases.
To build a kernel snap targeting the Ubuntu 26.04 release, use the following project file snippet:
name: pc-kernel
type: kernel
build-base: core26
This snippet will do the following:
create a kernel snap for Ubuntu 26.04
build the snap inside an Ubuntu 26.04 build environment
use the core26 feature set and
snapcraft.yamlschema
How to build a bare base snap¶
Bare base snaps are useful for fully statically linked applications and will not have access to a base snap at runtime.
To build a bare base snap, use the following project file snippet:
name: my-snap
base: bare
build-base: core26
This snippet will build a bare base snap inside an Ubuntu 26.04 build environment.