Images
11 minute read
Barn resolves Linux guest images from a static catalog and immutable qcow2 artifacts. Official and HTTP repositories require Ed25519/minisign 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.
el7 (CentOS Linux 7.9) is a deprecated compatibility image. Every other version in the embedded catalog is supported.
Aliases and pull order
Barn 1.2.0 embeds image catalog 2026110502, including Debian 13 image 20261103.2651.1. It covers 9 distribution families with one stable version each, for 17 image artifacts: el7 is amd64-only, and every other family provides both amd64 and arm64. When no image is specified, Barn selects u24:stable (Ubuntu 24.04 LTS) on the host’s native architecture.
The table below lists the stable channel targets in embedded catalog 2026110502. Run barn update followed by barn image list to inspect the latest catalog published on your selected repository, and see Platforms and Limits for host support details.
| Family | Embedded stable |
Accepted aliases |
|---|---|---|
d12 |
20261026.2643.1 |
debian12, bookworm |
d13 |
20261103.2651.1 |
debian13, debian, trixie |
el7 |
7.9.20221112.0 |
c7, centos7, centos79 |
el8 |
8.10.20240528.3 |
rocky8 |
el9 |
9.8.20260525.2 |
rocky9, rocky |
el10 |
10.2.20260525.0 |
rocky10 |
u22 |
20261020.0.1 |
ubuntu22, ubuntu2204, jammy |
u24 |
20261017.0.1 |
ubuntu, ubuntu24, ubuntu2404, noble |
u26 |
20261016.0.1 |
ubuntu26, ubuntu2604, resolute |
Distribution notes:
u22,u24, andu26are Ubuntu 22.04, 24.04, and 26.04 LTS;d12andd13are Debian 12 and 13. Barn’s image recipe builds them from the distributions’ cloud images: the image ships adbauser (UID/GID 88), XFS userspace tools are present, anden_US.UTF-8is available whileC.UTF-8stays the default locale.el7is CentOS Linux 7.9 (amd64BIOS), andel8,el9, andel10are Rocky Linux (amd64andarm64UEFI).el8andel9go through the same recipe (dba, UID/GID 88);el10andel7are the distributions’ unmodified cloud images.cloud-initconfigures accounts and networking on first boot for every image.- Running
barn updateupdates what:stableor a numeric prefix resolves to for new nodes without altering running VMs or pinned@versionselectors. If an existing inventory uses a channel or prefix whose target changed in the updated catalog,barn planandbarn upreport the image drift and requirebarn recreatebefore replacing any node.
| Alias | Distribution | Architectures | Boot | Status |
|---|---|---|---|---|
el7 |
CentOS Linux 7.9 / 2211 | amd64 |
BIOS | deprecated |
el8 |
Rocky Linux 8.10 | amd64, arm64 |
UEFI | supported |
el9 |
Rocky Linux 9.8 | amd64, arm64 |
UEFI | supported |
el10 |
Rocky Linux 10.2 | amd64, arm64 |
UEFI | supported |
d12, d13 |
Debian 12 / 13 | amd64, arm64 |
UEFI | supported |
u22, u24, u26 |
Ubuntu 22.04 / 24.04 / 26.04 LTS | amd64, arm64 |
UEFI | supported |
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) 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:
- 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 updateorbarn image sync). - Resolve the selector and architecture — Resolves
image[:channel]orimage@version-prefix(defaulting tou24:stableon the official catalog) and the target architecture. Standaloneimage pulldefaults to the host; lifecycle commands usevm_arch, also defaulting to the host when unset.--arch/-Aoverrides either choice; see configuration precedence. - Verify the local cache — Reuses an existing cached file immediately if its byte size, SHA-256 digest, and
qemu-imgstructural checks all pass. - 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
qcow2header before moving it into the cache. The two official mirrors (https://repo.pigsty.io/barnandhttps://repo.pigsty.cc/barn) can fall back to each other during artifact downloads, while custom--reposources download exclusively from the specified root. Upstream URLs recorded in the catalog serve as provenance metadata only.
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 minisign catalog signatures.
Because each repository root maintains its own active catalog state in $BARN_HOME/images/manifests/, pass the same --repo (or BARN_REPO) when working with a custom repository—even after its images are cached locally—and run barn update --repo <root> before using custom aliases from a newly selected repository. Once the catalog and image files are cached and verified, all ordinary commands work offline.
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
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).
Trust and verification
Release binaries embed both production Ed25519 public verification keys (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 or failed signature and an equivocating revision exit 7 (integrity; see 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.
barn updatefetches, verifies, and activates the current catalog from--repoor--mirror.barn image syncactivates 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 resetreverts 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
A static Barn image repository uses the following directory layout:
/srv/barn
- repo.yamlAuthoritative human-edited policy and version declarations (schema 1)
- catalog.jsonGenerated runtime image catalog with digests and sizes (schema 3)
- catalog.json.minisigMinisign signature (required for official and HTTP repositories)
images/
- <image>-<version>-<arch>.qcow2Immutable qcow2 image artifacts
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.
When a variant omits file, Barn expects images/<image>-<version>-<arch>.qcow2 (for example, images/u24-1-amd64.qcow2 and images/u24-1-arm64.qcow2).
Repository management rules (barn repo scan|build|verify /absolute/repo):
- Repository roots accept relative paths,
~/, and directory symlinks. The root andimages/may be shared writable directories.repo.yamlmay link to a non-empty regular file up to 4 MiB. Artifact entries remain regular files;catalog.jsonoutput symlinks are not overwritten. - Boot mode inherits along
variant→family→defaults.boot; status inherits alongvariant→version→unknown. Every family must define the default channel pointing to an existing version, and family/alias names must be unique and cannot start withlocal-. Avoid reassigning built-in aliases (ubuntu,debian,rocky, etc.) to different families, because inventory parsing normalizes built-in aliases via the embedded catalog first. - Channels and dot-separated numeric prefixes (
el9@9.8,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): barn repo scanis read-only and does not requireqemu-img; it exits0while reporting anymissing,unsafe, oruntrackedfiles in its output arrays (automation must check thatmissingandunsafeare empty).barn repo buildandbarn repo verifyrequireqemu-img.buildvalidatesrepo.yaml, inspects everyqcow2artifact, and atomically writescatalog.json(failing if any declared artifact ismissingorunsafe, and omittinguntrackedfiles).verifychecks that the existingcatalog.jsonmatches a fresh build byte-for-byte. Incrementrevisionwhenever catalog contents change, upload immutable.qcow2files before updatingcatalog.jsonandcatalog.json.minisig, and publish the catalog and signature together.
Local layout and imports
Barn stores cached catalogs, downloaded images, and local imports under $BARN_HOME/images (default ~/.barn/images):
$BARN_HOME/images
- manifests/Active catalog.json and highest accepted revision per repository
- local-images.jsonRegistry of named local-* image aliases
local/
- <sha256>.qcow2Imported local qcow2 files indexed by content digest
d13/
- d13-20261103.2651.1-arm64.qcow2Verified read-only catalog artifacts by family
u24/
- u24-20261017.0.1-arm64.qcow2
Import a local qcow2 file into the cache or register it under a local-* alias:
Import rules:
image importaccepts relative paths,~/, and symlinks to regular files, and requiresqemu-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--sha256verifies an expected digest.image importcopies and validates theqcow2container as-is without modifying guest credentials, installingcloud-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|uefiand--source-user <user>and default to the host architecture.--arch/-Acan record an explicitamd64orarm64architecture, including aliases. The qcow2 metadata cannot identify the guest CPU, and import does not convert architectures. Match inventoryvm_archor the lifecycle command’s-Awhen using the image. Aliases are immutable and can be referenced viavm_image: local-mybase; unnamed imports only pre-populate the cache and cannot accept-A.
Pruning
barn image prune (or barn image prune --dry-run) lists candidate files that can be reclaimed; passing --yes deletes them.
prune protects all artifacts referenced by the selected repository’s active catalog, all base image digests used by currently applied nodes, and all registered local-* aliases (preserving cached images across destroy and purge). Only unreferenced images from older catalogs or other repositories and recognized stale staging files become candidates; quarantined .corrupt-* files are left in place for manual inspection, and unexpected/unsafe files cause an error. Always preview with --dry-run (passing --repo when checking a custom repository), as prune --yes deletes candidates sequentially without rolling back earlier deletions if a later file fails inspection.
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.