
Recall first from Delta updates and the update pipeline
- A pairwise binary patch requires the exact base it was built against.
- Chunk-based updates can reuse matching local content across several installed versions.
- A delta can reduce network traffic while the installer still writes a complete target image.
Enroll devices and build the inventory
3 min readOne device is a demo; a product is a fleet, so this lesson covers inventory, rollouts, provisioning, failure handling, and lifecycle.
A faulty update can leave a remote gateway powered but unable to report its status. The Linux watchdog API describes how a supported watchdog can reset a system when keepalives stop. That reset gives the bootloader another chance to start the device, and the fleet record still needs to show whether the device recovered. Update policy has to account for both local recovery and what the operator can confirm remotely. Linux watchdog API
Assign a unique device ID during manufacturing or enrollment and keep it across reboots, software updates, and credential renewals. If a Linux manufacturing tool generates random IDs, getrandom(2) provides random bytes. Have the registry enforce uniqueness regardless of how IDs are assigned. A serial number or assigned ID identifies the device. Enrollment also requires proof that the caller is entitled to claim that identity. getrandom(2): obtain random bytes
In a typical the process that gives a newly started device its individual configuration and operating credentials flow, a trusted manufacturing step records the device ID and provisions a device-specific bootstrap credential. On first boot the agent authenticates the enrollment endpoint and uses that credential to prove its claim. The device can generate its own operational key and submit a certificate request. After validating the claim, the service issues a client certificate bound to the inventory identity. The device retains the private key in protected storage and uses the certificate for authenticated check-ins. Retire the bootstrap credential after enrollment and renew operational certificates before expiry. Give the device a defined recovery process for a lost key or expired credential.
Enrollment has to survive a dropped reply. If the server accepts a request and the device loses its connection before receiving the result, an authorized retry for the same device and key should recover the enrollment result without creating another inventory record. Persist the key and enrollment progress locally. When renewing the credential later, keep the stable device ID so a release report issued before renewal still belongs to the same device.
Record the model and hardware revision, owner or site, rollout group, last confirmed running release, last contact, and support status. Keep the desired release separate from the last confirmed release. If the server assigned a new version yesterday and the device has been offline since, its old version is still the last confirmed one. Use model and revision to determine compatibility. Use groups such as internal units, pilot sites, and general production to control exposure. For each rollout, record the group membership used for the decision so you can reconstruct who was eligible.
Stage the release and stop expansion on failure
3 min readA an update offered to a small, deliberately selected group before broader deployment gives you a chance to catch failures under field conditions. Choose canaries that exercise the hardware revisions and operating conditions you plan to support. If every canary is on a fast office network, its results tell you little about intermittent links at remote sites. Define how long to observe the release, how many devices need to report, and which faults pause expansion. For example, you might require every reachable pilot to confirm a healthy boot over an agreed observation period and pause on any rollback.
After the canary passes, apply a percentage to the eligible production group. Combine the rollout ID and stable device ID, hash their unambiguously encoded values, and map the result to a bucket from 0 through 99. Offer the release when the bucket is below the chosen percentage. Raising the threshold keeps all previously selected devices eligible while admitting more. Use the same hash and encoding on every check-in. The bucket method approximates the requested percentage across a large cohort, so count selected devices explicitly in a small fleet. Eligibility still depends on hardware compatibility and any operational conditions needed for a safe restart.
Give operators a a server-side control that stops new update work for a release. Define the transition where it takes effect. For instance, stop offering new work and require a fresh authorization before an already downloaded image enters trial boot. A device that loses contact before that authorization can defer activation. An offline device that already began a trial will finish according to its local boot and health policy. When a release causes a defect after devices have confirmed it, track those devices and deploy an approved recovery release through a separate rollout.
Going deeperRollout states and fleet metrics
Keep a rollout state such as active, paused, or completed, and a separate per-device attempt state. An attempt can move from offered to installed to trial boot and then to confirmed or rolled back. A download or install can fail before trial boot. Record a device ID, rollout ID, attempt ID, event sequence, and reason with each report. A repeated report should leave the outcome unchanged. If a device reconnects and sends old events, keep those events for diagnosis and use the sequence and allowed transitions to prevent them from overwriting newer state.
Count eligible devices, devices that started an attempt, and devices that confirmed, rolled back, or failed. Track attempts separately from distinct devices so retries do not inflate fleet totals. For a fixed cohort, divide confirmed devices by eligible devices to measure coverage. Divide devices that have confirmed by devices that have started to measure confirmation among starters, and report pending and overdue counts alongside that ratio. A device missing beyond its reporting deadline is overdue with an unknown result until evidence arrives. Check these counts by hardware revision and site before expanding. An overall confirmation rate can hide a failure concentrated in one revision.
Recover locally and enforce the support policy
4 min readTreat an update as successful when the device confirms the new release after trial boot and a product-specific health check. Download verification, installation, and a boot into Linux are earlier milestones. For a gateway, a meaningful check could verify that its service starts, opens its local store, and processes a sample message. Check whether the service can do its job under expected field conditions. If intermittent connectivity is normal, design the local health test so an unrelated network outage does not make a good image fail. Report fleet connectivity separately.
Detect failures where they occur. If downloading, verifying, or writing the candidate fails, record the reason and keep the current image active. If the trial image starts but the health check fails, leave the trial unconfirmed and initiate a restart under the recovery policy. If the device hangs before the agent can act, a configured watchdog can trigger a restart when its keepalives cease. In an A/B design with boot-count fallback, the bootloader records each trial attempt persistently before handing off to the candidate. When the allowed attempts are exhausted without confirmation, it selects the last approved bootable slot. Confirmation clears the pending trial so normal reboots do not consume the trial budget. The exact mechanism depends on the bootloader and the board integration.
Keep enough information in persistent storage for the recovered agent to report the failed release and current slot. Check that the last approved image can still read the device's persistent data. If the candidate rewrites a database in an incompatible format before confirmation, switching slots alone cannot restore service. For the simulator, represent each slot by its release value and store the committed slot, trial slot, remaining attempts, and last outcome in a file per device. A trial that consumes its budget without confirming should return to the committed slot even if the server is unavailable. Report the outcome on the next successful check-in.
Deprecation announces that support for a release or device model will end and gives operators time to migrate. End of life, or EOL, is the published point at which the specified maintenance ends. Record the dates, the minimum supported release or replacement model, and the affected device IDs. Use the inventory to find devices still on the old release. Check that they can reach the supported release, including any required intermediate update. At retirement, remove the device from managed rollout groups and revoke its operating credential when its authorized access ends. Document how long it can still receive updates and which services it can still use.
For a critical vulnerability, designate an approved release as mandatory for affected devices. Set a deadline, select the earliest safe maintenance window, and use a canary to verify that the fix can be deployed safely. Enforce a minimum security generation on the device so newly installed images below that floor are rejected. Where appropriate, restrict service access for overdue devices while preserving access needed to receive the fix. A disconnected device can apply the policy when it reconnects and obtains the update. Record which devices have confirmed the critical release and which remain overdue. Advance the security floor only when the new release is confirmed and an approved recovery path meets the new floor.
Going deeperServer compromise and replay
Treat the fleet server as a source of deployment instructions and keep release signing authority separate. A compromised server may withhold updates or try to assign a valid release to an unintended group. A device should verify signed release metadata and the artifact digest, enforce target compatibility, and check any deployment authorization required by local policy. If the server lacks the signing keys, those checks prevent it from turning arbitrary bytes into a trusted release. They leave a service availability problem when the server withholds legitimate updates.
To defend against replay, persist a minimum accepted security generation in storage that a routine reimage cannot reset. Require signed metadata to bind the generation to the payload. Use monotonic metadata versions or expiry with trusted time to reject stale deployment instructions, including stale instructions that reference a release above the security floor. Define when an idempotent retry of the same authorized instruction is allowed. During a trial, local rollback can still select a previous approved image that satisfies the current floor. Once a higher floor is committed, recover with an approved image at or above that floor.
The next lesson, “Containers versus VMs and the OCI runtime,” looks at what changes when the updated application runs in a container and how that execution model differs from a virtual machine.
Key takeaways
- A stable device ID links inventory and update history across credential renewals.
- A staged rollout expands only after its canary cohort meets explicit health and reporting criteria.
- A boot-attempt limit allows local recovery when a trial image cannot report its own failure.
- A security floor rejects obsolete images and must preserve an approved recovery path.
Reflect
- Explain to a colleague, in two sentences: design an inventory record and a first-boot enrollment flow.
- Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
- What surprised you when you ran the commands yourself?
On a real board
Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.
References and further reading
Official documentation first. Links checked when the lesson was published.