Skip to content

Updates and rollback ​

Castmill OS updates the whole system at once and can always go back. An update never leaves a device half-updated or unbootable.

Platforms

A/B updates work on Intel x86-64 devices, the virtual machine and the Raspberry Pi 5 (new, not yet verified on a Pi). Pis flashed with v0.1.0 need to be flashed once with a newer image first.

How an update works ​

text
 running slot A                      slot B (inactive)
 ─────────────                       ─────────────────
 1. download + verify signature  →   2. written in the background
                                        (content keeps playing)
 3. maintenance window: reboot   →   4. trial boot of slot B
                                     5. castmill-health checks the device
                                        ├─ healthy  → slot B committed
                                        └─ not      → back to slot A
  1. Download. The agent streams a signed RAUC bundle over HTTPS. Bundles signed with other keys are rejected.
  2. Install. RAUC writes the new system to the inactive slot while the screens keep playing. A power cut at this point does no harm: the running slot isn't touched and the new one isn't activated yet.
  3. Activate. The device reboots into the new slot inside its maintenance window: 03:00–05:00 device-local time by default.
  4. Trial boot. GRUB boots the new slot with a counter of three attempts; if it doesn't come up, GRUB goes back to the previous slot. The Raspberry Pi boots the new slot once (the firmware's tryboot): any reset during the trial boots the previous slot again.
  5. Health check. Within 10 minutes castmill-health must see the system services running, data mounted, every connected screen rendering frames and Castmill reachable. Then it commits the new slot. Otherwise it marks the slot bad and the device goes back to the previous version.

A version that was rolled back isn't installed again. A network outage during the trial boot never causes a rollback, so a broken network at the site can't undo a good update.

Who starts an update ​

From Castmill (planned). Castmill will keep a registry of Castmill OS releases and let you choose the OS version for each device or group, with channels and staged rollouts. The device then reports the update status in the dashboard. This needs Castmill backend support, which is the next step for the integration. See Castmill integration.

On the device (now). On development images, or with support access, an update can be requested locally:

sh
castmill-agent update https://example.com/castmill-os-bundle-genericx86-64.raucb 0.2.0
castmill-agent update https://example.com/castmill-os-bundle-genericx86-64.raucb 0.2.0 --now
castmill-agent status

Without --now, the update is installed right away and activated in the next maintenance window. With --now, the device reboots into it as soon as it's installed.

Update states ​

castmill-agent status shows the state of the last update:

StateMeaning
idleNo update in progress
installingDownloading and writing the inactive slot
installedWritten; waiting for the maintenance window
activatingRebooting into the new slot, on trial
runningThe new version passed its health check and is committed
rolled_backThe new version failed; the device went back. The reason is in last_error.
failedThe download or the installation failed; the running system is unchanged

Try it ​

The development guide explains how to test an update and a rollback in the virtual machine.

Documentation licensed under CC BY 4.0. Code under MIT and Apache-2.0.