Put hosts with unloaded CPU microcode updates in reboot
CI / tests (Python 3.10) (pull_request) Successful in 40s
CI / tests (Python 3.11) (pull_request) Successful in 39s
CI / tests (Python 3.12) (pull_request) Successful in 38s
CI / tests (Python 3.13) (pull_request) Successful in 38s
CI / lint (pull_request) Failing after 3s

On bare metal, needrestart -b reports NEEDRESTART-UCSTA: 2 when the
installed intel-microcode/amd64-microcode is newer than what the CPU
loaded at boot, which only a reboot fixes. The agent dropped those
lines. It now reports needrestart_ucsta, _uccur and _ucexp, and the
server puts the host in reboot with both revisions. Livepatch doesn't
cover it. needrestart skips the check in VMs, so only physical hosts
(debian-homelab today) report it; the host page gets a "CPU microcode"
row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Opus 5.5 committed 2026-11-01 15:25:57 -05:00
1 parent 4676942108
commit 8174f1df81
8 files changed
+79 -1

No files matched your search

+11
View File
@@ -105,6 +105,16 @@ def security_repo_summary(report: dict[str, Any]) -> str | None:
return f"{suite}, published {duration(age)} before the report"
def microcode_summary(report: dict[str, Any]) -> str | None:
state = {1: "current", 2: "update needs a reboot"}.get(report.get("needrestart_ucsta"))
if state is None:
return None # unknown, a VM, or no needrestart
cur, exp = report.get("needrestart_uccur"), report.get("needrestart_ucexp")
revs = f" (loaded {cur}, installed {exp})" if state != "current" and cur and exp else \
f" ({cur})" if cur else ""
return state + revs
def helper_units_summary(report: dict[str, Any]) -> str | None:
units = helper_units(report)
if not units:
@@ -532,6 +542,7 @@ class Handler(BaseHTTPRequestHandler):
field("Installed kernels", r.get("kernels_installed"), code=True),
field("needrestart", None if r.get("needrestart_ksta") is None else
f"KSTA={r['needrestart_ksta']} expected={r.get('needrestart_kexp') or '?'}"),
field("CPU microcode", microcode_summary(r)),
field("Livepatch", None if r.get("livepatch_state") is None else
f"{r['livepatch_state']}, {r.get('livepatch_fix_count') or 0} fixes applied, "
f"{r.get('livepatch_supported') or '?'} until {r.get('livepatch_upgrade_required') or '?'}"),