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
- How systems are named — how +dangerous and +tpm fit into a system name
Part of journeys
- Your own kernel or gadget on Ubuntu Core, step 1 of 5 · next: Model, gadget and kernel
01 Ubuntu Core, as published
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
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.xzand itsSHA256SUMSwithimage-garden download-with-sha256sumsfromhttps://cdimage.ubuntu.com/ubuntu-core/R/stable/current/or, for +dangerous,…/R/dangerous-stable/current/(050-ubuntu-core.mk:216-251). %.qcow2: %.img.xzunpacks withunxzand converts withqemu-img convertinsideGARDEN_LOCKED_RECIPE, which takesflockonTARGET.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.qcow2andubuntu-core-24+tpm.x86_64.qcow2in the cache are both links toubuntu-core-24-amd64.qcow2; the +dangerous+tpm systems link to the +dangerous file (050-ubuntu-core.mk:273-289).
Read more
03 A cloud-init template of its own
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 asUBUNTU_CORE_CLOUD_INIT_USER_DATA_TEMPLATE(050-ubuntu-core.mk:179): -datasource_list: [NoCloud],manage_etc_hosts,ssh_pwauth: true,power_statepoweroff; - bootcmd writes/run/systemd/journald.conf.d/90-image-garden-console.confwithForwardToConsole=yesand the serialTTYPath, then restarts journald (lines 144-159); - runcmd:snap set system refresh.hold=tomorrow (162),ip link set dev eth0 down(164),useradd … --extrausers ubuntuandchpasswd(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_HOSTNAMEofubuntu-coreand the release, with dots and pluses turned to dashes:ubuntu-core-24, orubuntu-core-24-tpmforubuntu-core-24+tpm; the meta-datalocal-hostnameis 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_COREand the release, such as24+dangerous(050-ubuntu-core.mk:116).
Read more
04 Log in as ubuntu
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:ubuntuaccount list (050-ubuntu-core.mk:22-26), for which--queryprints onlysystem.users.0.username=ubuntuandsystem.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
--queryreports and usesudowhen it is not root (snapcraft-gitlab-cibin/snapcraft-vm, see the craft components).
Read more
05 Modifiers and architectures
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+tpmgoal that is not x86_64 ("ubuntu-core with +tpm is only available for x86_64") (050-ubuntu-core.mk:18-21). image-garden make allandfetchinclude 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-instanceworks on the systems ofdata/*.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-pciandscsi-hd(050-ubuntu-core.mk:181-184); every Ubuntu Core seed is attached as a SCSI CD-ROM (050-ubuntu-core.mk:38-44).
Read more
06 Where to go from here
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
Read more
- +dangerous systems, Secure Boot and TPM, the adhoc backend.
- On the snapd map: model and grade, how Ubuntu Core boots and recovers.
Roads from here
UBUNTU CORE · all snaps
- Changing a +dangerous Ubuntu Core system — install your own kernel or gadget on a +dangerous system
- Ubuntu Core with Secure Boot and a TPM — the +tpm systems, with Secure Boot and a TPM
SPREAD · tests
- The adhoc backend: allocate and discard — listing ubuntu as the spread user
FIRST BOOT · cloud-init changes
- Provisioning runs once — provisioning once, then power off
Snapd map ↗
- Ubuntu Core: how a device boots and recovers — on the snapd map, how a device boots and recovers
- Model, gadget and kernel — on the snapd map, the model and its grade