# Images

> Signed catalogs, built-in aliases, repository selection, local cache verification, imports, and pruning.

---

LLMS index: [llms.txt](/v1.5/llms.txt)

---

Barn resolves Linux guest images from a static catalog and immutable `qcow2` artifacts. Official and HTTP repositories require ML-DSA-87 catalog signatures, while explicitly selected local directory and HTTPS repositories may be unsigned. You can activate newer image catalogs with `barn update` without replacing the `barn` binary; the binary defines the trusted signing public keys and `qcow2` safety rules.

> [!WARNING]
> `el7` (CentOS Linux 7.9) is an EOL `deprecated` compatibility image. The catalog also marks `el8` (Rocky Linux 8) and `u22` (Ubuntu 22.04 LTS) as `deprecated` as support is phased out. Prefer `el9`, `el10`, `d12`, `d13`, `u24`, or `u26` for new labs.

## Aliases and pull order {#aliases-and-pull-order}

Official catalog `2026120302` selects Debian 13 (`d13:stable`) on the host architecture by default. It covers nine distribution families and 17 stable artifacts, with 35 artifacts including retained versions. Only `el7` is amd64-only. Every other family provides both amd64 and arm64.

Both public mirrors published this catalog on December 3, 2026. Run `barn update` to activate it and `barn image info d13` to see the selected version. Barn 1.4.0 verifies the Minisign signature and still needs `barn init -I d13` to generate a Debian 13 inventory. Barn 1.5.0 verifies the ML-DSA-87 signature on the same bytes. [Debian image acceptance](/v1.5/blog/design/image-refresh-20261203/) · [Platforms and Limits](../../about/status/)

| Family | `stable` in `2026120302` | Family aliases | Architecture aliases (`arm64` / `amd64`) |
|---|---|---|---|
| `d13` | `20261130.2678.1` | `d`, `debian`, `debian13`, `trixie` | `d13a`, `da` / `d13x`, `d13i`, `dx`, `di` |
| `d12` | `20261130.2678.1` | `debian12`, `bookworm` | `d12a` / `d12x`, `d12i` |
| `el7` | `7.9.20221112.0` | `c7`, `centos7`, `centos79` | — / `el7x`, `el7i`, `c7x`, `c7i` |
| `el8` | `8.10.20240528.3` | `rocky8` | `el8a` / `el8x`, `el8i` |
| `el9` | `9.9.20261112.1` | `rocky9` (`rocky` in 1.2.0) | `el9a` / `el9x`, `el9i` |
| `el10` | `10.3.20261112.1` | `e`, `el`, `rocky`, `rocky10` | `el10a`, `ea`, `ela` / `el10x`, `el10i`, `ex`, `ei`, `elx`, `eli` |
| `u22` | `20261109.0.1` | `ubuntu22`, `ubuntu2204`, `jammy` | `u22a` / `u22x`, `u22i` |
| `u24` | `20261017.0.1` | `ubuntu24`, `ubuntu2404`, `noble` (`ubuntu` in 1.2.0) | `u24a` / `u24x`, `u24i` |
| `u26` | `20261108.0.1` | `u`, `ubuntu`, `ubuntu26`, `ubuntu2604`, `resolute` | `u26a`, `ua` / `u26x`, `u26i`, `ux`, `ui` |
{.wide .expand}

Unversioned family shorthands point to the newest mainstream family (`e`/`el`/`rocky` → `el10`, `u`/`ubuntu` → `u26`, `d`/`debian` → `d13`; in Barn 1.2.0, `rocky` mapped to `el9` and `ubuntu` mapped to `u24`). Appending `a` selects `arm64`, and appending `x` or `i` selects `amd64`—accepted everywhere an image reference is read (`image info/pull`, `--image/-I`, `BARN_IMAGE`, and `vm_image`, including `:channel` or `@version`). For `image info/pull`, an explicit `-A` must name the matching architecture. Inventory commands also honor `BARN_ARCH`. An inventory's default `vm_arch: native` defers to an architecture-suffixed `vm_image`.

Distribution notes:

- `u22`, `u24`, and `u26` are Ubuntu 22.04, 24.04, and 26.04 LTS; `d12` and `d13` are Debian 12 and 13. Barn's image recipe builds them from the distributions' cloud images: the image ships a `dba` user (UID/GID 88), XFS userspace tools are present, and `en_US.UTF-8` is available while `C.UTF-8` stays the default locale.
- `el7` is CentOS Linux 7.9 (`amd64` BIOS), and `el8`, `el9`, and `el10` are Rocky Linux (`amd64` and `arm64` UEFI). All three Rocky families go through Barn's recipe (`dba`, UID/GID 88). The current `el10` images also include signed kernel modules required by Docker's default bridge networking, iptables firewall rules, and overlay filesystem. `el7` remains the distribution's unmodified cloud image.
- `cloud-init` configures accounts and networking on first boot for every image.
- After a catalog refresh, existing nodes with unchanged definitions use their recorded image, even if the version has left the catalog. New nodes and explicit `barn recreate` operations resolve the selected image against the active catalog. [Catalog rotation tests](https://github.com/pgsty/barn/blob/v1.4.0/internal/linuxvm/catalog_rotation_test.go)

| Alias | Distribution | Architectures | Boot | Status |
|---|---|---|---:|---|
| `el7` | CentOS Linux 7.9 / 2211 | `amd64` | BIOS | `deprecated` |
| `el8` | Rocky Linux 8.10 | `amd64`, `arm64` | UEFI | `deprecated` |
| `el9` | Rocky Linux 9.9 | `amd64`, `arm64` | UEFI | `supported` |
| `el10` | Rocky Linux 10.3 | `amd64`, `arm64` | UEFI | `supported` |
| `d12`, `d13` | Debian 12 / 13 | `amd64`, `arm64` | UEFI | `supported` |
| `u22` | Ubuntu 22.04 LTS | `amd64`, `arm64` | UEFI | `deprecated` |
| `u24`, `u26` | Ubuntu 24.04 / 26.04 LTS | `amd64`, `arm64` | UEFI | `supported` |
{.wide .expand}

```bash
barn update
barn image list
barn image info d13
barn image info d13:stable
barn image info el9@9.9
barn image pull d13@20261123.2671.1
barn image pull d13 --arch arm64
```

`barn image list` prints every version and architecture in the active catalog along with registered `local-*` aliases. `barn image info` defaults to the host architecture (like `image pull`, unless an architecture-suffixed alias is given) and can inspect uncached catalog metadata without QEMU; if a local cache file is present, `info` also runs `qemu-img` verification on it. Neither `list` nor `info` downloads image files.

Catalog `status` values indicate support tier (`supported`, `testing`, `deprecated`, or `unknown`); non-`supported` images still boot normally and emit a status warning.

When pulling an image, Barn executes four steps:

1. **Load the active catalog** — Reads the selected repository's active local catalog once for the command (either the binary's embedded catalog or the revision last activated for that repository by `barn update` or `barn image sync`).
2. **Resolve the selector and architecture** — Resolves `image[:channel]` or `image@version-prefix` (or the active catalog's default if omitted) and the target architecture. Bare aliases in standalone `image pull` default to the host, while architecture-suffixed aliases select `arm64` or `amd64` directly; lifecycle commands use `vm_arch` (or an architecture-suffixed alias), also defaulting to the host when unset. `--arch/-A` overrides non-pinned choices and rejects conflicting pinned aliases; see [configuration precedence](../configuration/#image-and-architecture).
3. **Verify the local cache** — Reuses an existing cached file immediately if its byte size, SHA-256 digest, and `qemu-img` structural checks all pass.
4. **Download with resume and digest checks** — Downloads the artifact from the selected repository with automatic retries and HTTP range resumption, verifying the final size, SHA-256, and `qcow2` header before moving it into the cache. The two official mirrors (`https://repo.pigsty.io/barn` and `https://repo.pigsty.cc/barn`) can fall back to each other during artifact downloads, while custom `--repo` sources download exclusively from the specified root. Upstream URLs recorded in the catalog serve as provenance metadata only.
{.steps}

Repository selection precedence is `--repo` → `--mirror` (`https://repo.pigsty.cc/barn`) → `BARN_REPO` → compiled default (`https://repo.pigsty.io/barn`). Both official endpoints require valid ML-DSA-87 catalog signatures.

Barn tracks each repository separately under `$BARN_HOME/images/manifests/`. Pass the same `--repo` or set `BARN_REPO` when using its images. A freshly built local directory works immediately. For a custom HTTPS repository, run `barn update --repo <url>` to activate its catalog.

Barn automatically restores read-only permissions (`0444`) on verified cache files. If an unreferenced cached file fails verification, Barn renames it to `.corrupt-<timestamp>` before re-downloading; if a VM still uses that base image, Barn leaves the file in place and reports an integrity error.

## Runtime policy {#runtime-policy}

When guest and host architectures match, Barn uses hardware virtualization (Apple HVF on macOS, KVM on Linux) with one built-in exception: the stock Rocky Linux 8 `arm64` kernel uses a 64 KiB page size that Apple HVF does not support, so Barn automatically runs `el8` on Apple Silicon under same-architecture QEMU TCG and flags `tcg` in status output. Cross-architecture guests (after resolving `vm_arch` and any command override) also run under TCG; for `amd64` guests on `arm64` hosts, Barn pins TCG to a single translation thread to preserve x86 memory ordering.

The ARM64 TCG runtime uses `cortex-a72` to avoid firmware hangs with the `max` CPU model in some QEMU/AAVMF combinations. ARM64 guests on Linux x86-64 have passed an actual Barn boot and SSH check. Barn's catalog and runtime currently accept only `amd64` and `arm64`; other architectures offered by a distribution or QEMU still require Barn integration before use with `barn up`.

`el7` is supported only on native `linux/amd64`. On Linux hosts, `barn setup` installs the native QEMU package set; before booting a foreign `vm_arch` with `up` or `recreate`, install the target architecture's `qemu-system-*` emulator and UEFI firmware (`barn plan` can resolve catalog images without them, though `local-*` imports still require `qemu-img`).

```bash
barn image pull d13 --mirror
barn image pull d13 --repo https://mirror.example/barn
BARN_REPO=/absolute/local/repository barn up
```

## Trust and verification {#trust-and-verification}

Barn 1.5.0 checks `catalog.json.sig`. Barn 1.4.0 reads `catalog.json.minisig` over the same bytes. [Mirror and key instructions](../repository-signing/#bootstrap)

Release binaries embed the official ML-DSA-87 public key (private signing keys live outside the source repository). Catalog activation rejects unknown signing keys, malformed JSON, conflicting content at the same revision number (equivocation), and revisions lower than the repository's highest accepted revision unless `--allow-downgrade` is passed to `barn image sync`. A missing required signature, an invalid signature, or a revision with conflicting bytes produces [exit code `7` (`integrity`)](../cli/#exit-codes). A new trusted signature over identical catalog bytes is accepted, which also repairs a damaged cached signature.

Every cached or imported image must be a standalone `qcow2` file matching its declared byte size and SHA-256 digest, with no backing file, external data file, encryption, or unknown incompatible `qcow2` feature bits. Barn marks verified base images read-only and creates copy-on-write overlay disks for each VM node.

```bash
barn update
barn image sync --repo https://repo.example/barn \
  https://repo.example/barn/catalog.json
barn image sync --repo /srv/barn --allow-downgrade /srv/barn/catalog.json
barn image reset --repo /srv/barn
```

- **`barn update`** fetches, verifies, and activates the current catalog from `--repo` or `--mirror`.
- **`barn image sync`** activates a catalog from an explicit URL or file path (for unsigned custom repositories, the source path must be `<repo>/catalog.json`) and supports `--allow-downgrade`.
- **`barn image reset`** reverts the active catalog for `--repo` (or default repo) back to the binary's embedded catalog while keeping the recorded highest-revision watermark intact.

## Static repository format {#static-repository-format}

A static Barn image repository uses the following directory layout:

```filetree {title="/srv/barn"}
repo.yaml # Optional image definitions and policy (schema 1)
catalog.json # Generated runtime image catalog with digests and sizes (schema 3)
catalog.json.sig # ML-DSA-87, required for official and HTTP repositories
catalog.json.minisig # Compatibility sidecar for official 1.4.0 clients
images/
  <image>-<version>-<arch>.qcow2 # Immutable qcow2 image artifacts
```

Without `repo.yaml`, Barn reads `<image>-<version>-<arch>.qcow2`, selects the highest version of each family for `stable` and uses UEFI. An optional `repo.yaml` (`schema: 1`) declares defaults, aliases, channels, versions, architectures, boot modes, support status, `source_user` (for example, `rocky` upstream or `dba` after official normalization), and optional upstream provenance URLs—without manual checksums or byte sizes. `barn repo build` inspects the `qcow2` files and generates `catalog.json` (`schema: 3`) with each variant's filename, SHA-256 digest, file size, and virtual disk capacity.

```yaml {title="repo.yaml"}
schema: 1
revision: 1
defaults: { image: d13, channel: stable, arch: native, boot: uefi }
images:
  d13:
    aliases: [debian13, trixie]
    channels: { stable: "1" }
    versions:
      "1":
        status: unknown
        variants:
          amd64: {}
          arm64: {}
```

When a variant omits `file`, Barn expects `images/<image>-<version>-<arch>.qcow2` (for example, `images/d13-1-amd64.qcow2` and `images/d13-1-arm64.qcow2`).

Repository management rules (`barn repo scan|build|verify /absolute/repo`):

- Repository roots accept relative paths, `~/`, and directory symlinks. The root and `images/` may be shared writable directories. `repo.yaml` may link to a non-empty regular file up to 4 MiB. Artifact entries remain regular files; `catalog.json` output symlinks are not overwritten.
- Boot mode inherits along `variant` → `family` → `defaults.boot`; status inherits along `variant` → `version` → `unknown`. Every family must define the default channel pointing to an existing version, and family/alias names must be unique and cannot start with `local-`. Avoid reassigning built-in aliases (`ubuntu`, `debian`, `rocky`, etc.) to different families, because [inventory parsing](../configuration/#vm-variables) normalizes built-in aliases via the embedded catalog first.
- Channels and dot-separated numeric prefixes (`el9@9.9`, `el9@9`) resolve to an exact version key when present or the highest matching numeric version, yielding an immutable artifact identity `(image, exact version, arch)`:
  ```text
  d13:stable + native
    -> d13@20261130.2678.1 + arm64
    -> images/d13-20261130.2678.1-arm64.qcow2
  ```
- **`barn repo scan`** is read-only and does not require `qemu-img`; it exits `0` while reporting any `missing`, `unsafe`, or `untracked` files in its output arrays (automation must check that `missing` and `unsafe` are empty).
- **`barn repo build`** and **`barn repo verify`** use `qemu-img`. An unchanged rebuild preserves the catalog bytes. If you set `revision` explicitly, increase it when the contents change. Upload the images first, then the catalog with its applicable sidecars. [Build and verification](../commands/repo/#barn-repo-build)

## Local layout and imports {#local-image-import}

Barn stores cached catalogs, downloaded images, and local imports under `$BARN_HOME/images` (default `~/.barn/images`):

```filetree {title="$BARN_HOME/images"}
manifests/ # Active catalog.json and highest accepted revision per repository
local-images.json # Registry of named local-* image aliases
local/
  <sha256>.qcow2 # Imported local qcow2 files indexed by content digest
d13/
  d13-20261130.2678.1-arm64.qcow2 # Verified read-only catalog artifacts by family
  d13-20261130.2678.1-amd64.qcow2
```

Import a local `qcow2` file into the cache or register it under a `local-*` alias:

```bash
barn image import /path/to/debian-13-generic.qcow2
barn image import --name local-mybase --boot uefi \
  --source-user debian /path/to/debian-13-generic.qcow2
```

Import rules:

- `image import` accepts relative paths, `~/`, and symlinks to regular files, and requires `qemu-img`. Reads are bounded by the actual local file size or declared catalog size; downloads stop on overflow, while legacy downloads without a declared artifact size are bounded at 8 GiB. Optional `--sha256` verifies an expected digest.
- `image import` copies and validates the `qcow2` container as-is without modifying guest credentials, installing `cloud-init`, or booting the image.
- Source filenames may contain spaces or Unicode and need no particular extension; Barn validates the qcow2 contents. New imports use `local/<sha256>.qcow2`, so different images can share a source filename and identical bytes reuse a cache entry. Existing aliases keep their original cache paths when reimported. Updates that exceed the 1 MiB registry metadata limit fail before changing existing aliases.
- Named imports (`--name local-<alias>`) require `--boot bios|uefi` and `--source-user <user>` and default to the host architecture. `--arch/-A` can record an explicit `amd64` or `arm64` architecture, including aliases. The qcow2 metadata cannot identify the guest CPU, and import does not convert architectures. Match inventory `vm_arch` or the lifecycle command's `-A` when using the image. Aliases are immutable and can be referenced via `vm_image: local-mybase`; unnamed imports only pre-populate the cache and cannot accept `-A`.

## Pruning {#pruning}

```bash
barn image prune --dry-run
barn image prune --yes
```

`barn image prune` (or `barn image prune --dry-run`) lists candidate files that can be reclaimed; passing `--yes` deletes them.

`prune` protects images referenced by the selected repository's active catalog, applied nodes, and registered `local-*` aliases. It can remove unreferenced images, recognized staging files, and read-only quarantine files ending in `.qcow2.corrupt-<timestamp>` or `.img.corrupt-<timestamp>`. To retain a quarantined copy for inspection, copy it outside the cache before cleanup. Preview the candidates with `--dry-run` and the same `--repo` you will use for deletion. If a later file fails inspection, files already deleted by `prune --yes` stay deleted.

To export the binary's embedded schema-3 catalog byte-for-byte when bootstrapping a mirror, run `go run ./tools/catalogexport /absolute/new/catalog.json`. Any public catalog published at the embedded revision number must match those exact bytes.
