Skip to main content
Documentation
Preview
You're viewing the Next docs — a rolling preview of in-development changes. The current release docs may differ.

Set Up System Updates

Prepare a device image and its releases, so that you can update the operating system of devices from Nexigon. Nexigon Agent installs system updates with Rugix Ctrl or RAUC, two update engines for embedded Linux. Both keep two copies of the system: a device installs an update next to the running system and returns to it if the new system fails.

Once a device is set up, you select in Nexigon Hub which release it runs. Nexigon Agent checks for updates, has the update engine install the selected release, reboots the device, and reports the result. System Updates explains this process in detail. To roll out releases afterward, follow Deploy System Updates.

Before You Start

You need:

The Nexigon CLI commands assume an organization API token. With a user token, add --organization <org-id> to each command, as Organization Selection describes.

Add the Update Integration

The build integrations install the update engine, enable the agent’s integration, and keep the agent’s state across updates. With a custom build, your image must provide the same, as described in What the Image Needs.

Rugix Bakery

Add the nexigon/nexigon-rugix-watchdog recipe and enable the integration in the agent’s configuration:

layers/customized.toml
recipes = [
    # ...
    "nexigon/nexigon-agent",
    "nexigon/nexigon-agent-config",
    "nexigon/nexigon-rugix-watchdog",
]

[parameters."nexigon/nexigon-agent-config"]
extra_config = """
[integrations.rugix.system-updates]
enabled = true
path = "my-repo/gateway-os/stable"
"""

Merge these settings into an existing extra_config value. Images built with the nexigon/nexigon-rugix-ota recipe of earlier releases ran a standalone update service instead; Upgrade to Nexigon Agent 0.7 explains how to switch.

Yocto

Add meta-nexigon-rugix for Rugix Ctrl or meta-nexigon-rauc for RAUC to your build. The layer installs the update engine and enables the agent’s integration for it; meta-nexigon-rugix also installs the rollback watchdog. Set the default release:

conf/local.conf
NEXIGON_OTA_REPOSITORY = "my-repo"
NEXIGON_OTA_PACKAGE = "gateway-os"
NEXIGON_OTA_TAG = "stable"

The meta-nexigon README lists all variables, and its example Kas configurations set up complete images with both update engines.

Settings

path selects the image’s default release in the format <repository>/<package>/<version>, where <version> is a tag that the device follows or a version ID that pins one version. The examples follow the stable tag of the gateway-os package in the my-repo repository. Without a path, the device does not update until you select a release in Nexigon Hub, which suits generic images shared by different products.

The integration provides the nexigon.ota.check command, with which the web interface asks the device to check for updates right after you deploy a release there. After changes made with Nexigon CLI, the device notices a new release at its next check, by default within about four hours. System Updates lists all settings of the integration.

Identify the System

Every image carries a system name and a version string. The system name identifies a variant of the system, for example gateway-efi-amd64, and selects the bundle that a device installs from a release. The version string identifies the build, for example 2.1. Nexigon Agent compares it with the release to decide whether the device is up to date, so it must be unique for every release. It also serves as a tag name, so use only letters, digits, ., _, +, ~, and -, starting with a letter or digit, and at most 128 characters.

With Rugix Bakery, pass the version with --release-version and build the image and the bundle of a release with the same version:

./run-bakery bake image gateway-efi-amd64 --release-version 2.1
./run-bakery bake bundle gateway-efi-amd64 --release-version 2.1

Rugix Bakery writes the system name and the version into /etc/rugix/system-build-info.json. Without --release-version, every build gets the same version.

With Yocto, set IMAGE_ID and IMAGE_VERSION, which the agent reads from /etc/os-release. Set them globally, because the os-release recipe does not see variables of the image recipe, and set IMAGE_VERSION anew for every release build, for example from your release pipeline:

conf/local.conf
IMAGE_ID = "gateway-efi-amd64"
IMAGE_VERSION = "2.1"
OS_RELEASE_FIELDS:append = " IMAGE_ID IMAGE_VERSION"

Choose Bundle Verification

The update engines install only bundles that they can verify. RAUC checks the signature of every bundle against the keyring in its system configuration. Rugix Ctrl verifies a bundle in one of two ways:

  • Signature: Rugix Ctrl checks the bundle’s signature against certificates that the image trusts. See Signed Updates.
  • Hash: With use-bundle-hash enabled in the agent’s configuration, the agent passes a hash from the bundle’s metadata in Nexigon Hub to Rugix Ctrl. For a bundle without a hash, Rugix Ctrl checks the signature.

Without a trusted signature or a hash, every installation fails. A hash ensures that the device installs exactly the bundle that you published, but it trusts whoever can publish to the repository. A signature also proves who built the bundle, so prefer signed bundles in production. With Yocto, set NEXIGON_OTA_RUGIX_USE_BUNDLE_HASH = "1" to enable hash verification.

Publish a Release

A release is a package version in the repository. For Nexigon Agent to install it and to recognize it on the device afterward, the version needs:

  • A bundle named <system>.rugixb for Rugix Ctrl or <system>.raucb for RAUC, where <system> is the system name. A release for several system variants contains one bundle for each.
  • The metadata field imageVersion with the version string of the image.
  • A locked tag equal to the version string. The agent resolves the running version through this tag to find the package version that the device runs.

For example, the following commands publish version 2.1 of the gateway-efi-amd64 system, which Rugix Bakery writes to build/gateway-efi-amd64/system.rugixb:

nexigon-cli repositories packages create my-repo gateway-os
nexigon-cli repositories versions create my-repo/gateway-os \
    --tag 2.1,locked --metadata '{"imageVersion": "2.1"}'
nexigon-cli repositories assets upload my-repo \
    build/gateway-efi-amd64/system.rugixb
nexigon-cli repositories versions assets add <version-id> <asset-id> \
    gateway-efi-amd64.rugixb

The first command creates the package and is needed only once. The second creates the version with its locked tag and prints its ID as versionId. Devices do not see the version yet, because they follow stable. The third uploads the bundle and prints its ID as assetId. The fourth attaches the bundle under the filename that devices look for. Publish Software explains these commands. For hash verification, attach the bundle with the hash that Rugix Bakery writes to system.rugixb-hash:

hash=$(cat build/gateway-efi-amd64/system.rugixb-hash)
nexigon-cli repositories versions assets add <version-id> <asset-id> \
    gateway-efi-amd64.rugixb --metadata "{\"rugix\": {\"bundleHash\": \"$hash\"}}"

Releases do not reach devices until you deploy them, for example by moving the stable tag to the version, as Deploy System Updates describes. If the repository is private, link it to the devices’ project under Project Settings → Linked Repositories.

Automate Releases

The Nexigon template for Rugix Bakery and meta-nexigon include release scripts that follow these rules. For example, with the template:

./scripts/prepare-release.sh
./scripts/build-release.sh customized-efi-amd64
./scripts/upload-release.sh

prepare-release.sh generates a version string, such as build-20260401120000-abc1234, creates the version in Nexigon Hub with its locked tag, and saves the version in .release-env. The build script bakes that version into the image and bundle, and the upload script attaches the bundles with their metadata. The template’s GitHub Actions workflow runs the same scripts, with one build job for each system variant.

The upload scripts also attach the software bill of materials (SBOM) of the image and reference it in the bundle’s metadata:

{
  "rugix": { "bundleHash": "sha512-256:..." },
  "relations": { "sbom": ["customized-efi-amd64.spdx.json"] }
}

relations.sbom names a file of the same version. With vulnerability management, a preview feature, Nexigon indexes it to find known vulnerabilities in the release and on the devices that run it.

Verify the Integration

Publish a first release, move the stable tag to it with nexigon-cli repositories versions tag <version-id> --tag stable,reassign, and boot a device with the image of that release. Once the agent has connected, read the update status on the device:

nexigon-agent device properties get dev.nexigon.ota.status

The command prints the status as value, for example (shortened):

{
  "result": "Found",
  "name": "dev.nexigon.ota.status",
  "value": {
    "currentVersion": "2.1",
    "currentVersionId": "pkg_v_7Hq2mWbXc9RtLpZ3sNfE1k",
    "state": "completed",
    "updater": { "name": "rugix", "version": "1.4.0", "bootedSlot": "a" }
  }
}

currentVersion shows the image’s version string, and currentVersionId the package version of the published release. The same status appears under Configure Updates on the device’s page in Nexigon Hub. As long as the release that path refers to does not exist, the state is failed. For other errors, inspect the agent’s log with journalctl -u nexigon-agent -b.

Then test an update end to end: publish a second release and deploy it to the device. The state passes through installing and rebooting, with Rugix Ctrl also committing, and ends with completed and the new version.

Test the rollback as well, before devices depend on it. For example, deploy a release in which Nexigon Agent is disabled. The new system cannot confirm the update, so the device returns to the previous system, and the agent reports the update as failed. With RAUC, run this test only once your image includes the check described in Rollback; with the default rauc-mark-good service, the device keeps the broken system and can no longer be updated remotely.

What the Image Needs

The Rugix Bakery recipes and the Yocto layers provide everything in this section. With a custom build, provide it yourself.

Update Engine

For Rugix Ctrl, install rugix-ctrl and set up the system for A/B updates, as described in the Rugix documentation. For RAUC, install rauc with a system configuration for your slots. RAUC installs from a URL only with streaming, which requires bundles in the verity or crypt format and network block device (NBD) support in the kernel.

The agent runs the update engine as its own user, which needs the privileges to install updates and reboot the device. The systemd unit of the recipes runs the agent as root.

Persistent State

An update replaces the root filesystem. Keep the agent’s TLS certificate and private key, by default in /etc/nexigon/agent/ssl, and its data directory, by default /var/lib/nexigon/agent, on storage that updates do not replace. If an update loses the saved credentials, an agent with provisioning disabled fails to start. If it loses the key, the agent creates a new one, which you must accept in Nexigon Hub before the device can connect again. The device’s fingerprint must also stay the same, so that the device keeps its device ID.

With Rugix Ctrl, persist both directories with state management:

/etc/rugix/state/nexigon.toml
[[persist]]
directory = "/etc/nexigon/agent/ssl"

[[persist]]
directory = "/var/lib/nexigon/agent"

With RAUC, place the files on a data partition, point ssl-cert, ssl-key, and data-path in the agent’s configuration to it, and mount the partition before the agent starts.

Rollback

An update can produce a system that boots but does not work, for example because it cannot reach Nexigon Hub.

With Rugix Ctrl, a new system runs on trial until the agent commits it, which the agent does only after it has connected to Nexigon Hub. Until then, the next reboot returns the device to the previous system. A watchdog triggers this reboot: it reboots the device if the running system is still uncommitted after a timeout. The nexigon/nexigon-rugix-watchdog recipe and the meta-nexigon-rugix layer install a watchdog with a timeout of 30 minutes, which the recipe’s timeout parameter changes.

With RAUC, the rauc-mark-good service commits a new system when it boots, independently of the agent. The bootloader then returns to the previous system only if the new one fails to boot. To also roll back systems that boot but do not work, replace rauc-mark-good with a service that runs rauc status mark-good only once nexigon-agent status reports the connection state Connected, and that reboots the device otherwise.