Image Commands
7 minute read
Refresh signed catalogs, inspect or download images, import local files, and prune caches.
This reference covers Barn 1.4.0. Option tables give the earliest version for each option. 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
Fetch catalog.json and its signature when required by repository policy, verify trust and revision rules, then atomically activate the catalog. Ordinary commands use local metadata and never update it implicitly. This updates image metadata, not the Barn executable. Repository precedence is --repo > --mirror > BARN_REPO > the global official repository. See repository selection and trust.
| Option | Meaning / default | Available in |
|---|---|---|
--mirror |
use the China official repository at repo.pigsty.cc; overridden by --repo |
1.1.0 |
-r, --repo string |
image repository URL or directory; overrides --mirror and $BARN_REPO |
1.1.0 |
barn image list
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.
| Option | Meaning / default | Available in |
|---|---|---|
-r, --repo string |
image repository URL or directory; overrides $BARN_REPO | 1.1.0 |
barn image info
Inspect metadata and verified cache state for one image, using the catalog default if omitted. Select a family (u24), shorthand family alias (e/el/rocky → el10, u/ubuntu → u26, d/debian → d13), architecture-suffixed alias (el10a, u24x, d13i), channel (u24:stable), or numeric version prefix (el9@9). Architecture defaults to native; combining an architecture-suffixed alias with an explicit --arch/-A (including native) fails with 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.
| Option | Meaning / default | Available in |
|---|---|---|
-A, --arch string |
artifact architecture (defaults to native): native, amd64 (x86_64, x64), or arm64 (aarch64, a64) | 1.1.0 |
-r, --repo string |
image repository URL or directory; overrides $BARN_REPO | 1.1.0 |
barn image pull
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 u24x work here as well (and conflict with an explicit --arch/-A, including native). 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.
| Option | Meaning / default | Available in |
|---|---|---|
-A, --arch string |
artifact architecture (defaults to native): native, amd64 (x86_64, x64), or arm64 (aarch64, a64) | 1.1.0 |
--mirror |
use the China official repository at repo.pigsty.cc; overridden by --repo |
1.1.0 |
-r, --repo string |
image repository URL or directory; overrides --mirror and $BARN_REPO |
1.1.0 |
barn image update
Available in the 1.4.0. 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.
| Option | Effect | Available in |
|---|---|---|
-A, --arch string |
Select one architecture, including native, amd64 or arm64 |
1.4.0 |
-d, --dry-run |
Verify the candidate catalog and preview downloads and requested cleanup without writing local state | 1.4.0 |
--prune |
After successful downloads, remove files eligible under the normal pruning rules | 1.4.0 |
--mirror |
Select the China official repository | 1.4.0 |
-r, --repo string |
Select a repository URL or directory. Takes precedence over --mirror and BARN_REPO |
1.4.0 |
--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
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.
| Option | Meaning / default | Available in |
|---|---|---|
-A, --arch string |
Guest architecture recorded with --name; defaults to native; does not convert the image |
1.1.0 |
-b, --boot string |
required with --name: bios or uefi |
1.1.0 |
--name string |
Immutable local-* alias; requires --boot and --source-user |
1.1.0 |
-s, --sha256 string |
optional expected SHA-256 | 1.1.0 |
-u, --source-user string |
required with --name: source image login user |
1.1.0 |
barn image sync
Activate a catalog from one exact URL or local file, reading its adjacent .minisig 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.
| Option | Meaning / default | Available in |
|---|---|---|
--allow-downgrade |
activate a catalog older than the newest revision seen so far | 1.1.0 |
-r, --repo string |
Repository whose active catalog is replaced | 1.1.0 |
barn image reset
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.
| Option | Meaning / default | Available in |
|---|---|---|
-r, --repo string |
Repository whose active catalog is reset to the embedded catalog | 1.1.0 |
barn image prune
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.
| Option | Meaning / default | Available in |
|---|---|---|
-d, --dry-run |
show unreferenced images and stale staging files without deleting | 1.1.0 |
-r, --repo string |
image repository URL or directory; overrides $BARN_REPO | 1.1.0 |
-y, --yes |
Delete the listed unreferenced files; mutually exclusive with --dry-run |
1.1.0 |
Implementation
The version baseline identifies the released source and the changes across 1.1.0–1.4.0.