Skip to content

Rig-side updater: download the signed bundle over Tor, verify, install into the spare slot, self-commit or fall back #4013

Open

Description

@pithead-developer

What's the problem

A shipped appliance rig has no way to take an OS update. The rig branch of os/overlay/pithead-boot only starts the miner and commits or fails the boot. Release fetch exists only on the coordinator, Tor-only, on its root control runner (lib/pithead/47-os-update-helpers.sh os_release_fetch, lib/pithead/48-os-update-verbs.sh os-check and os-download), and is not callable on a rig.

What it impacts

Rig owners can only re-flash the stick, which replaces /data and the token, so the rig must be adopted again. OS security fixes never reach rigs.

How I found it

Owner decisions of 2026-11-10 (items 5, 6, 7). Reading: the rig image already ships curl, jq, openssl, squashfs-tools, rauc and the baked keyring (os/rootfs/Dockerfile:38-65); pithead os-update is a local-file installer (lib/pithead/15-os-update.sh:218-300); the rig branch runs ./pithead local-miner at boot (os/overlay/pithead-boot:268-270).

How important is it

High for 2.1.0: it is the core of the rig OS update.

It is blocked by #4008, #4011, #4012.

Acceptance criteria

  • pithead rig-update check starts Tor through the helper, reads the release channel, reports available OS and appliance versions and stops Tor; it installs nothing.
  • pithead rig-update install [--tag T] [--max-version V] downloads (resumable, space-checked on /data; a truncated file is never verified as complete) and verifies: RAUC signature against the baked keyring, compatible string, variant, no downgrade, equal version refused, /data migration floor. It refuses any tag above --max-version using semantic comparison. A bundle larger than free /data space is refused with a reason.
  • It refuses when the other slot is uncommitted or an update is already pending.
  • Every refusal leaves the running slot untouched and the rig mining, with a reason in the status file.
  • Install writes the spare slot and reboots; the new slot self-commits when the miner is active; if the miner never comes up the next boot falls back.
  • The status file is written before the reboot, the verdict after the boot, on /data, and the feed can read it.
  • The bundle and partial files are deleted on every outcome. Tor is stopped after the download in every outcome.
  • No timer, unit or hook starts any of this on its own; no MEDIA=internal gate; works on a 16 GB stick layout.
  • Selftests cover each refusal and the fallback record; the stick KVM leg proves the whole flow.

Possible solutions

  • New verbs in the pithead script reusing os_verify_bundle_reason and os_update_version_guard with the hardened fetch (preferred).
  • Make the coordinator's os_release_fetch generic and call it from the rig; needs untangling of coordinator-only state.

Activity

  1. added this to the v2.1.0 milestone on Nov 10, 2026
  2. added
    enhancement
    appliance
    on Nov 10, 2026
  3. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Grouped with #4010, but PR #4044 does not close it: Its declared blockers pithead#4008, #4012 and #4011 are still open, so it is left for a follow-up PR.. Released for its own pick.

  4. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4011. Group (#4013, #4014, #4016) is blocked on prerequisites that must land first; nothing was edited, and no branch or PR exists for any of them. #4013 cannot start: the merged contract docs/dev/rig-os-update.md sequences #4011 as its direct prerequisite — #4011 lands the hardened shared release-channel fetch (host allowlist, size cap, strict tag regex, semantic version comparison, stale-channel reporting) that rig-update check/install must call, and states it is required before the rig updater ships; pithead#4011 is open and itself unblocked (its blocker #4007 has landed). #4014 needs rigforge#680 (feed broadcast of rig_id and os_version, open) before adoption-by-id and live clone detection can be recorded or proven; #4016 needs rigforge#684 and rigforge#681 (the rig-side update and release endpoints, both open) plus #4014 and #4013 — and rigforge#684 names pithead#4013 as its own blocker, so the landing order is #4011 → #4013 → rigforge#680/#681/#684 → #4014 → #4016, with no cycle. pithead#4012 (cert expiry/key rotation) is latent-future hardening the contract does not sequence before #4013. Finished so far: full read of the contract, all three issues, every declared blocker, and the existing os/ and lib/pithead update code; confirmed no parallel branch touches the shared fetch helpers. Unblock action: closing pithead#4011 (queue-ready now) resumes this session for #4013; closing rigforge#680 clears #4014; #4016 then follows its chain.

    The runner resumes this issue when that one closes.

  5. added
    blocked
    on Nov 12, 2026
  6. removed
    blocked
    on Nov 13, 2026
  7. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Owner rulings of 2026-11-15/16 change the scope and timing of this issue. Request to the operator: move its milestone from v2.1.0 to v2.0.5.

    Rulings that bind this issue:

    1. Remote OS update for RigForge-only appliances moves to v2.0.5, scoped to per-rig update only. Rig identity (Rig identity from the stick: random rig id plus token, hardware as hints, clone detection #4014), replace-stick (Replace-stick flow: operator action to move a rig's record and history to a new stick #4015), Update all and Remove rig (the rest of Coordinator: Upgrade rig and Remove rig drive the RigForge API and revoke a removed rig #4016), rig logs, install-to-disk removal (Drop install-to-disk for the rig role; the rig runs only from its USB stick #4019) and /release (Add a release (revoke) call so a removed rig can no longer be controlled or read through its old token rigforge#681) stay in v2.1.0.
    2. The endpoint lives on the rig, in the RigForge control API (Token-authenticated API to check for and perform an update, with scope, rate limit and single flight rigforge#684). The rig downloads its own signed bundle over its own on-demand Tor client. The coordinator never serves bundle files. pithead rig-update here is what that endpoint hands off to.
    3. Rigs must work independently of Pithead. The dashboard's per-rig "Update OS" button is only one client. A rig with no Pithead is updated by a documented API call from any LAN computer using the rig's token. There is no new UI on the rig, and no timers or automatic checks.
    4. Called by a Pithead, the coordinator's version is the ceiling (--max-version). Called directly, the default is the latest release. Equal versions and downgrades are refused in both cases.
    5. Rig egress is Tor only, except stratum to an external pool the owner configured. A separate egress audit will add time sync and DNS; it is a pending sibling and not designed here.
    6. If the RigForge release carrying the update API is not ready when the rest of 2.0.5 is, 2.0.5 ships for Pithead boxes only and rig owners stay on 2.0.3.
    7. Branch strategy: cherry-pick or retarget appliance: rig OS-update contract for self-fetch over Tor, and the on-demand Tor client in the image (#4007, #4008) #4040, appliance: harden the update channel — untrusted listing, host allowlist, size cap, tag validation, stale-channel reporting #4056 and appliance: fix #4013 — rig-side updater: signed bundle over Tor, spare-slot install, verdict in rig-update.json #4103 onto develop. Do not forward-merge develop-v2.1.0. PR appliance: fix #4013 — rig-side updater: signed bundle over Tor, spare-slot install, verdict in rig-update.json #4103 is currently a draft on develop-v2.1.0 and must be ported to develop or retargeted there.

    Added to the acceptance criteria for 2.0.5:

    • Privileged handoff: a root oneshot or path unit consumes the staged update intent from the rig's control API and runs pithead rig-update. The unit and its wiring are installed by the rig image. A test shows an unprivileged caller can only stage an intent, never run the update directly.
    • Status survives a fallback: a rig that installed, failed to bring the miner up and rolled back to the old slot still reports rolled_back with the reason after that boot. A KVM leg asserts this, not only the success case.
    • The 2.0.3 to 2.0.5 Keep-everything hop does not trip the /data migration floor or a hold, and the rig stays adopted. A KVM leg proves it.
    • Wrong clock: the behaviour defined by Release signing key rotation, cert expiry and clock handling for rigs that trust only the baked keyring #4012 applies. When the rig clock is wrong, the updater refuses with a clear reason and installs nothing. A test covers it.
    • Tor-only: the bundle and release listing are fetched only through the on-demand Tor client, stopped after every outcome. With no call, the rig makes no update-related request.

    The remaining acceptance criteria in the body stand. Parent tracker and sibling issues will be linked here once filed.

  8. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Needs an operator action (do it, then remove the operator-action label):

    PR #4103 needs an owner-only rewrite of head branch agent/4013-rig-side-updater-download-the-signed-bun from observed remote head c8a5dbfecdd6cb4e8bc4bb4c6e5d4b943e5ec7df onto develop before it can merge. Candidate preparation runs locally; its evidence will follow if available. Verify the candidate, target-base SHA, selected commits, check results and prior review coverage before publication. Publish only to the same PR head branch with an explicit lease on c8a5dbfecdd6cb4e8bc4bb4c6e5d4b943e5ec7df, followed by the base change; if the remote head moved, stop and reassess. Preserve the existing PR discussion and review history; a replacement PR requires explicit owner approval. Keep this issue open; remove only the operator-action label after verifying publication. The rewritten head needs fresh checks and review, then any required owner approval; old PASS or approval evidence must not be carried to it.

  9. added
    operator-action
    on Nov 16, 2026
  10. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Candidate preparation for PR #4103 (owner publication still required):

    Candidate prepared locally, nothing pushed. PR #4103's head branch is agent/4013-rig-side-updater-download-the-signed-bun with observed remote head c8a5dbf. The candidate branch candidate/4013-on-develop is origin/develop (73b11b6) plus my seven commits cherry-picked -x in order (c803546, 89f751b, 18d256f, 5d3a3fb, f91e795, 90ededd, c8a5dbf); candidate head is d1f06b983bf9d71901175051b4f7541b83d1dbaa. Its diff to develop is exactly this change — 15 files, +789/−8, zero hunks from other work. Conflicts resolved mechanically onto develop's variants: the verb lists (completion, 41-subcommand-chaining, CVL_COVERED, ROV_UNCLAIMED) rebuilt keeping develop's recovery-bundle and inserting rig-update; CHANGELOG keeps develop's bullets plus only my #4013 bullet; the docs/dev/rig-os-update.md contract-page edit was DROPPED (the page does not exist on develop). Focused checks on the candidate: make green; make lint-sh green; lint-file-budget green against the develop base; run.sh --help green; release-literal guard coherent (assembled count 2 == the test's new expectation); completion==PITHEAD_COMMANDS and both verb ledgers total — all green. BUT tests/os/selftest-rig-update.sh is 21/42 red: develop does not carry #4056 (lib/pithead/47a-os-update-channel.sh — the log shows os_channel_fetch: command not found) nor #4008 (the on-demand pithead-tor client), and #4040's contract page is absent — so the rewritten head CANNOT go green on develop until those land there first; the owner should sequence #4040/#4056 onto develop (or keep the develop-v2.1.0 base) before publishing. Requested owner action, before any merge: force-push (owner-only, in place) candidate/4013-on-develop's tree to agent/4013-rig-side-updater-download-the-signed-bun with an explicit lease on the observed head c8a5dbf — if the remote head has moved from that SHA, stop and reassess — then change PR #4103's base to develop, preserving the existing discussion and review history (a replacement PR needs explicit owner approval). The rewritten head must get fresh checks and review; existing evidence covers the old base only: GitHub CI 53-pass/mergeable and the tier4-kvm phases=rig success (bench job 358@c8a5dbf..., 307 pass/0 fail, all 16 rig-update leg rows green) were on c8a5dbf (commits c803546..c8a5dbf), and the verifier/security-reviewer passes covered the implementation c803546..90ededd lineage on the develop-v2.1.0 base; the 42/42 selftest green likewise only holds where #4056's helpers exist. Note GitHub never registered the Closes #4013 reference on this App-created PR — expect to close #4013 manually at merge.

  11. 15 remaining items

  12. added
    blocked
    on Nov 20, 2026
  13. removed
    blocked
    on Nov 21, 2026
  14. pithead-developer commented on Nov 22, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4302. Blocked on #4302, the 2.0.4 release. The owner reserved the fleet for the 2.0.4 release gate and cancelled both tier4-kvm jobs on head aaed523 (4405 and 4423). The cancellation says not to resubmit until pithead 2.0.4 is published, so there is no tier-4 evidence for this head yet. All review findings are answered, and the code, selftest, docs and PR body are pushed. GitHub checks were green at my last read, taken before the final push. When #4302 closes, the runner resumes this session: resubmit phases=rig on the head (merge the base first if it moved) and paste the bench-ci evidence block into the PR body. I posted this on PR #4103.

    The runner resumes this issue when that one closes.

  15. added
    blocked
    on Nov 22, 2026
  16. removed
    blocked
    on Nov 27, 2026
  17. pithead-developer commented on Nov 27, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4537. Blocked on #4537. On head 8b00967 the required check Build image (dashboard) fails on Trivy: libzstd1 CVE-2026-124851 (HIGH, fixed in 1.5.7+dfsg-1+deb13u1), inherited from the Debian base. The failing log line is the Trivy table, which I reopened. This diff does not touch the dashboard image. #4537 tracks it, and its fix, PR #4563 against develop-v2.0.5, is still open. The red check also keeps bench-submit from releasing the tier4-kvm job for this head, so there is no bench evidence for it yet. The rig-update selftest passes 64 checks on this head; 22 other GitHub checks passed and 19 were still queued at the last read. When #4537 closes, this session merges the base, re-reads the checks, submits phases=rig on the new head and pastes the evidence block into the PR. I posted this on PR #4103.

    The runner resumes this issue when that one closes.

  18. added
    blocked
    on Nov 27, 2026
  19. removed
    blocked
    on Nov 28, 2026
  20. pithead-developer commented on Nov 28, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4569. Still blocked, now on #4569 (the forward merge into develop-v2.0.5). #4537 is closed, but its fix (#4604) is on develop, and develop-v2.0.5 gets it only through #4569, which is still open. On head 8b00967 the only failing check is Build image (dashboard) (libzstd1 CVE-2026-124851); the other 42 checks pass. Merging the base into the branch added nothing, because it was already up to date. The red check keeps the tier4-kvm job for this head held, so there is still no bench evidence for it. When #4569 merges, this session merges the base, re-reads the checks, submits phases=rig and pastes the evidence block into the PR. I posted this on PR #4103.

    The runner resumes this issue when that one closes.

  21. added
    blocked
    and removed
    blocked
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    applianceenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions