# Run the program alone

The program alone is built for Linux, Windows, macOS and routers; the state and limits of each file and what Coronium observed of it are listed below, under Each system. Started this way it has no service: a shell starts it detached, with the three settings of `agent.env` in its environment, never as arguments, and never as root, and nothing starts it again unless a supervisor of your own does. A published installer makes it a service on [macOS](/guides/device-macos.md) and on [Windows](/guides/device-windows.md), and on Linux with systemd [the kit](/guides/device-linux-kit.md) does. Calls go to https://supply.coronium.ai.

## Needs

- The file for the system, checked as in [the files section](/guides/device-files.md), and `agent.env` from [enrolment](/guides/device-enrol.md), both in the folder every block works in: `~/coronium` unless `CORONIUM_DIR` names another.
- Outbound TCP to the relay, no inbound port, and one device per public address.
- On Linux and routers, the system's certificate roots: without them the program logs that the system has none, with the package to install. Windows and macOS check the relay's certificate with their own store.

## Steps

1. Start it. On Linux, macOS and routers, put the file's name in `FILE`:

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
FILE=coronium-agent-linux-amd64
chmod 0755 "$FILE"
RUN="$PWD/$FILE"
AS=""
if [ "$(id -u)" = 0 ]; then
  id coronium-agent >/dev/null 2>&1 || useradd --system --no-create-home --shell /usr/sbin/nologin coronium-agent 2>/dev/null || adduser -S -D -H -s /sbin/nologin coronium-agent || { echo "no_service_user: the user coronium-agent could not be made. Fix: make it with the system's own tool, then run this again"; exit 1; }
  mkdir -p /opt/coronium && cp "$FILE" /opt/coronium/coronium-agent && chmod 0755 /opt/coronium /opt/coronium/coronium-agent
  RUN=/opt/coronium/coronium-agent
  AS=coronium-agent
fi
(set -a; . ./agent.env; set +a
  if [ -n "$AS" ]; then exec nohup su -s /bin/sh "$AS" -c "exec $RUN"; else exec nohup "$RUN"; fi >>coronium-agent.log 2>&1 </dev/null &
  echo $! >coronium-agent.pid)
sleep 5; tail -n 1 coronium-agent.log
```

It runs detached, with its log in `coronium-agent.log`, and `kill "$(cat coronium-agent.pid)"`, in the working folder, stops it. From a root shell, such as a server's console or a container without systemd, it does not run as root: the block makes a system user of its own, `coronium-agent`, or stops where the system has no tool that makes one, as on many routers, puts the program in `/opt/coronium` and runs it as that user, so no other user's process reads the settings in its environment; `agent.env` and the log stay with root.

On Windows, in PowerShell, in the folder of the file and `agent.env`:

```powershell
Get-Content agent.env | ForEach-Object { $name, $value = $_ -split '=', 2; Set-Item "env:$name" $value }
.\coronium-agent-windows-amd64.exe
```

Expect: `connected to the relay`. Each problem is one line, `not connected: <cause>. Fix: <fix>. Dialing again in <time>`, and the program dials again by itself after a lost connection. A setting it refuses ends it with exit status 2 and `<code>: <cause>. Fix: <fix>`: `bad_relay`, `bad_device_id` or `bad_secret` means `agent.env` is wrong. Safe to repeat: once it is stopped; a second copy with the same settings replaces the first at the relay.

2. Know each system's limits, which `/kit/index.json` lists for each file.

- Windows and macOS: the file has no code signature, so the system may warn about it or block a copy a browser downloaded; a copy fetched with curl carries no download mark.
- Routers: copy the file to the router, and check that it has certificate roots, room in flash and memory, and a clock set by NTP, because a router that boots with its clock in the past fails the certificate check until the time is set. A router's memory, flash, resolver and clock are not measured by Coronium yet.

## Each system

The next build's state and limits of the program's files; `/kit/index.json` speaks for what this server publishes now:

<!-- facts:begin kit.program -->
- `linux` on `amd64`: `available`; limits `system_ca_roots_required`.
- `linux` on `arm64`: `available`; limits `not_run_by_coronium`, `system_ca_roots_required`.
- `linux` on `armv7`, `armv6`, `riscv64`: `preview`; limits `not_run_by_coronium`, `system_ca_roots_required`.
- `linux` on `mips`, `mipsle`: `preview`; limits `not_run_by_coronium`, `no_installer`, `system_ca_roots_required`, `large_for_small_flash`.
- `windows` on `amd64`, `arm64`: `available`; limits `not_run_by_coronium`, `unsigned`.
- `darwin` on `arm64`: `preview`; limits `not_run_by_coronium`, `unsigned`.
<!-- facts:end kit.program -->

What Coronium observed of each published file, the kit and the image included. A dated note speaks only for the digest it names:

- Linux `amd64` kit and program: two runs of two earlier builds, one that installed, started and removed the kit and one that carried a billed request. No run of a published file.
- Docker `amd64`, digest `bd501040b7432344`: on 26 November 2026, connected, measured and withheld as a data-centre network. No billed request.
- Windows `amd64` and `arm64`, digests `e2a3557e46c9e546` and `5ca66a8dec3becd9`: on 26 November 2026, started on hosted virtual machines of their architecture and reached the relay's refusal of an unknown device. Never enrolled.
- macOS `arm64`, digest `2b24631d8079012d`: on 29 November 2026, set up by hand on a Mac on a home line as the launchd user agent the installer writes, with that program. It connected, and its device, measured and admitted on an earlier day under an earlier build, read admitted and routable. No billed request, and the installer itself was not run. An earlier build, digest `c739273a9de679a3`, ran once on 26 November 2026: connected, measured and withheld as an unclassified network.
- Linux `arm64`, `armv7`, `armv6`, `riscv64` and both router files: run only under emulation, which is not a run on that system.

## If it is not connected

Nothing starts the program alone again: after a restart of the machine, or when it ended, run step 1 again, or give it a supervisor that does. `tail -n 5 coronium-agent.log`, in the working folder, shows why it is not connected.

## Update

`/kit/index.json` names the published `version`, and publishing a newer agent does not stop one that is running. To update, download and check the new file as in [the files section](/guides/device-files.md), stop the running program, put the new file in its place and start it as before. `agent.env` stays as it is.

## Stop and remove

Stop, remove, withdraw: [update, stop, remove and withdraw](/guides/device-lifecycle.md).
