We would like to add a new kind of snap:
The core ideas around base are the following:
- the current “core” shrinks to just contain snapd and its basic tools. We need to figure out what that means for our Ubuntu Core images (all-snaps).
- we add new
basesnap type that contains the “base” filesystem for applications to run in. Some possible examples for the base could be e.g. ubuntu-16.04, fedora-25, debian-9
- the current “core” snap is made available as “ubuntu-16.04”
- a snap can declare what
baseit needs, we need to come up with some nice yaml for this. If nothing is declared we default to ubuntu-16.04 for backward compatibility.
- when snapd detects that a base snap is missing its automatically downloaded and installed together with the snap that needs it. We should also garbage collect it if there is no snap needing it anymore.
This should make snapping software that is written with for specific distros much simpler.
- how do apps get tools like
snapctlinside their execution environment ?
- does this change anything for re-exec?
Implementation plan (strawman)
Step 1 (groundwork)
- add new
type: baseto snap.yaml so that a snap can declare it is a base-snap
- add new
base: some-base-nameso that a snap can declare it needs a specific base-snap
- ensure that a snap that needs a base that is not installed gets rejected (we will add auto-install later)
- modify snap-confine so that it DTRT for snaps that need base snaps:
- instead of mounting “/” (ubuntu-core) or “/snap/core/current” (classic) it needs to check a new SNAP_CONFINE_BASE_SNAP environment (or a different way to communicate this information from snapd to snap-confine)
- mount /snap/$SNAP_CONFINE_BASE_SNAP/current as “/”
- bind mount /dev, /proc/, /sys, /tmp, /home, /etc(?), /media(?) from the host into the snap “/”
Started with that here: https://github.com/snapcore/snapd/compare/master...mvo5:f/base-snaps?expand=1
Step 2 (transition for classic)
snap install/refreshauto-fetches missing base snaps
- create “ubuntu-16.04” base snap with just the libs/essentials from the current core snap (OPEN QUESTION: what about snapctl - would that mounted in from the core snap?)
- change snapd so that if no base is specified the “ubuntu-16.04” base is automatically fetched/used
Step 3 (transition on ubuntu-core system)
- add new ubuntu-core-16 os snap that looks like the current “core”
- add code to snapd that will fetch ubuntu-core-16 automatically (transition from core to ubuntu-core-16 on all-snap devices)
- shrink down “core” so that it really just contains the bare essentials to run snapd itself