# Troubleshooting (https://kumoba.dev/troubleshooting)

## The installer says libkrun is missing (macOS) [#the-installer-says-libkrun-is-missing-macos]

Install it from Homebrew, then run the installer again:

```sh
brew tap slp/krun && brew install slp/krun/libkrun slp/krun/libkrunfw zstd
```

## `/dev/kvm` is not writable (Linux) [#devkvm-is-not-writable-linux]

kumobad needs KVM. Add your user to the `kvm` group and log in again:

```sh
sudo usermod -aG kvm "$USER"
```

On a cloud VM, check that the instance type supports nested virtualization.

## The installer could not unpack the image [#the-installer-could-not-unpack-the-image]

The disk is too full. The `default` image needs about 2 GB while it unpacks. Free some space and run the installer again; it removes the partial file itself.

## The `default` image takes more than 2 GB on a Mac [#the-default-image-takes-more-than-2-gb-on-a-mac]

If `du -h ~/.kumoba/images/default.raw` shows about 4.7 GB, the image was unpacked by an older installer: APFS stored about 3 GB of zeros next to the 1.5 GB the image holds. Run the installer again:

```sh
curl -fsSL https://kumoba.dev/install.sh | bash
```

It frees the zeros in place in a few seconds and changes no byte of the image. Sandboxes that already exist keep working, since each has its own copy-on-write disk, and kumobad makes a fresh copy of the image for new ones.

## `kumoba: Cannot reach kumobad` [#kumoba-cannot-reach-kumobad]

kumobad isn't running, or the CLI is looking in the wrong place. Start it with `kumobad`. If you run kumobad with custom settings, point the CLI at it with `KUMOBA_URL` and `KUMOBA_TOKEN` (see [Configuration](/configuration)). The CLI exits with status 3 in this case.

## `No kumobad token` [#no-kumobad-token]

kumobad writes `~/.kumoba/token` the first time it starts. Start it once, or set `KUMOBA_TOKEN`.

## The desktop link doesn't open, or kumobad logs `preview_listen_skipped` [#the-desktop-link-doesnt-open-or-kumobad-logs-preview_listen_skipped]

Another program uses port 7789, so kumobad couldn't serve browser links. Free the port, or choose another one: `KUMOBAD_PREVIEW_LISTEN=127.0.0.1:7790 kumobad`. kumobad also logs `listen_skipped` when port 7788 is taken; the CLI and SDK keep working through the socket.

## kumobad stops answering, and logs `connections_full` [#kumobad-stops-answering-and-logs-connections_full]

Every connection slot on that listener is in use: by many clients, or by shells, live views and WebSockets left open. New connections wait until one closes. Close what you no longer use, or raise kumobad's hard open-file limit (`ulimit -Hn`, or `LimitNOFILE=` under systemd), since each listener takes an eighth of it. See [Configuration](/configuration).

## `is not a loopback address, so kumobad serves it only over TLS` [#is-not-a-loopback-address-so-kumobad-serves-it-only-over-tls]

kumobad listens on addresses other than loopback only over TLS. Set `KUMOBAD_TLS_CERT` and `KUMOBAD_TLS_KEY`, or listen on `127.0.0.1`. See [Run sandboxes on another machine](/guide/remote-daemon).

## `TLS with kumobad ... failed` or `closed the TLS connection` [#tls-with-kumobad--failed-or-closed-the-tls-connection]

`invalid peer certificate: UnknownIssuer` (in the TypeScript SDK, `unable to verify the first certificate`) means the client does not trust the daemon's certificate: set `KUMOBA_CA_FILE` to the CA that signed it. A name or address missing from the certificate fails the same way. `CertificateRequired` or `UnknownCA` means the daemon requires a client certificate: set `KUMOBA_CERT_FILE` and `KUMOBA_KEY_FILE` to one its `KUMOBAD_TLS_CLIENT_CA` signed. kumobad logs refused handshakes as `tls_refused`, at most one line every 10 seconds; its `suppressed` field counts the refusals since the previous line that were not logged.

## The live view of a macOS sandbox doesn't open [#the-live-view-of-a-macos-sandbox-doesnt-open]

`kumoba desktop` on a macOS sandbox answers `the live view did not start` with the reason in brackets:

- **`kumoba-view-host is missing`**: the engine that shows a macOS sandbox's screen is not next to `kumobad`. The install script puts it there; a `kumobad` built with `cargo install` does not have it. [Build it from the repository](/install#build-the-live-view-engine-for-macos-sandboxes), or set `KUMOBAD_VIEW` to where it is.
- **`the live view needs kumobad to run inside a logged-in desktop session`**: `kumobad` was started over SSH or as a boot-time daemon. Start it from a terminal in your desktop session.
- **`too many live views are open on this sandbox`**: eight pages can watch one macOS sandbox at a time. Close some.

Paste, copy and characters outside the US layout need someone signed in to the sandbox's desktop. Before that they do nothing, and `~/.kumoba/state/runtime/sandboxes/<id>/worker.log` says `nobody is signed in to the sandbox's desktop`.

If the page opens and shows the macOS login window, that is the sandbox's screen: nobody is logged in yet. Sign in as `kumoba` with the password in `~/.kumoba/images/macos/password`.

## `the sandbox started with its network blocked; stop it to turn the network on` [#the-sandbox-started-with-its-network-blocked-stop-it-to-turn-the-network-on]

kumobad 0.11 and 0.12 can't turn on the network of a sandbox started with network `blocked` while it runs. [Upgrade](/guide/upgrade), or run `kumoba stop <id>`, then `kumoba update`, then `kumoba start <id>`. Newer kumobad changes any network of a started sandbox at once. A kumobad from 0.10 or earlier answers every network change on a started sandbox with `stop the sandbox before changing its network`.

## `this sandbox's image has no shell support` [#this-sandboxs-image-has-no-shell-support]

The sandbox was created from an image older than kumoba 0.3. [Upgrade](/guide/upgrade), then create a new sandbox from the new image.

## `shell is interactive: use the kumoba CLI 0.3 or later` [#shell-is-interactive-use-the-kumoba-cli-03-or-later]

Your CLI predates `kumoba shell`. Install the current version with the installer or `npm install -g kumoba@latest`.

## `the new network reaches none of the hosts of secret ...` [#the-new-network-reaches-none-of-the-hosts-of-secret-]

The new network doesn't reach any host of one of the sandbox's secrets, so kumobad kept the old network. To narrow it anyway, add `--drop-unreachable-secrets` to `kumoba update` (`"dropUnreachableSecrets": true` in the API, `dropUnreachableSecrets: true` in the TypeScript SDK): those secrets are removed and the new network applies in one step. See [Narrow the network and drop secrets in one call](/http-api#narrow-the-network-and-drop-secrets-in-one-call).

## `pip install` fails with `externally-managed-environment` [#pip-install-fails-with-externally-managed-environment]

Your image predates kumoba 0.2.2. Upgrade (see [Upgrade or uninstall](/guide/upgrade)) to get an image where `pip install` works directly.

## A server started with `exec` stops right away [#a-server-started-with-exec-stops-right-away]

`exec` stops the processes a command started when the command ends. Start long-running processes with `setsid`, as in [Open a web app](/guide/expose).

## Output from a background process is missing [#output-from-a-background-process-is-missing]

The command left a process running in the background that still holds its output open, as in `sh -c 'make; ./server &'`. `exec` keeps reading for a quarter of a second after the command ends, returns what has arrived by then, and stops. Whatever that process writes later is not returned, and is not counted as truncated. Send its output to a file, as in `./server > /tmp/server.log 2>&1 &`, and read the file instead.

## A command was cut off with status 141 [#a-command-was-cut-off-with-status-141]

The reader of `kumoba exec` or `kumoba run` output closed early, as in `kumoba exec <id> -- cat big.log | head`. That's the normal status for a closed pipe.

## Creating a sandbox takes minutes [#creating-a-sandbox-takes-minutes]

kumobad is copying the image. `kumoba info` shows `diskMode` and, for each image, `baseReady`. With `diskMode` `layer` or `reflink` and `baseReady: false`, kumobad has no shared copy of the image's current version yet: it makes one in the background after it starts and after the image changes, and a create that comes first makes it instead. Later creates take milliseconds. If the copy never appears, the kumobad log says why: a `base_skipped` line with `neededMib`, `freeMib` and `minFreeMib` means the copy would leave less free disk than `minFreeMib` (`KUMOBAD_MIN_FREE_DISK_MIB` plus 2 GiB kept for creates and running sandboxes), so free some space (see the next section); a `base_failed` line carries the error. With `diskMode` `copy`, every create copies the whole image; remove `KUMOBAD_DISK_MODE=copy` to use layers.

## `running sandbox capacity exhausted` (429 `capacity`) [#running-sandbox-capacity-exhausted-429-capacity]

`KUMOBAD_MAX_RUNNING` sandboxes are already running or booting. A create that starts, `kumoba run` and the TypeScript SDK's `create()` refuse at once, before any disk is copied, so retrying costs little; the reply carries `Retry-After: 5`. Stop or delete a sandbox, raise `KUMOBAD_MAX_RUNNING` (with `auto`, lower `KUMOBAD_SANDBOX_MEMORY_MIB`, `KUMOBAD_SANDBOX_CPUS` or `KUMOBAD_RESERVED_MEMORY_MIB`), or pass `waitMs` (`--wait-ms` in the CLI) to wait for a free slot. `kumoba capacity` shows how many slots are in use. With `KUMOBAD_ADMIT_BY_MEMORY=1` the same 429 also means the new sandbox's `memoryMib` does not fit in what is left of the memory budget: `memoryMibInUse` and `memoryMibBudget` in `kumoba capacity` show how much is taken. Ask for less memory, stop a large sandbox, or lower `KUMOBAD_RESERVED_MEMORY_MIB`.

## `not enough free disk` (507 `disk_full`) [#not-enough-free-disk-507-disk_full]

A create, a create with `start` or `kumoba run` would have left less free disk in `KUMOBAD_STATE_DIR` than `KUMOBAD_MIN_FREE_DISK_MIB`, or its copy of the image would not fit at all. kumobad refused it before copying anything, so nothing was left behind. Unlike 429 it does not clear by itself, and the TypeScript SDK marks it not retryable. `kumoba capacity` shows `disk.freeBytes` and `disk.stoppedSandboxBytes`, what stopped sandboxes hold. Delete sandboxes you no longer need, or run `kumoba prune-stopped --older-than-ms 86400000 --dry-run` to see which stopped sandboxes are older than a day and how much they hold, then again without `--dry-run` to delete them. Through a fleet, the 507 names the hosts short of disk in `diskFullHosts`; add `--host HOST_ID` to prune one of them through the fleet, as in [Free disk on a host](/guide/fleet#free-disk-on-a-host). On Linux, a filesystem with reflinks (Btrfs, or XFS made with `reflink=1`) for the state directory makes each copy nearly free. To have kumobad delete old stopped sandboxes itself before it refuses, set `KUMOBAD_PRUNE_STOPPED_ON_DISK_PRESSURE_MS` (see [Configuration](/configuration#daemon-kumobad)); with it set, a 507 means kumobad found those could not make room, and `deleted` events with `"reason": "disk_pressure"` in `GET /v1/events` show what it removed.

## `running sandbox capacity exhausted` when starting a macOS sandbox [#running-sandbox-capacity-exhausted-when-starting-a-macos-sandbox]

Apple allows two macOS VMs running on a Mac at once, counting VMs from other apps such as UTM or Tart. Stop a macOS sandbox, or quit the other app's VM, and start again. See [Run macOS in a sandbox](/guide/macos#limits).

## A macOS sandbox won't start after upgrading kumoba [#a-macos-sandbox-wont-start-after-upgrading-kumoba]

`this macOS sandbox's guest agent is from another kumoba release` means the sandbox's disk still has the agent it was cloned with. Run `kumobad macos-image`: over a finished image it installs the current agent and keeps everything else. Sandboxes made before that keep their old agent on their own disk, so copy out what you need and create them again. See [Run macOS in a sandbox](/guide/macos#update-the-image).

## `kumobad macos-image` stops part way [#kumobad-macos-image-stops-part-way]

Run it again. It remembers the finished stages in `~/.kumoba/images/macos/build.json` and resumes, and an interrupted download continues where it stopped. `guest provisioning needs macOS 27 or later on the host` means the Mac itself must be updated first.

## Still stuck [#still-stuck]

Open an [issue](https://github.com/Parassharmaa/kumoba/issues) with the kumobad log, the output of `kumoba version`, and your OS and CPU. Report security problems privately as described in [Security](/security).