Repository navigation
Description
What's the problem
rigforge.sh upgrade re-renders units, may rebuild XMRig for minutes, restarts the miner and re-tunes. Inside postinst it holds the dpkg lock and a failure leaves the package half-configured; skipping it leaves rendered units stale; unattended-upgrades could swap a live miner.
What it impacts
Every apt upgrade of an already set-up miner and anyone on unattended-upgrades.
How I found it
Reading upgrade() (2144-2192) and decide_rebuild (1800), and noting rendered units embed absolute lib paths that go stale until upgrade runs. node-manager's postinst (inert first install, version-greater-only, exit 0 on failure with one retry command) is the working precedent.
How important is it
Medium-high: it decides whether apt upgrade is trustworthy on a mining host.
Acceptance criteria
- On upgrade of a configured host, postinst only writes an upgrade-pending marker under /var/lib/rigforge and starts a one-shot unit with --no-block that runs
rigforge upgrade; dpkg returns promptly. - The one-shot rebuilds XMRig only when decide_rebuild requires it, re-renders all units, and restarts the miner automatically after success, and only then. On failure the previous build stays active, the marker is kept, the failure shows in status and doctor, and retry is one documented command.
- postinst never makes dpkg fail because the upgrade failed: it exits 0, the package stays configured, the failure is reported with the single retry command (for example
rigforge upgrade), and the previous build keeps running. - The upgrade is queued only when the new version is greater than the installed one and a configured miner exists (config present); a first install is inert.
- First install (no config) never queues an upgrade.
- A test upgrades from the previous package to the new one on the fake bench and asserts units re-rendered, marker cleared on success, and no restart on failure.
- Docs show
apt-mark holdto defer.
Possible solutions
A oneshot unit started from postinst. A path unit watching the marker is heavier with no benefit. Owner ruled on 2026-11-20: restart automatically, but only after a successful upgrade. node-manager does the activation inside postinst and never fails dpkg on an activation failure; RigForge keeps the one-shot unit outside dpkg because an XMRig rebuild can take minutes, but copies that failure behaviour.
Activity
Harden package upgrade failure handling and marker writes (#785)
Exclude the internal package-upgrade verb from completion drift guard (…
Drop the completion comment block touched by the verb exclusion (#785)
Remove the leftover comment line (#785)
Cover the package-upgrade dispatch with a black-box case (#785)
Keep tests/run.sh under its file-budget ceiling (#785)
Keep the operator identity and gate the restart on every render step (#…
Take the package-upgrade operator from the config owner (#785)
pithead-developer commentedon Nov 24, 2026
Merged in #808.
Run apt upgrades safely: postinst queues a one-shot upgrade outside d…