Skip to content

Troubleshooting

Short, safe runbooks for setup, networking, images, drift, interrupted state, and SSH.

Linux lab problems in the order you are likely to hit them. Each entry gives the Symptom, a Check to confirm it, and the Fix. For macOS VMs, see macOS troubleshooting.

Run barn doctor first

barn doctor
barn network status
barn status

barn doctor probes the host without changing it: platform, QEMU and qemu-img, required QEMU devices, a short HVF or KVM boot, UEFI firmware, /dev/kvm on Linux, the OpenSSH client, deployment state and free space under BARN_HOME, and the host network. Each problem prints a detail: line and, when Barn knows one, a fix: line.

A failed compute check exits 3. Network problems show as blocked without changing the exit code, so read barn network status too. barn status also reconciles interrupted VM state when no other command holds the lock. Add --json to any of the three for scripts and bug reports.

Install fails or barn is not found

Symptom: The installer can’t reach GitHub, or after installing, the shell says barn: command not found or barn version shows an older release.

Check:

command -v barn
barn version
echo "$PATH"

Fix:

  • Download fails: the installer downloads from GitHub Releases (--mirror changes only the guest image repository). If you need a proxy, export HTTPS_PROXY or ALL_PROXY in the shell; CLI tools don’t pick up proxies from macOS System Settings.

  • Not found or old version: the user-scoped installer puts binaries in ~/.local/bin. Add it to PATH and run the check again:

    export PATH="$HOME/.local/bin:$PATH"

    With two installs (for example ~/.local/bin and Homebrew), update the one PATH selects; see Upgrade Barn.

  • Keep barn and barn-hosts-helper from the same release, in their packaged directory layout.

barn up finds no inventory

Symptom: plan, up, or validate fails with no inventory found in this directory (exit 2, reason: no_inventory), or barn status reports no deployment state found.

Check:

ls barn.yml barn.yaml pigsty.yml pigsty.yaml
barn status

Fix: Run the command where the inventory is, pass -f /path/to/file, or create one with barn init. In a terminal, barn up writes a starter barn.yml itself; without one, run barn setup --yes and then barn up.

Without -f, plan, up, reload, resize, and recreate look for barn.yml, barn.yaml, pigsty.yml, and pigsty.yaml, in that order, and fall back to the applied inventory in BARN_HOME only when none exists. A syntax error in the first match stops the command; pass -f pigsty.yml when an old barn.yml sits beside it. no deployment state found means the active BARN_HOME is new or was purged. See Discovery.

First barn up or barn setup stops at sudo

Symptom: The first barn up or barn setup asks for your password, or fails with sudo needs a password, but stdin is not a terminal (exit 3, reason: sudo_unavailable).

Check: Preview the host changes without applying them:

barn setup --dry-run

Fix: Run the command in a terminal. Barn prints the exact host change, then hands the terminal to sudo; one password covers the whole command. --yes accepts Barn’s plan but can’t answer sudo, so automation needs cached sudo credentials or a NOPASSWD sudoers rule. On macOS, barn setup downloads and verifies the pinned socket_vmnet package before asking for sudo, so a failed download never prompts. All setup options are in barn setup.

barn init won’t write through a symlink

Symptom: barn init --force reports will not overwrite …: it is a symlink.

Check:

readlink -f barn.yml

Fix: Barn never writes through an output-file symlink. Pass the link’s target instead:

barn init -o "$(readlink -f barn.yml)" --force

Directory symlinks are fine, and barn init -o ./lab/config/barn.yml creates missing parent directories.

HVF, KVM, or an emulator is unavailable

Symptom: barn doctor reports an error for hvf-real-smoke or kvm-real-smoke, accelerator, kvm, qemu, or firmware; or a foreign-architecture guest fails with QEMU is not installed (… not found in PATH) (exit 3, reason: qemu_missing).

Check:

barn doctor
ls -l /dev/kvm      # Linux hosts

Fix:

  • KVM on Linux: enable KVM and give your user read/write access to /dev/kvm.
  • QEMU or firmware missing: run barn setup to install the host packages.
  • Foreign architecture on Linux: barn setup installs only the host-native emulator. Install the matching qemu-system-* binary and UEFI firmware before running a guest with a different vm_arch. Homebrew’s qemu on macOS includes both the arm64 and amd64 emulators.

Barn runs native guests only with HVF (macOS) or KVM (Linux) and never falls back to TCG software emulation when they fail. TCG is used only for a foreign vm_arch or a built-in compatibility rule such as el8 arm64 on Apple Silicon; see Runtime policy.

Host network is stopped, partial, or invalid

Symptom: barn doctor shows network-* checks as blocked and warns the Barn network is not ready; run barn setup to prepare it, or barn network status reports partial or invalid.

Check:

barn network status --json --verbose

Fix:

  • Stopped but intact: in a terminal, barn up adds the restart to its host plan and asks once. Without a terminal, run barn setup --yes.

  • partial or invalid: let Barn remove what it owns instead of deleting system network files by hand. Stop the deployment first; uninstall refuses while any node is running. Then prepare the network again:

    barn network uninstall --json     # show the removal plan
    barn network uninstall --yes
    barn setup --yes
  • Linux bridge test failed during setup: Barn rolls the network changes back automatically. Clean up by hand only when it reports automatic rollback failed.

  • macOS /var/log/barn-vmnet: barn setup fixes a missing or too-restrictive directory (root:wheel 0755) but won’t touch a symlink, a directory with a foreign owner, or a group- or world-writable one. Run the exact command barn network status prints.

Linux bridge helper is not usable

Symptom: barn doctor flags bridge-helper, for example … is not yet usable by this user or … the invoking user is not in group ….

Check:

id
stat -c '%U:%G %a %n' /usr/lib/qemu/qemu-bridge-helper
dpkg-statoverride --list /usr/lib/qemu/qemu-bridge-helper

Fix:

  • Debian and Ubuntu: the helper should be root:<group> 4750, with a group your user belongs to. barn setup sets this through dpkg-statoverride, and barn network uninstall restores the original. If another user installed the Barn network, uninstall it as that user, then run barn setup as yourself.
  • RPM-family hosts: the packaged mode is 4755 and Barn doesn’t change it. If the mode differs, reinstall the distribution’s QEMU packages.

A node did not become ready

Symptom: barn up exits 5 with N of M node(s) failed: <node> (<stage>: <error>), or it exits 0 but lists warnings under nodes[].warnings.

Check:

barn status
barn logs <node>                  # guest serial console
barn logs <node> --source qemu    # QEMU stderr and diagnostics
barn logs --source events         # host setup and deployment events

Fix: Barn reads /var/lib/barn/ready.json over management SSH. The node name, generation, and configuration hash (spec_hash) must match the host’s expected values. Fix the cause the logs show, then run barn up again. It retries only the unfinished stages and doesn’t restart healthy VMs. Add --rollback to remove the artifacts of a failed first preparation in the same run.

Optional guest setup stages record warnings. When all selected nodes pass readiness, barn up can exit 0 with these warnings.

WarningFix
Data disk unavailableFix the missing device, missing filesystem tool, busy mount, or host I/O error, then run barn up. A disk with a partition table, a signature without a UUID, or unsupported filesystem features keeps its data and stays unmounted; see what survives each operation.
Shared directory is read-onlyCheck write permissions on the host and in the guest, then run barn up.
Guest hosts or control-node SSH incompleteRun barn up to rewrite the managed files in the guest.
Private interface unavailableCheck barn network status, repair the host bridge or vmnet, then run barn up.

Linux shared folders need 9p support in both QEMU and the guest kernel, on macOS and Linux hosts alike. If the guest kernel lacks 9p, copy files with SSH, scp, or rsync instead.

SSH to a node fails

Symptom: ssh meta or barn ssh meta fails, or barn up reports a control-ssh warning.

Check:

barn status
barn ssh-config
barn logs <node>

Fix:

What you seeFix
barn ssh meta works but ssh meta doesn’t~/.ssh/config is a symlink or hard link, so Barn wrote ~/.ssh/barn_config and printed an Include line instead. Add that line to your config.
The deployment’s private SSH key is missingRestore it from a backup. Barn never generates a replacement key for existing VMs. A missing .pub file is rebuilt from the private key automatically.
control-ssh warningThe control node’s copy of the private key is missing; host-to-guest SSH still works. Run barn up to restore it.
A remote command is parsed as Barn flagsPut -- between the node name and the command: barn exec meta -- hostname. See Remote commands.

Two cases need no action: if another process takes a stopped VM’s loopback SSH port, the next barn start or barn up picks a free port and updates ~/.ssh/barn_config; and host keys are pinned per VM instance UUID, so a recreated node causes no stale known_hosts error.

barn plan says recreate or missing

Symptom: barn plan or barn up lists a node as recreate or missing, or barn recreate fails with exit 4 and reason: nodes_removed.

Check:

barn plan
barn --json plan

Fix:

  • recreate: the node’s definition changed in a way that needs a new root disk. After barn update, this also happens to nodes whose image channel or version prefix now resolves to a newer build. Back up data on the root disk and any non-persistent data disks (what survives), then run barn recreate <node> (--yes in scripts).
  • missing: a node with a VM was removed from the inventory. Restore its entry, or delete the VM with barn destroy <node>. While any node is missing, barn recreate without node names stops before touching any VM.

To rebuild one node, name it: barn plan node-1 and barn recreate node-1 keep the applied definitions of unselected peers, so their unrelated edits can wait. Conflicts in addresses, aliases, control-node roles, or deployment-wide settings must still be resolved. See Apply changes to selected nodes.

Catalog or image verification fails

Symptom: barn update, barn image pull, or barn up exits 7 (error: integrity) with reason: catalog_signature or catalog_equivocation, or an image fails its size, SHA-256, or qcow2 check.

Check:

barn --json update
barn image info <image>      # also verifies a cached copy with qemu-img

Fix: Barn rejects unknown signers, catalog revision rollbacks, size or SHA-256 mismatches, and malformed qcow2 files. Pull from a validly signed repository, such as the default or --mirror. Register your own images with barn image import --sha256 ... rather than copying files into ~/.barn/images. A permission or I/O error while reading a cached signature exits 1 (runtime), not 7; fix the file’s permissions and retry. Trust rules are in Trust and verification.

A command was interrupted

Symptom: Ctrl-C or SIGTERM stopped a command, which exits 130 (cancelled), or the host rebooted in the middle of an operation.

Check:

barn status

If another Barn process holds the deployment lock, status shows a note; wait for that command to finish. Otherwise status checks each recorded QEMU process by PID and start time and repairs the state.

Fix:

Interrupted stateWhat barn status does / what to run
Host rebooted, or an unrelated process reused the QEMU PIDMarks the VM stopped; run barn start
barn stop was interrupted while QEMU kept runningRestores running; run barn stop again if you still want it stopped
Online barn resize was interrupted after changing the live guestReports resize_incomplete; run barn resize <node> again or barn restart <node>
First barn up failed during preparationFix the inventory and run barn up -f barn.yml; Barn rolls back the journaled unfinished artifacts
barn destroy was interruptedRun the same barn destroy or barn purge again to finish

When cancelled, Barn sends SIGTERM to the processes it started (sudo forwards it to privileged commands) and waits at most 10 seconds. A descendant that ignores SIGTERM keeps running until you stop it.

If Barn can’t confirm that a recorded process belongs to the node, or QEMU is alive but its QMP socket is gone, it refuses further changes rather than risk killing an unrelated process. Keep the state directory and the logs (barn logs <node> --source qemu --verbose); don’t delete PID or lock files by hand.

Report a bug

Include the exact command and its exit code, barn version, the host OS and architecture, the QEMU version, and the JSON output of barn doctor, barn network status, and barn status.

Table reader