Skip to content

Image Commands

Refresh signed catalogs, inspect or download images, import local files, and prune caches.

Refresh signed catalogs, inspect or download images, import local files, and prune caches.

barn image update is available from 1.4.0. Version baseline · Global options

Official repositories and HTTP sources require a trusted detached signature. An explicitly selected custom HTTPS repository or local directory can be unsigned, provided the source is exactly that repository’s catalog.json. Any supplied signature must verify. See catalog trust.

barn update

barn update [flags]

Fetch catalog.json and its signature when required by repository policy, verify trust and revision rules, then atomically activate the catalog. Ordinary commands read local metadata. A newly built local repository can be read directly before its first explicit update. Remote catalogs require an explicit refresh. This updates image metadata, not the Barn executable. Repository precedence is --repo > --mirror > BARN_REPO > the global official repository. See repository selection and trust.

OptionMeaning / defaultAvailable in
--mirroruse the China official repository at repo.pigsty.cc; overridden by --repo1.1.0
-r, --repo stringimage repository URL or directory; overrides --mirror and $BARN_REPO1.1.0
barn update
barn update --mirror
barn --json update --repo /srv/barn

barn image list

barn image list [flags]

List every catalog architecture and registered local image. It has no image selector or architecture filter. The active local catalog is used; run barn update explicitly to refresh it. Aliases barn images and barn im select the same image command group.

Aliases: ls.

OptionMeaning / defaultAvailable in
-r, --repo stringimage repository URL or directory; overrides $BARN_REPO1.1.0
barn image list
barn --json image list
barn image list --repo /srv/barn

barn image info

barn image info [image[:channel]|image@version-prefix] [flags]

Inspect metadata and verified cache state for one image, using the catalog default if omitted. Select a family (d13), shorthand family alias (e/el/rocky → el10, u/ubuntu → u26, d/debian → d13), architecture-suffixed alias (el10a, d13x, da), channel (d13:stable), or numeric version prefix (el9@9). Architecture defaults to native; an explicit -A arm64 agrees with d13a, while -A amd64 or -A native conflicts with it (exit 2). The compatibility spelling --architecture/-a is also accepted for --arch/-A. It does not download the artifact. Supported aliases and exact embedded versions are in Linux images.

Aliases: in.

OptionMeaning / defaultAvailable in
-A, --arch stringartifact architecture (defaults to native): native, amd64 (x86_64, x64), or arm64 (aarch64, a64)1.1.0
-r, --repo stringimage repository URL or directory; overrides $BARN_REPO1.1.0
barn image info
barn image info el10a
barn image info d13 -A arm64
barn --json image info el9@9

barn image pull

barn image pull [image[:channel]|image@version-prefix] [flags]

Download the selected artifact and verify its SHA-256, byte size, qcow2 structure, and virtual capacity before activating the cache entry. Omitted image and architecture select the catalog default and native host architecture. Shorthand family and architecture-suffixed aliases such as el10a and d13x work here as well (a matching -A is accepted, a conflicting architecture or explicit native exits 2). Existing valid cached bytes are reused. The catalog’s upstream URL is provenance, not a download fallback. --architecture/-a remains a compatibility alias. A foreign artifact does not install the corresponding QEMU emulator.

Aliases: p.

OptionMeaning / defaultAvailable in
-A, --arch stringartifact architecture (defaults to native): native, amd64 (x86_64, x64), or arm64 (aarch64, a64)1.1.0
--mirroruse the China official repository at repo.pigsty.cc; overridden by --repo1.1.0
-r, --repo stringimage repository URL or directory; overrides --mirror and $BARN_REPO1.1.0
barn image pull
barn image pull d13 --mirror
barn image pull d13 -A amd64 --repo /srv/barn

barn image update

barn image update [image[:channel]...] [flags]

Barn refreshes the selected repository’s catalog under its trust policy, then downloads and verifies the selected files. With no arguments, it updates the image families and architectures already in the cache. An empty cache results in a catalog refresh only.

To fetch a specific build into an empty cache, name an architecture alias such as d13i (amd64) or d13a (arm64). A bare family such as d13 updates its cached architectures and uses the host architecture for its first download. The default channel is stable. Use image pull for a pinned version such as d13@20261123.2671.1. Existing VMs keep their original base images.

The command alias is u.

OptionEffectAvailable in
-A, --arch stringSelect one architecture, including native, amd64 or arm641.4.0
-d, --dry-runVerify the candidate catalog and preview downloads and requested cleanup without writing local state1.4.0
--pruneAfter successful downloads, remove files eligible under the normal pruning rules1.4.0
--mirrorSelect the China official repository1.4.0
-r, --repo stringSelect a repository URL or directory. Takes precedence over --mirror and BARN_REPO1.4.0
barn image update --dry-run
barn image update d13i d13a
barn image update --mirror --prune --dry-run

--prune applies to the whole cache, including when you name individual images. The active catalog, applied VMs and registered local aliases protect the files they reference. Pruning rules

barn image import

barn image import <path> [flags]

Copy a local regular qcow2 image into the private cache and validate its container, optionally against an expected digest. Relative paths, ~/, and symlinks to regular files are accepted. qemu-img is required; importing does not boot the image, add cloud-init, or change credentials.

A local-* name registers an immutable inventory reference and requires boot mode plus the source login user. Named imports can record a foreign architecture with -A; qcow2 metadata does not identify CPU architecture, and unnamed imports cannot use -A. Set both vm_image and a matching vm_arch when using it. See import and cache rules.

Aliases: i.

OptionMeaning / defaultAvailable in
-A, --arch stringGuest architecture recorded with --name; defaults to native; does not convert the image1.1.0
-b, --boot stringrequired with --name: bios or uefi1.1.0
--name stringImmutable local-* alias; requires --boot and --source-user1.1.0
-s, --sha256 stringoptional expected SHA-2561.1.0
-u, --source-user stringrequired with --name: source image login user1.1.0
barn image import ./base.qcow2
barn image import ./debian-13-generic-arm64.qcow2 --name local-dev --boot uefi --source-user debian -A arm64

barn image sync

barn image sync <url|path> [flags]

Activate a catalog from one exact URL or local file, reading its adjacent .sig signature under the trust policy above. This is the recovery/import path; use update for the configured repository’s normal endpoint. --repo chooses which repository’s active metadata to replace. An unsigned custom source must be exactly <repo>/catalog.json; an arbitrary recovery file requires a trusted signature.

Older revisions require --allow-downgrade. For custom repositories that allow unsigned catalogs, switching from a previously signed catalog to an unsigned one also requires this flag. It never permits an invalid signature or bypasses the official-repository signature requirement and revision-content checks. Future downgrade protection still remembers the highest revision.

Aliases: sy.

OptionMeaning / defaultAvailable in
--allow-downgradeactivate a catalog older than the newest revision seen so far1.1.0
-r, --repo stringRepository whose active catalog is replaced1.1.0
barn image sync /srv/barn/catalog.json
barn image sync --repo /srv/barn /srv/recovery/catalog.json
barn image sync --allow-downgrade /srv/recovery/catalog.json

barn image reset

barn image reset [flags]

Reactivate the catalog embedded in the current binary for the selected repository. It keeps the highest accepted revision used by downgrade protection. Cached images and VM disks are retained; this is not a cache deletion command.

OptionMeaning / defaultAvailable in
-r, --repo stringRepository whose active catalog is reset to the embedded catalog1.1.0
barn image reset
barn --json image reset --repo /srv/barn

barn image prune

barn image prune [flags]

List reclaimable cache files by default. Use --yes to delete the candidates or --dry-run to preview them. The selected active catalog, applied node base-image digests, and registered local aliases protect their referenced images. Recognized staging files and read-only quarantine files such as *.qcow2.corrupt-<timestamp> are also eligible for removal.

Preview with the same repository selection you will use for deletion. Deletion is sequential; an error on a later file does not restore files already removed. See pruning rules.

Aliases: pr.

OptionMeaning / defaultAvailable in
-d, --dry-runshow unreferenced images and stale staging files without deleting1.1.0
-r, --repo stringimage repository URL or directory; overrides $BARN_REPO1.1.0
-y, --yesDelete the listed unreferenced files; mutually exclusive with --dry-run1.1.0
barn image prune --dry-run
barn image prune --repo /srv/barn --dry-run
barn image prune --repo /srv/barn --yes

Implementation

The 1.5.0 image commands are in cmd/barn/command_image.go and cmd/barn/images.go. Catalog verification is covered by internal/image/manifest_test.go.

The version baseline lists changes through 1.5.0.

Table reader