# Node setup

> Install shardio, link it to your account and start serving.

## Set up a node

This screen takes a machine from nothing to serving in three steps: install `shardio`, link the machine to your account, and start serving. You earn 80% of what each member request you serve bills, paid out to your bank.

**Before you start** you need:

- An NVIDIA GPU on Linux or Windows (WSL), with Docker or Podman.
- AMD and Apple: we are wrapping up development, and they will be available soon.
- Power and a stable connection.

Run every command on the machine you are adding, not on the computer you are reading this on.

1. [Install](/serve/node-setup/#install) `shardio`.
2. [Link it to this account](/serve/node-setup/#link-to-account), so its earnings come to you.
3. [Start serving](/serve/node-setup/#start-serving) with `shardio up`.

On a new machine, `shardio up` also does step 2 for you: it shows the code to approve if the machine is not linked yet.

Once it runs, the node appears on the [Nodes](/serve/nodes/) screen. A first start takes a while, because the model weights download and load onto the GPU before Shardio checks the node. [Troubleshooting](/serve/troubleshooting/) explains each status it passes through.

## Install

On the machine you want to add, run:

```sh
curl -fsSL https://get.shardio.ai/install.sh | sh
```

This installs the `shardio` command and checks the release's software signatures, without downloading the node image. Your first `shardio up` downloads that image after you approve the machine and rechecks disk space immediately beforehand.

Slim releases authenticate a signed canonical release record before image metadata access. The record pins the small controller image and independent engine-pack digests; only engines needed by your chosen models download their code. The installer does not prefetch those packs, and nothing skips record, image or pack verification.

The installer never uses `sudo` on its own. Two things it may print last, each with the exact line to run:

- If `~/.local/bin` is not on your `PATH`, the `export PATH=...` line to add to your shell's startup file (such as `~/.bashrc` or `~/.zshrc`).
- On native Linux, if the GPU has no NVIDIA CDI spec yet, which is common on fresh cloud images, the command that generates it: `sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml`. Run it once, and again after each driver change. When you run the installer from a downloaded file in a terminal (`sh install.sh`), it offers to run that command for you and waits for your `y`.

Then check that the machine can serve:

```sh
shardio check
```

It looks at the GPU and its driver, the container runtime (Docker, Podman or an existing nerdctl setup) and a few system settings, and prints one line per check: `ok`, `warn`, `FAIL` or `????` when a check could not be made. Fix any required `FAIL` or `????` before you go on. Warnings alone do not stop you. It also says whether the software a node runs is downloaded yet. Run it again after you change drivers, hardware or storage.

The health report separates two disk checks; engine staging also has its own hard disk check:

- **Node image (`image_disk`):** required on the actual container-image filesystem, not an assumed `/` or work-home disk. Docker 29's containerd store may use a different root from `DockerRootDir`.
- **Model weights (`weights_disk`):** an advisory for the models chosen on an enrolled machine. It does not download weights or change your choices; warnings alone do not fail `check`.
- **Engine packs:** before fetching elected code, Shardio accounts for signed compressed/expanded bounds, temporary staging and retained code on the actual private cache filesystems. A cached archive still needs space to unpack. A disk refusal does not delete protected packs.

For missing image layers, Shardio excludes matching chains already unpacked in complete local images and allows **1× remaining compressed bytes for download, 3× for unpacking, plus 5 GB reserve**. The historical 0.4.17 amd64 monolith measured 22.469 GB compressed and needed 94.9 GB free when cold. That is not a slim or arm64 size promise: the pinned image and signed pack bounds determine the current requirements, including old/new code coexisting during upgrades.

The image check says how much space it **needs**, how much it **has** after keeping the reserve, and the storage path it measured. It also reports the compressed bytes of shared image layers excluded from the budget. Partial downloads without a complete local image, and cached images whose pinned metadata cannot be verified, are not credited. A complete image already present at the target digest needs no additional image space.

Cache discovery checks at most four historical manifests on the release's registry and does not contact unrelated registries. If that limit is reached, the finding says so and keeps unverified layers in the budget. An unreadable local image inventory earns no credit rather than blocking a download that fits without reuse.

`insufficient_image_disk` means that storage has too little free space. `image_disk_unavailable` means Shardio could not safely identify or measure the image storage, or could not read the image's size metadata. Both stop a new image download; unknown capacity is never treated as enough space. Neither means that the GPU is missing or that model weights are too large. Run `shardio check` on the machine and follow the named finding; see [Needs attention](/serve/troubleshooting/#needs-attention) for making room safely.

The image-space check is read-only: it reads metadata but never pulls or deletes layers. After a healthy upgrade actually resumes routing, Shardio automatically prunes only unreferenced code, protecting current/previous releases and every container, engine and download hold. Unknown inventory retains everything.

To upgrade a container-based node, leave it serving while the new Shardio release and elected engine packs download:

```sh
shardio update
shardio up --detach
```

`shardio update` downloads the newest release's installer and runs it, with the same signature checks as the first install. `shardio update --check` only says whether a newer release exists, and `shardio update --version <version>` installs the release you name. A version of Shardio older than the release that added `shardio update` runs the install command instead, then `shardio up --detach`:

```sh
curl -fsSL https://get.shardio.ai/install.sh | sh
```

Do not run `down` first. Before any download, one disk gate budgets the missing Shardio layers together with every engine pack required by the node's elected recipes, including archives, expanded code, metadata and a safety reserve on their actual filesystems. The old node keeps serving until the Shardio signature and all required packs' published code are verified. A failed election lookup, fetch, disk gate or verification leaves it serving. Verified unchanged packs and blobs are reused; unelected engines are not prefetched. If `up` repairs a missing helper for a live node, it keeps that node's frozen release and returns; run `up` again for the separately announced installed release. Engine-only rollback requires a complete compatible signed record, never an edit…

For older native/dev setups, `up` preserves the running node and asks for
`shardio down`, then `shardio up`. This explicit stop also applies to older native
macOS setups: automatic pre-pack native upgrades are outside the Linux engine-pack
rollout, and macOS does not fetch Linux/CUDA packs.

See [`shardio check`](/reference/cli/#check) in the CLI reference.

To remove Shardio and its stored data, follow [Uninstall](/serve/uninstall/). It keeps other programs' containers, images and shared caches out of the removal.

## Serving from Windows (WSL)

Run Shardio inside a WSL2 Linux distribution, not WSL1. You need:

- Windows 11, or Windows 10 21H2 or later as described in [NVIDIA's WSL guide](https://docs.nvidia.com/cuda/wsl-user-guide/index.html).
- A current compatible NVIDIA **Windows** driver. Do not install a Linux display driver inside WSL.
- A supported Linux distribution inside WSL2, such as Ubuntu 22.04 or later.
- Either Docker Engine with the NVIDIA Container Toolkit installed and configured **inside the distribution**, or Docker Desktop with WSL integration enabled for that distribution. Follow [Microsoft's GPU setup guide](https://learn.microsoft.com/en-us/windows/wsl/tutorials/gpu-compute). With Docker Desktop, `shardio check` warns if Docker cannot see Shardio's files. If it does, use Docker Engine inside the distribution instead.

Install and start as on Linux: [install Shardio](#install), [link the machine to your account](/serve/node-setup/#link-to-account), then [start serving](/serve/node-setup/#start-serving). Skip the Linux step that prepares the GPU for containers (`nvidia-ctk cdi generate`): it is not needed on Windows.

Shardio asks Windows which NVIDIA GPUs the machine has, so it needs to reach Windows PowerShell from the distribution. If it cannot, it stops and says so: enable [Windows executable interop and Windows-drive automount](https://learn.microsoft.com/en-us/windows/wsl/wsl-config#configuration-settings-for-wslconf) so PowerShell is reachable on `PATH` or at its standard Windows path. If the NVIDIA Container Toolkit is missing with Docker Engine, install and configure it inside the distribution. If Windows lists more NVIDIA GPUs than Shardio can read inside the distribution, Shardio stops: update the Windows driver so every GPU shows in `nvidia-smi`, then try again.

## Link it to this account

Linking tells Shardio the machine is yours, so whatever it earns goes to this account.

On the machine, run:

```sh
shardio auth login
```

It prints a short code and a link. Open the link on any device where you are signed in to Shardio, or go to [Devices](/serve/devices/) in the console. Type the code, check that the machine named is the one you are adding, and click **Approve**. The machine picks this up on its own.

- The code expires after ten minutes. If it has, run `shardio auth login` again for a new one.
- You never type a password or a token on the machine. It gets its own credential.
- On a new machine you can skip this step: `shardio up` shows the code itself.
- Login preserves the saved machine credential and node identity by default. It is not an identity reset, and a valid saved credential may need no new code. It cannot transfer a known hardware identity to another account.

## If Shardio says the machine identity is already in use

`machine_identity_in_use` means a machine on this account still has a current credential and recent presence for the same identity. Shardio refuses the new enrollment without replacing that credential. Two cloned machines can report the same identity when their GPUs are unreadable.

If you are reinstalling the same machine, stop the old worker and wait for its presence to expire before retrying the approval. Keeping a credential alone does not block recovery: a machine without recent activity can be linked again. A worker that just stopped may still look present for the liveness window.

If these are different machines, do not keep approving them in turn. Make sure every GPU is readable and the driver is ready before enrolling either one. A different machine or node name does not give it a different identity.

## If the machine identity changed after a driver recovery

`adopt_requires_legacy` means the saved node is not eligible for legacy adoption: it needs a live first machine with an old migration placeholder. Adoption cannot replace a real machine identity or move its history to a different identity. Editing `node.yaml` or repeating `shardio auth login` alone does not clear the saved credential and node context.

To deliberately enroll the recovered machine with new history:

1. Preserve the old Shardio configuration as evidence. Do not copy its `config.toml` into the new home.
2. Choose a new private directory for Shardio's global `--home` option and a unique node name. Use the correct `node.yaml`, without stale adoption context.
3. Run `shardio --home <new-private-directory> --config <node.yaml> auth login`, approve the new code, then run `shardio --home <new-private-directory> --config <node.yaml> up` with the same home.

With a new hardware identity, this creates a new machine and node. It does not repair the ambiguous old identity, transfer its history, or retire its old node automatically. An already-known identical identity still reattaches subject to the same collision checks.

## Link a machine from a script

With no terminal (CI, provisioning, an agent), `shardio auth login` cannot ask the setup questions, so pass the answers as options. They are saved to `~/.config/shardio/node.yaml`:

```sh
curl -fsSL https://get.shardio.ai/install.sh | sh
shardio auth login --machine gpu-box-2 --models auto --yes
shardio up --detach
```

- `--machine NAME` is required: the name the approve screen shows.
- `--node NAME` names the new node. Leave it out and Shardio picks one.
- `--models IDS` names the node's first models, comma-separated ids from `shardio models`, or `auto` for what Shardio recommends. Without it, `shardio up` stops and asks you to name them.
- `--yes` moves the machine out of another node it is in, without asking.

Someone still approves the code in the console: the command prints it and waits. Leave out `--machine` with no terminal and the command stops and names the options it needs.

Or write `node.yaml` yourself before `shardio auth login`. The smallest one, for a new node of this one machine, is:

```yaml
machine: gpu-box-2
models: auto
```

See [`shardio auth login`](/reference/cli/#auth-login) in the CLI reference.

## Recover after a driver or credential change

Enrollment waits until every GPU is readable as the ordinary user. Finish the supported driver installation, check the complete `nvidia-smi` UUID query, and reboot only if the driver/module transition or a pending reboot requires it. A driver failure or incomplete device inventory never makes a GPU machine fall back to `/etc/machine-id`.

On Windows (WSL2), Shardio asks Windows which NVIDIA GPUs the machine has, before and after it reads them inside the distribution. It links the machine only when both answers agree and every GPU Windows lists can be read. If it cannot reach Windows PowerShell, or the two do not agree, it stops and says so. Make Windows PowerShell reachable from the distribution and update the Windows driver so every GPU shows in `nvidia-smi`, then try again; see [Serving from Windows (WSL)](/serve/node-setup/install/#serving-from-windows-wsl). WSL never uses the distribution's machine-id. Non-PCI NVIDIA Tegra enrollment also refuses when a complete independent inventory cannot be established.

`shardio check` lists GPU names and memory and checks other serving requirements. It does not establish the complete GPU UUID and PCI inventory needed to enrol the machine.

If the current hardware identity differs from the saved credential, the CLI explains the mismatch. Driver recovery after an earlier incomplete installation, copied settings, or a changed card set can cause it. An invalid credential can also mean it was revoked or replaced; that error alone does not prove a collision or a changed physical machine.

In a terminal, run `shardio auth login` to replace a rejected or missing saved machine credential. Read its confirmation: it defaults to yes when the credential was revoked and the hardware identity is unchanged, and to no otherwise. `--yes` does not answer it. Confirming first saves a timestamped private (0600) backup of the old configuration beside it, then requests approval. A new hardware fingerprint starts a new machine/history; the old node's history is not transferred. An identical known fingerprint can reuse its existing identity, subject to collision checks.

Without a terminal, or if you decline, the CLI stops without replacing saved identity or clearing a cached approval. For deliberate fresh enrollment, preserve the old home as evidence, choose a unique node name in the intended YAML, and create a new private directory outside cloned/shared settings with no copied token, machine/node IDs, cached approval or adoption state:

```sh
mkdir -m 700 /path/to/fresh-private-home
shardio --home /path/to/fresh-private-home --config /path/to/node.yaml auth login
shardio --home /path/to/fresh-private-home --config /path/to/node.yaml up
```

Use the same global home and intended YAML for both commands. A unique name is only a label: a fresh home cannot force a new identity for known identical hardware, bypass recent-presence or cross-account refusals, or migrate ambiguous old history. Do not change `/etc/machine-id` or delete shared configuration to recover.

## Start serving

On the machine, run:

```sh
shardio up
```

On a new machine it asks a few questions, shows a code to approve if the machine is not linked yet, and suggests the models your hardware fits and the mesh needs most. Accept them or pick your own. On a machine that is already set up, it starts right away.

The model lists in `shardio up`, `shardio models` and `shardio models set` show context length when Shardio supplies it. Under each model, its available setups show their ids, context lengths and about how much memory they need. **Recommended** marks the setup Shardio would choose for that model; **Current** marks the one the node keeps. A setup marked **not measured** has not had its memory need measured yet. Choosing a model by number still lets Shardio choose its setup; an explicit setup choice stays pinned and is never silently changed to a shorter context.

A first `shardio up`, and the first after you update `shardio`, downloads the software a node runs. The node reads **Starting** while it downloads; on a machine that runs Docker it also says how much is left. While `shardio up` waits for your model choice, the node reads **Ready** and says the terminal is asking.

The models you choose the first time are saved in `node.yaml`, next to the machine's credential, and Shardio keeps them as the node's models. From then on `shardio up` starts the models the node has on Shardio, including changes made with **Change models** in the console; editing `node.yaml` does not change them. To change them on the machine, run `shardio models add` or `shardio models remove` with the model ids to add or remove one or a few and keep the rest, as ticking or unticking them in **Change models** does. `shardio models set` chooses them all again (in a terminal it opens with the node's models already chosen), and `shardio models set --from-config` applies what `node.yaml` names. `shardio models` shows the node's models, and `shardio config path` prints where both files are.

What happens next:

1. The model weights download.
2. The model loads onto the GPU.
3. Shardio checks the node and measures how much work it can take before it sends paid requests.

The node reads **Starting** while it downloads, loads and checks the models, **Calibrating** while Shardio measures its capacity, and **Serving** once it takes requests. Follow it on the [Nodes](/serve/nodes/) screen or with `shardio status`.

The download wait follows progress, not a fixed time limit. By default, `--stall 600` stops a download wait after 600 seconds without progress. To set an absolute limit on waiting for the models to start, add `--wait SECONDS`; otherwise leave it out. If the download is interrupted, the next `shardio up` resumes what is on disk and still verifies the weights before using them.

Without `--detach`, the node runs in that terminal: Ctrl-C stops it, but closing the terminal is not a reliable way to stop it. To keep it running after the terminal closes, start it with `shardio up --detach`; it runs in the background until you run `shardio down`. Either way, models loaded on the machine are not yet a node that serves: the node serves once its status reads **Serving**.

With `--detach`, a missing node image downloads in the background too, after the prerequisite checks and any approval. `shardio logs --follow` shows the download and any error; `shardio status` shows its progress or failure. `shardio down` stops a download still in progress. If the first model choice still needs your terminal, `up` says plainly that it downloads first, mirrors the download into the log, and asks you before returning.

**More than one machine?** Run `shardio up` on each and give each its own node. Nodes made of several machines cannot serve yet.

See [`shardio up`](/reference/cli/#up) in the CLI reference, and [Troubleshooting](/serve/troubleshooting/) if the node does not reach Serving.
