Skip to content

self update

Thomas Mangin edited this page Nov 15, 2026 · 7 revisions

Pre-Alpha. This page describes behavior that may change.

Ze can automatically download, verify, and install firmware updates on non-gokrazy deployments. The update cycle: check a version manifest, download the binary, verify its SHA-256, atomically replace the running binary via rename (keeping a .prev backup), and optionally restart.

Platform-aware backend

The update path depends on the platform Ze runs on:

Platform Backend Behaviour
Normal Linux Ze self-update SHA-256 verified download, atomic rename, .prev rollback, deterministic spread scheduling, maintenance windows, server-side pause, and persisted update history. Everything on this page applies.
Gokrazy appliance gokrazy-ab Reports backend: gokrazy-ab, probes the gokrazy management socket for reachability and features, and returns structured "unsupported" responses for the manual firmware operations. Gokrazy owns image updates (atomic A/B partition swap); push images with bin/ze-setup appliance push <name>. See Appliance.

show system update reports the active backend. The rest of this page describes the normal-Linux self-update backend.

Server setup

ze update serve

Ze includes a standalone update server for build infrastructure:

ze update serve --listen :8080
Path Purpose
GET /version.json Enhanced manifest (version, sha256, size, paused).
GET /<goos>/<goarch> Binary download.
GET /<goos>/<goarch>/sha256 Hex SHA-256 digest (text/plain).

The server computes SHA-256 at startup. If the binary changes on disk (rebuild), restart the server.

Under the daemon

A running daemon can serve the same endpoints itself, from any command surface (ze cli, SSH, the web, REST, gRPC, MCP):

update serve                      # answers {"running": false, "paused": false}
update serve start listen :8080   # answers {"listen": "[::]:8080", "paused": false}
update serve pause                # toggles the pause, answers the state it left
update serve stop                 # answers once the server has ended

update serve alone answers the status of the daemon's server and starts nothing. Without listen, the server listens on :8080; port 0 picks a free port and the answer names it. A daemon runs one update server at a time, so a second update serve start is refused until update serve stop. Stopping the daemon stops its update server, and the daemon finishes stopping only once the server has ended.

Pause mechanism

Two mechanisms, ORed together:

  • File: create a file named update-paused in the binary's directory. Remove to unpause.
  • Signal: send SIGUSR1 to the foreground ze update serve to toggle the in-memory pause state. A signal sent to a daemon reaches the daemon, not its server, so under the daemon update serve pause toggles it instead.

When paused, the manifest returns "paused": true. Clients with auto-apply stop downloading. Manual commands bypass pause.

Custom server

Any HTTP server returning the manifest JSON works. Required fields:

{
    "version": "26.05.20",
    "sha256": "a1b2c3d4...64hex",
    "size": 52428800,
    "paused": false
}

Optional fields: minimum-version (sequential upgrade enforcement), download-url (override download location, under the same URL rule as url below).

The server answers each request where it is asked. Ze follows a redirect of the manifest or of the binary only within the scheme and host of the request: a redirect to another host, or from https to http, is refused, and the target receives nothing. Configure the url the manifest really lives at, and name a binary on another host in download-url. The refusal reads "redirects to ..., and Ze did not follow it", and its fix: line sets url to the final manifest location, or asks the server to publish the binary's location as download-url, or to answer over https with no redirect.

Client configuration

Check-only (default)

system {
    update-check {
        url https://update.example.com/version.json;
    }
}

Daily check, report via show system update and show warnings. No download.

The url, and a manifest's download-url, must be HTTPS. Plain HTTP is accepted only when the host is the router itself (127.0.0.1, ::1 or localhost). The host is compared after the URL is parsed, so a name such as 127.0.0.1.example.com is not loopback. Every URL Ze reads a file from answers to this one rule, including the RIR delegation sources.

Fleet (automated with scheduling)

system {
    update-check {
        url https://update.example.com/version.json;
        interval 3600;
        auto-apply true;
        spread 1800;
        maintenance-window {
            start 02:00;
            end 06:00;
        }
        restart {
            time 03:00;
        }
    }
}

Check hourly. On new version: wait a random delay up to 30 minutes (spread), download and verify at any time, replace binary only between 02:00 and 06:00, restart at 03:00.

Lab (immediate)

system {
    update-check {
        url https://update.example.com/version.json;
        interval 300;
        auto-apply true;
        spread 0;
        restart {
            immediate;
        }
    }
}

Check every 5 minutes. Download immediately, stage, restart within 5 seconds.

CLI commands

show system update              # Current status
show system update history      # Last 20 update events

update system firmware check       # Trigger immediate version check
update system firmware download    # Download now (bypass spread, window)
update system firmware apply       # Full cycle: download+verify+stage+restart
update system firmware restart     # Restart into staged version
update system firmware rollback    # Restore previous version

Manual commands bypass spread and maintenance window.

Rollback

After a successful update, the previous binary is preserved as <binary>.prev. To roll back:

update system firmware rollback

This renames .prev to the target binary and restarts. After rollback, .prev no longer exists.

Fleet deployment

Spread

Each device computes a deterministic delay from its identity (machine-id or hostname) and the target version string. Default: 3600 seconds (1 hour). A fleet of 100 devices distributes downloads over approximately 1 hour.

Maintenance windows

The maintenance window gates only binary replacement (the rename step). Download and verification proceed at any time. Windows crossing midnight are valid: start 22:00 / end 06:00.

Sequential upgrades

If the server sets minimum-version, devices running an older version are blocked from updating. They must update to the intermediate version first.

Troubleshooting

Symptom Cause
"not configured" No url in update-check config.
"auto-apply requires server to provide sha256" Server manifest missing sha256 field.
"waiting for spread" Spread delay not elapsed. Use update system firmware download to bypass.
"waiting for maintenance window" Outside configured window. Use update system firmware apply to bypass.
"paused by server" Server manifest has paused: true; remove the pause file, send SIGUSR1, or run update serve pause on a daemon's server.
"checksum mismatch" Binary changed on server. Restart ze update serve.

See also

Adapted from main/docs/guide/self-update.md.

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally