Image Repositories
7 minute read
On first use of an official Linux image, Barn downloads the selected base image and verifies it against the signed catalog. New labs in 1.5.0 use d13:stable (Debian 13) for your host architecture. On Barn 1.4.0, use barn init -I d13 to start with Debian 13. Use this page to pick another distribution, download from the China mirror, bring your own qcow2, host a repository, or reclaim disk space.
Choose an image
| Family | Distribution | Short aliases | Notes |
|---|---|---|---|
d13 | Debian 13 | d, debian, trixie | Default for new labs in 1.5.0 |
d12 | Debian 12 | bookworm | |
u24 | Ubuntu 24.04 LTS | noble | |
u26 | Ubuntu 26.04 LTS | u, ubuntu, resolute | |
u22 | Ubuntu 22.04 LTS | jammy | deprecated |
el10 | Rocky Linux 10 | e, el, rocky | |
el9 | Rocky Linux 9 | rocky9 | |
el8 | Rocky Linux 8 | rocky8 | deprecated; arm64 runs under TCG on Apple Silicon |
el7 | CentOS Linux 7.9 | c7, centos7 | deprecated (EOL); amd64 only, native linux/amd64 hosts only |
Append a to a family name (or to e, el, d, u) for arm64, or x/i for amd64: d13x, el10a, da. Deprecated images still boot and print a status warning. If you upgraded from Barn 1.2.0, note that rocky and ubuntu now point to el10 and u26; see Upgrade Barn. The full alias list is in the image reference.
Set the image for the whole lab in the inventory:
A bare family such as el9 follows its stable channel; name:channel picks another channel, and name@full-version pins one build (a shorter numeric prefix can match several versions). vm_version is a numeric prefix matched on dot boundaries: "9.9" selects the newest 9.9.x build in the active catalog, "9" the newest 9.x. Quote it so YAML keeps it a string, and don’t combine it with a :channel or @version suffix.
To get the same build after future catalog updates, pin the full version that barn image info reports:
After changing vm_image or vm_version, run barn plan. Existing nodes keep their root disk until you run barn recreate <node>. barn update fetches, verifies, and activates the newest catalog; it changes only what new or recreated nodes get.
To refresh cached images, preview the downloads with barn image update --dry-run and then run barn image update. An empty cache refreshes only the catalog. Use barn image update d13i d13a for a first download of both Debian 13 architectures.
Override image or architecture for one command
-I (--image) and -A (--arch) override the inventory for one command and leave the file as it is. Guests use the host architecture unless vm_arch or -A says otherwise, and -A native follows the host again. An architecture-suffixed alias such as -I d13x selects the family and architecture together. With such an alias, an explicit -A or BARN_ARCH must name the matching architecture. A different architecture or native fails validation.
To keep an override, set vm_image and all.vars.vm_arch in the inventory (removing a superseded vm_version), or generate a new inventory with barn init -I d13 -A amd64 or barn init -I d13x. Existing nodes need recreate to change image or architecture, and an architecture change must include every existing node. Precedence rules and architecture spellings are in Image and architecture overrides.
For a bare alias, standalone barn image info and barn image pull default to the host architecture. Use an architecture-suffixed alias or pass -A to select another. These commands ignore both vm_arch and BARN_ARCH. If the image has no build for that architecture, the command fails. Barn runs only amd64 and arm64 guests. A guest whose architecture differs from the host runs under TCG emulation; on Linux, install the emulator first (see HVF, KVM, or an emulator is unavailable).
Download from the China mirror
Release builds download from https://repo.pigsty.io/barn. Add --mirror to use the China mirror, https://repo.pigsty.cc/barn:
Downloads from either official repository retry transient errors, resume partial transfers, and switch to the other official repository if an artifact is unreachable.
To use your own repository, pass --repo with a URL or local directory, or export BARN_REPO for the shell session:
The precedence is --repo → --mirror → BARN_REPO → https://repo.pigsty.io/barn. A custom --repo downloads only from that root, with no fallback. Barn reads a built local directory’s catalog.json on first use. For a custom HTTPS server, activate its catalog with barn update --repo <url> first. Use the same --repo for later commands.
The official repositories and any plain http:// repository must serve a valid ML-DSA-87 signature (catalog.json.sig); a local directory or custom https:// endpoint may serve an unsigned catalog.json. Either way, each download must match the catalog’s byte size and SHA-256 and pass qemu-img checks; see Trust and verification.
Import a local qcow2
To use one custom image without running a repository, import it under a local- alias and set vm_image: local-mybase in the inventory:
--name(must start withlocal-),--boot(uefiorbios), and--source-usergo together. Without them, Barn caches the verifiedqcow2by content digest but creates no alias.- The image must already include cloud-init, which Barn uses for first-boot provisioning.
local-*aliases are immutable. Register a new name each time you rebuild the image.- The recorded architecture defaults to the host.
-A(which requires--name) records a different one, for examplebarn image import /path/to/debian-13-generic-arm64.qcow2 --name local-arm64 --boot uefi --source-user debian -A arm64. Barn records the declaration without converting the image or detecting its guest CPU, so set the inventory’svm_archor the command’s-Ato match.
See Prune the cache to check which images Barn can reclaim.
Build a static repository
A repository lets several hosts or a team share the same images, or work offline. It is a plain directory that you can serve over HTTP or HTTPS, copy with rsync, or read from a local path:
/srv/barn
barn/
- repo.yamlOptional metadata
- catalog.jsonGenerated catalog with SHA-256 and file sizes
- catalog.json.sigRequired for official and plain HTTP repositories
images/
- d13-1-arm64.qcow2Verified cloud-init qcow2 base image
With images/d13-1-arm64.qcow2 in place, run barn repo build /srv/barn and barn repo verify /srv/barn. Use the directory immediately with barn image info d13 --repo /srv/barn. To specify the upstream login user and mark the image as testing, add this optional file before building:
Put the cloud-init-capable image at /srv/barn/images/d13-1-arm64.qcow2 (relative roots, directory symlinks, and shared writable directories all work). Then, on a host with qemu-img, generate and check the catalog:
barn repo scan inspects the layout. barn repo build checks the image files and records their SHA-256, size and virtual capacity. If you set revision in repo.yaml, increase it when the contents change. Publish the images before the catalog and its signatures. Signing an official mirror
To cache the local catalog and test a download, run the following commands.
Pass --repo /srv/barn (or export BARN_REPO=/srv/barn) to plan, up, and recreate, and set vm_image: d13@1 in the inventory. To switch /srv/barn back to the binary’s built-in catalog while keeping its anti-rollback high-water mark, run barn image reset --repo /srv/barn. The file formats are in Static repository format.
Prune the cache
barn image prune reclaims disk space from cached images that nothing references and from interrupted download staging files. Preview first, then delete:
Pruning needs qemu-img. It keeps every image in the selected repository’s active catalog, every base image used by a node in BARN_HOME, and every registered local-* alias. Use the same --repo for the preview and the deletion. Details are in Pruning; to build new base images from upstream cloud releases, see Image Pipeline.