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

+9 -1
View File
@@ -9,7 +9,7 @@ Each host gets one status. When several apply, the worst one wins:
| Status | Meaning |
|----------|---------|
| `stale` | No report in `stale_after_hours` (default 3h), or never. Other data can't be trusted. |
| `reboot` | A newer kernel is installed but not running, or `/run/reboot-required` exists. |
| `reboot` | A newer kernel is installed but not running, `/run/reboot-required` exists, or newer CPU microcode is installed but not loaded. |
| `update` | A kernel or security update is available but not installed, services are running outdated libraries and need a restart, or apt's package lists are too old (`apt_stale_after_hours`) for "no updates" to mean anything. Also when `/boot` has less than `boot_min_free_mb` free, dpkg left packages half-installed, a kernel package is on hold, the OS release no longer gets security updates, unattended-upgrades is enabled but hasn't succeeded in `unattended_upgrades_stale_after_days`, the release's security repository is missing from apt or hasn't refreshed in `security_repo_stale_after_days`, or one of kernelwatch's own helper units has failed three runs in a row. |
| `ok` | Running the newest installed kernel, with no security or kernel updates pending. |
@@ -39,6 +39,14 @@ How the agent works it out:
The agent never runs as root, and needrestart never gets network access. Fix it on the host:
`sudo needrestart -r a` (or restart the listed services), and the next report
clears it.
- **CPU microcode**: on bare metal, needrestart also compares the microcode
revision the CPU loaded at boot with the one the installed `intel-microcode`
or `amd64-microcode` package provides. A newer one only loads on a reboot, so
it puts the host in `reboot`: "CPU microcode update installed but not loaded
(0x001e → 0x0020)". Livepatch doesn't cover it. needrestart skips the check in
virtual machines (the hypervisor handles microcode), so the host page's "CPU
microcode" row only appears on physical hosts. Agents before 0.10.0 don't
report it.
- **Ubuntu Livepatch**: with [Livepatch](https://ubuntu.com/security/livepatch)
(free for personal use with Ubuntu Pro), a newer kernel being installed doesn't
mean the running one is unpatched. If Livepatch is healthy (`applied` or