Troubleshooting
How to find out what is wrong: the host checks (doctor, access), reading status and ps, the log files, common failures, and the output modes you can script against.
Start with doctor
cairn doctorIt runs about 70 checks and ends with a count, for example 69 checks: 0 failed, 4 warnings. Each line is [ok ], [warn] or [fail]. A failure or warning has a fix: line right under it. On a terminal only the lines that need a look are shown, grouped by area (network, jail, deploy, systemd); -v shows all, and a pipe always gets all. --json gives the same checks as one document.
Real warnings from a working host:
[warn] network ubuntu: stopped
fix: cairn net up ubuntu
[warn] oversubscription: volumes and root disks may still grow by 77.4 GiB in total, against 29.3 GiB free; ...
fix: free space under CAIRN_HOME, move it to a larger filesystem, or shrink what you give the machines
[warn] systemd user manager: degraded (a user unit has failed); a first deploy still uses the systemd launcher
fix: systemctl --user --failedDoctor does not change anything. Deploys also run a small subset first (the access check, config files, maintenance mark, /dev/kvm and /dev/net/tun) and stop at the first failure with the same sentence and exit status 125.
Access refused
cairn access # you
cairn access alice # another account, by name or uid
cairn access --all # the cairn group's member list
cairn access --check # exit 1 when not allowedIt reads only /etc/passwd and /etc/group. Without --check the exit status is 0 whatever the answer; read the last line (allowed: ... or the refusal). It lists every local name that shares your uid, because a membership entry padded with whitespace is not counted. Refusals and their fixes:
| Refusal | Fix |
|---|---|
| not in the cairn group | sudo usermod -aG cairn <user> (no new login needed) |
| primary group is cairn but not in the member list | sudo usermod -aG cairn <user> |
| the cairn group does not exist | sudo groupadd --system cairn && sudo usermod -aG cairn <user> |
more than one cairn line, a malformed line, or spaces around names | sudo vigr, keep one clean cairn line |
no /etc/passwd line for your uid | cairn reads local accounts only; LDAP/sssd users cannot use it |
Doctor passes for the shell but not the user manager
Rows "your user manager can open /dev/kvm" fail when the manager started before you were added to a group such as kvm (Ubuntu). Log out and in; with linger on, run sudo systemctl restart user@<uid>.service, which stops every user service and VM of that user.
Reading status
cairn status webReal output (abridged) for a machine that is not running:
app run-claude-e4-213865
state crashed
machine D69JCGAMRW
network run-claude-e4-213865, egress allowlist: example.org ...
kernel 6.1.155 (pin)
console /home/work/.cairn/apps/run-claude-e4-213865/machines/D69JCGAMRW/console.log
vmm log /home/work/.cairn/apps/run-claude-e4-213865/machines/D69JCGAMRW/firecracker.log
launcher direct, run 2
health - (no health checks configured; ...)
restart on-failure
why not running since the host restarted (its last run was in an earlier boot)
last lines of the console:
[cairn] v1 started pid=284Look at state, then why, then the console tail. cairn ps --verbose adds a NOTES column with the same reasons for every row. HEALTH - means no verdict, not unhealthy. Filter with cairn ps --state crashed,failed or --health unhealthy.
For state names see concepts; restarts and health are in lifecycle.
Logs
Each machine directory under $CAIRN_HOME/apps/<app>/machines/<id>/ holds:
console.log: the guest kernel's boot messages,cairn-initlines (prefixed[cairn]) and your workload's stdout and stderr.firecracker.log: the VMM's own log. Look here when the VM never boots.
cairn status prints both paths. Read them with tail -f. A failed deploy's JSON can include guest_panic and vmm_error when the console explains the failure.
Common failures
the guest kernel ... is not installed. Run cairn kernel fetch, or cairn kernel install <file> offline. A first deploy fetches it for you; this appears when the file is missing later. A file that exists but fails its checks is reported as damage, not re-fetched.
Deploy stops at readiness and the old release runs again. The new machine did not become ready within --wait-timeout (60s), and the deploy rolled back. The new machine already served its ports during the wait, so clients may have seen the new release briefly. Check the new machine's console.log: the workload may have crashed, or listens on a different port than internal_port. A health check [checks.*] with a wrong path or status also blocks. --no-checks skips waiting but health checks still run.
Port already in use / cannot publish. Another process holds the host port, or the address is not one of this host's. Pick another port, or ss -ltn to find the holder. Ports below 1024 are not allowed.
The app cannot reach the network. cairn ps shows running (no network) when the network's agent restarted under a running machine. Run cairn stop <app> && cairn start <app>. cairn net up <network> repairs the network for new machines only. Also check cairn doctor's forwarding and firewall rows (net.ipv4.ip_forward, a FORWARD policy of DROP, firewalld zones).
A guest cannot reach another app through a published port. There is no hairpin: use the network, not the host address. See networking.
"network slots" or limit reached. Stale networks hold slots. cairn net ls, then cairn net destroy <name> for each one nothing needs.
Everything shows crashed after a reboot. The VMs did not start at boot. Enable linger (loginctl enable-linger <user>), then cairn start <app>. Linger is only relevant for the systemd launcher.
A deploy was interrupted (a second Ctrl+C, a crash, a power loss). The attempt stays in apps/<app>/deploy.json, and cairn status says "an earlier deploy did not finish (…)". The next cairn deploy, start, stop or destroy of the app settles it: it deletes the new machine if it never ran, rolls back to the previous one if it was starting, or finishes the cleanup if it was accepted. Settling never starts a machine: if the deploy had already stopped the previous machine, the app stays down until you run cairn start <app> (or deploy again). After a power loss while the new machine was starting, it does not come back at boot either; cairn start <app> after the reboot does nothing if it did. A rollback of an app with volumes may leave it held; cairn start --release clears it. See lifecycle and volumes.
Unsettled: an earlier deploy could not be settled. Settling stopped short in a way that leaves the current machine unknown: the new machine would not stop, or a first deploy's network leave did not finish. cairn deploy and cairn start refuse; cairn stop <app> stops the app's machines and settles it. A deploy whose result was left_for_next_command is in the same place.
cleanup left in cairn status. The deploy succeeded or was rolled back, but a unit, a machine directory or a build directory could not be removed. Nothing is refused; the next cairn deploy retries it. When the left item is the start-at-boot setting, the next deploy refuses until it is done, which needs your user manager (cairn stop <app> settles it).
cairn doctor rows about deploys and VMMs.
<app>: an earlier deploy did not finish (<state>, since <time>): <what is left>— one row per app whose attempt's process is gone. The fix it names settles it:cairn deployorcairn stop <app>, or onlycairn stop <app>when a deploy would refuse (the new machine would not stop, a network leave did not finish, or start at boot was not applied).unrecorded VMMs: N Firecracker processes of yours that no run file of this home names— a VMM that no machine's run file names, with its pid and--id. It exists only after a record was lost or edited by hand, or when another cairn home of yours runs it. Check that nothing else owns it, thenkill <pid>.run files: N cannot be read— a machine whose run file is damaged; its VMM cannot be matched, so it may also appear as unrecorded.cairn status <app>says more.
Disk filling up. Root disks and volumes are sparse files. The "oversubscription" warning means they could grow past free space, after which guest writes fail with I/O errors.
jail or helper rows fail after an upgrade. The package install and the running service differ. Reinstall the package (make install prints the command), then cairn doctor.
If cairn is in maintenance mode, the preflight stops with the maintenance mark; see cairn admin maintenance status in configuration.
Output you can script against
JSON
Every command takes --json. Stdout is then one JSON document and nothing else. A failure is {"ok": false, "code": ..., "message": ...}. Exit codes: 0 success, 1 failure, 2 usage error (also reported in the JSON envelope). deploy adds 130 for Ctrl+C. exec, console and run report usage errors as 125, so they never collide with the command's own status.
cairn access --json{"allowed":true,"answer":"allowed: work is in the cairn group's member list","names":[{"member":true,"name":"work","padded":[],"primary":false}],"ok":true,"reason":null,"uid":1001}Fields worth knowing:
deploy --jsonincludesdeploy.kernel(a pin haskindandname; a file haskind,version,sha256,from,size,config_checked,reused) anddeploy.warnings. With volumes it addsvolumes,detached_volumesandkill_signal. A redeploy addsstop_to_ready_s(from the start of the previous machine's stop to the new one's readiness).- A failed deploy's envelope adds
step,outcome(previous_preservedwhen nothing was stopped yet,previous_running,previous_starting,previous_stopped,previous_held,previous_unconfirmedorleft_for_next_command; see cli),machine(the new machine),logs,leftovers,kernel,warnings, andguest_panic/vmm_errorwhen the console explains it. A deploy that was accepted but could not finish its cleanup exits 0 withoutcome: deployed_cleanup_pending. left_for_next_commandmeans the attempt is still recorded: the nextcairn deploy,start,stopordestroyof the app settles it, andcairn stopworks when the others refuse.deploy --dry-run --jsonhasvm.balloon.status --jsonhasmachine.kernel,machine.volumes, while held,hold, and while adeploy.jsonexists,deploy: itsstate,machine,previous,holder_pid,deploying(its process is alive),since_unix,sentence,machine_state,machine_detail,rollback,cleanup_only,cleanup(what is left) andlogs.ps --jsonhas anappsarray whose machine objects carry the log paths,console_tailandkernel.- Each entry of
volumeshasname,id,size,host_allocation,destination,createdand astate_notewhen something is unfinished or damaged;kill_signalhassignalandsource. A failed deploy's envelope also names the volumes, the previous machine and thenextcommand. - A
stop --jsonthat settled an interrupted deploy by rolling it back hashold_decided:action(restoreorhold), itsevidence, and theholdthe app is left with. - Every
cairn volumecommand takes--json.
Terminal versus pipe
On a terminal you get colour, a live progress line for deploy and start, and a doctor summary. A pipe, a file or --json gets plain text, the same words and layout every time, with no colour and no redrawing.
| Setting | Effect |
|---|---|
NO_COLOR (non-empty) | No colour; the live line stays. |
CLICOLOR_FORCE (non-empty) | Colour even into a pipe (not under --json), unless NO_COLOR is set. |
CLICOLOR=0 | No colour, unless CLICOLOR_FORCE is set. |
TERM=dumb | No colour and no live display; doctor still prints its summary. |
TERM unset | No live display; colour only if CLICOLOR, CI or CLICOLOR_FORCE is set. |
CAIRN_PROGRESS=plain | Live display off, progress as plain lines. Only this exact value counts. |
non-UTF-8 locale (first non-empty of LC_ALL, LC_CTYPE, LANG) | ASCII glyphs and spinner. |
NO_COLOR wins over CLICOLOR_FORCE. Examples:
cairn deploy 2>deploy.log # plain progress lines in the log
CAIRN_PROGRESS=plain cairn deploy # for a screen reader or a recording
CLICOLOR_FORCE=1 cairn ps | less -R # colour through a pipeOn a terminal, the first Ctrl+C during deploy cancels it and rolls back; a second exits at once, and the next cairn deploy, start, stop or destroy settles the attempt. start stops on its first Ctrl+C. Narrowing the terminal during a long live line can leave one stale line above the new output in terminals that rewrap rows (tmux, VTE, kitty). Nothing is lost.