fwup or rauc.
The agent:
- reports which firmware the device is running
- receives updates and runs the update tool
- can ask your application whether to install an update and whether to reboot
- confirms a good boot so the bootloader releases its rollback
- runs support scripts
- answers health, geo, logging, local shell and network identity requests
Requirements
Build
nerves-hub-link-agent and agent-ctl in target/release/.
Update tools are cargo features. The default feature set is sandbox and fwup. A config file cannot select a tool that was not built in. Build a device binary with only the tool it has:
Connect a device with the sandbox tool
Start with thesandbox update tool. It downloads firmware, verifies its SHA-256, writes it to a file and stops. It touches no block device or bootloader, and a reboot is only a log line.
1
Create a shared secret
Create a product shared secret in NervesHub. See Shared secret authentication. You get a product key that starts with
nhp_ and a product secret.2
Write a config file
agent.toml
host to its device endpoint.initial_firmware is what the sandbox reports as the running firmware before anything is installed. Without it the device has no firmware for a deployment group to compare against.3
Run the agent
RUST_LOG=nerves_hub_link_agent=debug to log the URL it connects to and every frame in both directions.4
Send it an update
Upload fwup firmware to the product and target the device from a deployment group. The sandbox downloads it into
work_dir, and you can watch progress in NervesHub.Configuration
The agent reads one TOML file. It looks for the path in this order:--config <path>(or-c <path>)- The
NERVES_HUB_AGENT_CONFIGenvironment variable /etc/nerves-hub-link-agent.toml
examples/agent.toml in the repository lists every option with its default.
Server
host is a host name only, with no scheme or path. The other values shown are the defaults.
Identity
fwup
The archive streams into fwup as it downloads. The agent reports its fwup version and NervesHub decides whether to send a delta, as it does for Nerves devices. See
docs/fwup.md for what the image must provide.
RAUC
What the image must provide:
- RAUC 1.9 or later. The agent refuses to start with an older version.
- The RAUC service.
rauc installis a D-Bus client ofrauc service. The agent checks for the service at startup. - A
system.confthat describes the slots, names a real bootloader backend, and points at a keyring. RAUC verifies bundles against that keyring. The agent has no signature settings for RAUC. - Verity bundles. Streaming requires them, and NervesHub refuses plain bundles.
rauc status mark-good booted.
Identifying the running firmware. The agent reads firmware_file first. It holds key=value lines for uuid, version, product, platform and architecture, written by your image build. Pair it with a uuid in the bundle manifest’s [meta.nerveshub] section so that both sides name the same firmware. When the file is absent, the agent falls back to the bundle hash RAUC recorded for the booted slot. That hash exists only for slots RAUC installed, so a device flashed another way cannot report its firmware until its first RAUC update. See RAUC bundles.
See docs/rauc.md for the slot configuration and a QEMU rig.
Update and reboot policy
policy = "apply" installs whatever arrives. policy = "ask" asks your application first. Reboot policy is separate, so an application can accept a download and still defer the reboot.
The default reboot command is sudo reboot, because the agent is meant to run as an unprivileged user. That needs one sudoers rule:
Talking to your application
docs/ipc.md.
agent-ctl is a small client for the same socket:
Extensions and support scripts
The agent implements five extensions. All are off by default in the agent’s config. The product and the device must also have the extension enabled in NervesHub.
Turn one on with
enabled = true in its table:
bash as the default interpreter and a 10 second timeout. Scripts belong to the product, so a script written in Elixir for Nerves devices does not run here. See Support scripts.
Deploying to hardware
The repository’sdocs/deploying.md covers cross-compiling, the service user, the systemd unit, and Buildroot packaging. docs/connecting.md covers endpoints, TLS, and what each connection failure means.
If you build the image with Yocto, see meta-nerveshub.

