# Uninstall

> Stop Shardio and remove its tools, credentials, model files and containers.

## Uninstall

Run these as the user that installed Shardio. They remove Shardio's software and stored data, including downloaded models. Check any custom paths before removing them.

`ctr` below is the container CLI Shardio runs: the one on the `runtime:` line of `shardio check` (Podman when a machine has both, unless `SHARDIO_CONTAINER_CLI` names another).

```bash
ctr=docker   # or podman
```

### 1. Stop the node

To take this machine off your account as well, do that first, while its credential still exists: `shardio node remove --machine <machine name>`, or `shardio node remove` for the whole node.

```bash
shardio down
```

Continue only after the node, any native workers and the cache helper are confirmed stopped. If process ownership or exit is unconfirmed, stop here: do not erase helper lifetime records or code holds to force cleanup.

### 2. Remove the CLI and its install directory

`~/.shardio` holds the CLI's environment, cosign, the release record, the installer's own uv if it installed one, and on releases before CapyCTL a native worker environment (about 8 GB). Clean uv's cache first, because the uv that does it may be the one in `~/.shardio`:

```bash
uv=$(command -v uv || echo ~/.shardio/bin/uv)
"$uv" cache clean shardio-cli
rm -rf ~/.shardio ~/.local/bin/shardio
```

`uv cache clean shardio-cli` removes only Shardio's entries; a bare `uv cache clean` empties uv's whole cache, everything of yours included. If you installed with `SHARDIO_HOME=DIR`, use `DIR` wherever `~/.shardio` appears.

If uv downloaded Python 3.12 for Shardio (`"$uv" python list --only-installed` shows it under `~/.local/share/uv/python`) and nothing of yours uses it, `"$uv" python uninstall 3.12` removes it. Run that before the `rm`; leave Python installed if another program uses it.

### 3. Remove this machine's settings and credential

These include `node.yaml` and `config.toml`:

```bash
rm -rf ~/.config/shardio
```

### 4. Remove the work home

This holds model weights, logs, writable engine caches and CapyCTL state. The adjacent private pack cache holds compressed/extracted engine code, signed snapshots and helper lifetime records. The other sibling files track the running container, current/previous releases and a possibly interrupted upgrade. Remove them only after confirmed shutdown:

```bash
rm -rf ~/.local/share/shardio ~/.local/share/.shardio.engine-packs \
  ~/.local/share/.shardio.outer.json ~/.local/share/.shardio.outer-releases.json \
  ~/.local/share/.shardio.upgrade.pid
```

With `XDG_CONFIG_HOME` or `XDG_DATA_HOME`, use the corresponding `shardio` directory and sibling `.shardio.*` paths there. `shardio --home DIR` selects the configuration directory; `work_home` in `config.toml` separately selects working storage. For an actual work directory `WORK`, its private cache is `"$(dirname WORK)/.$(basename WORK).engine-packs"`; the records use that prefix with `.outer.json`, `.outer-releases.json` and `.upgrade.pid`. Check actual paths and never remove another node's cache or shared runtime storage.

### 5. Remove stopped Shardio containers and their volumes

`shardio down` leaves none, but a container an older release stopped without removing still holds its image and its anonymous volumes. `rm -v` removes both; it refuses a running container. This selects only Shardio containers:

```bash
$ctr ps -a --format '{{.ID}} {{.Image}}' |
  awk '$2 ~ /^(ghcr\.io\/crossfunctionalai\/|localhost\/)?shardio-(outer|runtime|worker)([:@]|$)/ {
         print $1 }' |
  xargs -r $ctr rm -v
```

### 6. Remove Shardio images

This removes each release's outer image, plus the older `shardio-runtime` (before CapyCTL) and `shardio-worker` (the outer image's earlier name). `shardio up` downloads the outer image by digest, with no tag, and `docker images ghcr.io/crossfunctionalai/shardio-outer` does not list a digest-only image on every Docker, so this lists all images and keeps Shardio's. Other images, the SGLang ones included, are left alone.

```bash
$ctr images -a --digests --format '{{.Repository}} {{.Tag}} {{.Digest}}' |
  awk '$1 ~ /^(ghcr\.io\/crossfunctionalai\/|localhost\/)?shardio-(outer|runtime|worker)$/ {
         print ($2 != "<none>" ? $1 ":" $2 : $1 "@" $3) }' |
  sort -u | xargs -r $ctr rmi
```

### 7. Inspect anonymous volumes no container holds

The outer image of earlier releases declared two volumes, `/var/lib/shardio/weights` and `/var/lib/shardio/sglang-cache`. A container that exits normally takes them with it, but one that was killed or removed another way left both behind.

Nothing records that they were Shardio's, so once no container holds them there is no way to tell them from another program's unused anonymous volumes. List those, oldest first; Shardio's were created two at a time in the same second, when you ran `shardio up`:

```bash
# docker
docker volume ls -q -f dangling=true -f label=com.docker.volume.anonymous |
  xargs -r docker volume inspect -f '{{.CreatedAt}} {{.Name}}' | sort
# podman
podman volume ls -f dangling=true --format '{{.CreatedAt}} {{.Anonymous}} {{.Name}}' |
  awk '$(NF-1) == "true"' | sort
```

Remove only the ones you know are Shardio's with `$ctr volume rm NAME...`. A prune is not targeted: `docker volume prune` removes every unused anonymous volume on the machine, not only Shardio's, and `podman volume prune` every unused volume, named ones too. Use it only if nothing else keeps data in one.

### Shared caches

Two caches outside Shardio's own directories may also hold it. `~/.sigstore` is cosign's copy of Sigstore's trust root, written when the image is verified; remove it only if you use no Sigstore tool yourself.

Docker can keep cached layers used to create the outer image after `rmi`. If `docker system df` still shows the space, Docker's [cache removal command](https://docs.docker.com/reference/cli/docker/builder/prune/) frees it, but removes all such cached layers, not only Shardio's. Leave them alone if other images still use them.
