Skip to content

Image Repositories

Choose guest images, use a mirror, import a local qcow2, and prune the cache.

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

barn image list
barn image info
FamilyDistributionShort aliasesNotes
d13Debian 13d, debian, trixieDefault for new labs in 1.5.0
d12Debian 12bookworm
u24Ubuntu 24.04 LTSnoble
u26Ubuntu 26.04 LTSu, ubuntu, resolute
u22Ubuntu 22.04 LTSjammydeprecated
el10Rocky Linux 10e, el, rocky
el9Rocky Linux 9rocky9
el8Rocky Linux 8rocky8deprecated; arm64 runs under TCG on Apple Silicon
el7CentOS Linux 7.9c7, centos7deprecated (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:

barn.yml
all:
  vars:
    vm_image: el9
    vm_version: "9.9"
  hosts:
    10.10.10.10: {nodename: meta}

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:

barn.yml
all:
  vars:
    vm_image: d13@20261123.2671.1
  hosts:
    10.10.10.10: {nodename: meta}

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

barn plan -I d13 -A amd64
barn up -I d13 -A amd64

-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:

barn update --mirror
barn up -I d13 --mirror
barn image pull d13 --mirror

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:

barn update --repo https://mirror.example/barn
barn image pull d13 --repo https://mirror.example/barn
barn up -I d13 --repo https://mirror.example/barn

export BARN_REPO=https://mirror.example/barn
barn update
barn up -I d13

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:

barn image import --name local-mybase --boot uefi \
  --source-user debian /path/to/debian-13-generic.qcow2
  • --name (must start with local-), --boot (uefi or bios), and --source-user go together. Without them, Barn caches the verified qcow2 by 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 example barn 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’s vm_arch or the command’s -A to 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:

/srv/barn/repo.yaml
schema: 1
revision: 1
defaults: { image: d13, channel: stable, arch: native, boot: uefi }
images:
  d13:
    channels: { stable: "1" }
    versions:
      "1":
        status: testing
        variants:
          arm64:
            source_user: debian

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 /srv/barn
barn repo build /srv/barn
barn repo verify /srv/barn

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.

barn update --repo /srv/barn
barn image info d13 --arch arm64 --repo /srv/barn
barn image pull d13 --arch arm64 --repo /srv/barn

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:

barn image prune --dry-run
barn image prune --yes

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.

Table reader