Ubuntu Core images

16 to 26, +dangerous, +tpm for users

image-garden runs Ubuntu Core 16 to 26 from the .img.xz images on cdimage.ubuntu.com, from the stable channel or, for +dangerous, from dangerous-stable. It unpacks and converts them once, under a lock, and prepares them with its own cloud-init template that creates ubuntu/ubuntu, holds refreshes, skips console-conf and waits for snapd to seed.

On the map: ubuntu core

▶ Watch this deck — 6 scenes, ~4 min

Worth seeing first

Part of journeys

01 Ubuntu Core, as published

UBUNTU CORE all snaps, managed by snapd kernel gadget base snapd published images that image-garden runs x86_64 16 18 20 22 24 26 aarch64 22 24 26 +dangerous a development model +tpm Secure Boot, encrypted disk ubuntu-core-24.x86_64 the example in this deck
Ubuntu Core is made of snaps: kernel, gadget, base and snapd. image-garden runs the published images, releases 16 to 26 on x86_64 and 22 to 26 on aarch64, with +dangerous for a development model and +tpm for Secure Boot and an encrypted disk. The example is ubuntu-core-24.x86_64

Ubuntu Core 16 to 26 on x86_64, 22 to 26 on aarch64, with +dangerous and +tpm variants. The example is ubuntu-core-24.x86_64.

Ubuntu Core is the all-snaps Ubuntu: the kernel, the boot files and the base system are snaps, and snapd manages all of them. If you build snaps for devices, sooner or later you want to try them there. image-garden runs the images Canonical publishes, releases 16 to 26 on x86, and 22 to 26 on Arm too. Next to the plain releases there are two kinds of modifier: +dangerous, for a development model, and +tpm, for Secure Boot with an encrypted disk. This deck follows ubuntu-core-24 from the published image to a VM you can log in to.

Details and sources

Details

  • The releases are UBUNTU_CORE_RELEASES = 16 18 20 22 22+dangerous 24 24+dangerous 26 26+dangerous; all are x86_64 systems, and all but 16, 18 and 20 are aarch64 systems too (050-ubuntu-core.mk:4-7).
  • The +tpm systems are 24+tpm 24+dangerous+tpm 26+tpm 26+dangerous+tpm, x86_64 only (050-ubuntu-core.mk:15-16).
  • The README lists the same and notes that Ubuntu Core allows no root password authentication (README.md:699-709).
  • That the kernel, gadget and base are snaps managed by snapd is the snapd map's subject: model, gadget and kernel.

02 One download, converted once

ONE DOWNLOAD https://cdimage.ubuntu.com/ubuntu-core/24/stable/current/ https://cdimage.ubuntu.com/ubuntu-core/24/dangerous-stable/current/ each with its SHA256SUMS, checked like any download ubuntu-core-24-amd64.img.xz unxz, qemu-img ubuntu-core-24-amd64.qcow2 converted once, in the cache, shared ubuntu-core-24.x86_64 …-24+tpm.x86_64 a lock: the second make waits then finds the work done
The image comes from cdimage.ubuntu.com, the stable channel for plain systems and dangerous-stable for +dangerous, with a SHA256SUMS list; the .img.xz file is unpacked and converted to qcow2 once in the download cache under a lock, and ubuntu-core-24 and ubuntu-core-24+tpm link to the same converted file

Images come from cdimage.ubuntu.com/ubuntu-core/R/stable or …/dangerous-stable. The .img.xz is converted to qcow2 once, under a lock, and shared by the systems built on it.

The images live on cdimage.ubuntu.com, one directory per release. Plain systems come from the stable channel, +dangerous ones from dangerous-stable, each with its SHA256SUMS list, checked like any other download. They come compressed, as .img.xz files. make unpacks and converts each one to qcow2, once, in the download cache, and links the system's name to it. Because ubuntu-core-24 and ubuntu-core-24+tpm start from the same file, two makes can meet there, so the convert runs under a lock: the second waits, then finds the work done.

Details and sources

Details

  • Each release downloads ubuntu-core-R-ARCH.img.xz and its SHA256SUMS with image-garden download-with-sha256sums from https://cdimage.ubuntu.com/ubuntu-core/R/stable/current/ or, for +dangerous, …/R/dangerous-stable/current/ (050-ubuntu-core.mk:216-251).
  • %.qcow2: %.img.xz unpacks with unxz and converts with qemu-img convert inside GARDEN_LOCKED_RECIPE, which takes flock on TARGET.lock; a second make that waits finds the target newer than its source and keeps it (010-qemu.mk:304-347).
  • ubuntu-core-24.x86_64.qcow2 and ubuntu-core-24+tpm.x86_64.qcow2 in the cache are both links to ubuntu-core-24-amd64.qcow2; the +dangerous+tpm systems link to the +dangerous file (050-ubuntu-core.mk:273-289).

03 A cloud-init template of its own

ITS OWN TEMPLATE BASE_UBUNTU_CORE_CLOUD_INIT_USER_DATA_TEMPLATE, in order bootcmd: journald.conf.d drop-in, ForwardToConsole=yes snapd shows in the log snap set system refresh.hold="tomorrow" ip link set dev eth0 down no refresh halfway useradd … --extrausers ubuntu; chpasswd echo image-garden >…/console-conf/complete snap wait system seed.loaded snap abort 3 || true snap remove --purge console-conf || true ip link set dev eth0 up then power off, prepared
The Ubuntu Core user-data, in order: copy the journal to the serial console; hold refreshes for a day and take eth0 down; create the ubuntu user with useradd --extrausers and mark console-conf complete; wait for seed.loaded, abort change 3 and remove the console-conf snap; bring eth0 up and power off

BASE_UBUNTU_CORE_CLOUD_INIT_USER_DATA_TEMPLATE: journal to the serial console, refresh.hold, useradd --extrausers ubuntu, console-conf skipped, snap wait system seed.loaded, power off.

Ubuntu Core doesn't get the template the cloud images get. It has its own, because the first boot is snapd's busiest time. First it copies the journal to the serial console, so the build log shows what snapd does. Then it holds refreshes for a day and takes the network down, so no refresh starts halfway. It creates the ubuntu user in the extra users database, marks console-conf as done, waits for snapd to finish seeding, aborts a refresh that may have slipped in, removes the console-conf snap, and brings the network back. Then the machine powers off, prepared.

Details and sources

Details

  • BASE_UBUNTU_CORE_CLOUD_INIT_USER_DATA_TEMPLATE (050-ubuntu-core.mk:131-177), set as UBUNTU_CORE_CLOUD_INIT_USER_DATA_TEMPLATE (050-ubuntu-core.mk:179): - datasource_list: [NoCloud], manage_etc_hosts, ssh_pwauth: true, power_state poweroff; - bootcmd writes /run/systemd/journald.conf.d/90-image-garden-console.conf with ForwardToConsole=yes and the serial TTYPath, then restarts journald (lines 144-159); - runcmd: snap set system refresh.hold= tomorrow (162), ip link set dev eth0 down (164), useradd … --extrausers ubuntu and chpasswd (166-167), console-conf marked complete (168), snap wait system seed.loaded (170), snap abort 3 || true (172), snap remove --purge console-conf || true (174), ip link set dev eth0 up (176).
  • The guest's host name is CLOUD_INIT_HOSTNAME of ubuntu-core and the release, with dots and pluses turned to dashes: ubuntu-core-24, or ubuntu-core-24-tpm for ubuntu-core-24+tpm; the meta-data local-hostname is the same name (050-ubuntu-core.mk:141, 010-qemu.mk:94-104, 050-ubuntu-core.mk:111).
  • The provisioning boot runs under bash with set -o pipefail, so a QEMU that fails to start or exits with an error fails the build instead of leaving an image that looks ready (050-ubuntu-core.mk:37-53).
  • The user-data of an Ubuntu Core system is picked with the group UBUNTU_CORE and the release, such as 24+dangerous (050-ubuntu-core.mk:116).

04 Log in as ubuntu

LOG IN AS UBUNTU root: no password login ubuntu / ubuntu, then sudo $ ./ubuntu-core-24.x86_64.run --query system.users.0.username=ubuntu system.users.0.password=ubuntu a cloud image lists two: root, and the distribution's user CI components read the answer - ubuntu-core-24: username: ubuntu password: ubuntu in spread.yaml scripts run through sudo, in ubuntu's session
Ubuntu Core allows no root password login; the account is ubuntu with password ubuntu and sudo; the .run script's --query lists only that user, where a cloud image lists root and the distribution's user; CI components read it; spread.yaml lists ubuntu, and scripts then run through sudo in ubuntu's session

Ubuntu Core has no root password login: use ubuntu/ubuntu and sudo. SYSTEM.run --query reports only that user.

There's one difference you'll meet at once. Ubuntu Core doesn't allow root to log in with a password, so the only account is ubuntu, with password ubuntu, and you become root with sudo. The .run script says so: its query answer lists just that one user, where a cloud image lists root and the distribution's user. Tools that read the answer, such as the CI components, pick it up by themselves. In a spread.yaml, list ubuntu for every Ubuntu Core system, and remember that your scripts then run through sudo, inside ubuntu's session.

Details and sources

Details

  • The Ubuntu Core launchers are written with the only:ubuntu account list (050-ubuntu-core.mk:22-26), for which --query prints only system.users.0.username=ubuntu and system.users.0.password=ubuntu; cloud images print root and the distribution's user (010-qemu.mk:80-87).
  • Ubuntu Core does not allow root password authentication (README.md:708).
  • The CI components log in with the first user --query reports and use sudo when it is not root (snapcraft-gitlab-ci bin/snapcraft-vm, see the craft components).

05 Modifiers and architectures

WHAT EXISTS x86_64 16 18 20 22 24 26 · +dangerous: 22 24 26 · +tpm: 24 26 aarch64 22 24 26 · +dangerous: 22 24 26 · no +tpm +dangerous+tpm alphabetical order system modifiers go in alphabetical order: use …+dangerous+tpm… +tpm is only available for x86_64 16 and 18: disk on virtio SCSI
On x86_64 every release from 16 to 26, +dangerous for 22, 24 and 26 and +tpm for 24 and 26; on aarch64 22, 24 and 26 with +dangerous and no +tpm. Modifiers go in alphabetical order, +dangerous+tpm, and make refuses +tpm+dangerous and +tpm on aarch64. Releases 16 and 18 boot their disk through virtio SCSI

x86_64: 16–26, +dangerous for 22–26, +tpm for 24 and 26. aarch64: 22–26 and +dangerous. Modifiers go in alphabetical order: +dangerous+tpm.

Not every combination exists. On x86 you get every release, +dangerous for 22 and later, and +tpm for 24 and 26. On Arm, 22 and later, with +dangerous, but no +tpm. Modifiers go in alphabetical order, so it's +dangerous+tpm, and make tells you so if you swap them. It also stops you asking for +tpm on Arm. The oldest releases need one quirk: 16 and 18 boot their disk through a virtio SCSI controller. Everything about +tpm has a deck of its own; +dangerous is next.

Details and sources

Details

  • make stops a goal with +tpm+dangerous ("system modifiers go in alphabetical order: use …+dangerous+tpm…") and an Ubuntu Core +tpm goal that is not x86_64 ("ubuntu-core with +tpm is only available for x86_64") (050-ubuntu-core.mk:18-21).
  • image-garden make all and fetch include Ubuntu Core only on x86_64 and aarch64 hosts: 22 to 26 and their modifiers on both, 16 to 20 and the +tpm systems on x86_64 only (050-ubuntu-core.mk:186-197). On other hosts the Ubuntu Core systems can still be named and emulated.
  • Ubuntu Core systems have no named instances: define-instance works on the systems of data/*.ini, and with an Ubuntu Core base make has no rule for the instance (README.md:976-979).
  • Releases 16 and 18 replace the storage option with a disk on virtio-scsi-pci and scsi-hd (050-ubuntu-core.mk:181-184); every Ubuntu Core seed is attached as a SCSI CD-ROM (050-ubuntu-core.mk:38-44).

06 Where to go from here

ROADS Ubuntu Core images +dangerous systems your own kernel or gadget Model and grade ↗ on the snapd map Secure Boot and TPM the +tpm systems Ubuntu Core ↗ how a device boots, recovers The adhoc backend the user to list
Roads from Ubuntu Core images: +dangerous systems, Secure Boot and TPM, the spread backend, and on the snapd map the model and grade and how Ubuntu Core boots and recovers

Next: +dangerous systems, Secure Boot and TPM, and on the snapd map the model and how Ubuntu Core boots.

So an Ubuntu Core system is a published image, converted once, prepared by its own template, and reached as ubuntu. If you want to put your own kernel or gadget on it, the +dangerous deck is next, and the snapd map explains the model and its grade. The +tpm deck covers Secure Boot and encryption. On the snapd map, the Ubuntu Core deck shows how such a device boots and recovers. And for tests, the spread backend deck shows the user to list.

Details and sources

Roads from here

UBUNTU CORE · all snaps

SPREAD · tests

FIRST BOOT · cloud-init changes

Snapd map ↗