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

+13
View File
@@ -339,6 +339,19 @@ class EvaluateTest(unittest.TestCase):
self.assertEqual(self.level(report(dpkg_unfinished_packages=[])).level, "ok")
self.assertEqual(self.level(report(dpkg_unfinished_packages=None)).level, "ok")
def test_microcode_update_needs_a_reboot(self):
s = self.level(report(needrestart_ucsta=2, needrestart_uccur="0x001e", needrestart_ucexp="0x0020"))
self.assertEqual(s.level, "reboot")
self.assertEqual(s.reasons, ["CPU microcode update installed but not loaded (0x001e → 0x0020)"])
for ucsta in (0, 1, None):
with self.subTest(ucsta=ucsta):
self.assertEqual(self.level(report(needrestart_ucsta=ucsta)).level, "ok")
def test_livepatch_doesnt_cover_microcode(self):
s = evaluate(NOW - 60, livepatched(needrestart_ucsta=2), NOW, CFG)
self.assertEqual(s.level, "reboot")
self.assertIn("CPU microcode update installed but not loaded", s.reasons)
def test_held_kernel_package_is_a_problem(self):
s = self.level(report(held_packages=["linux-image-amd64"]))
self.assertEqual(s.level, "update")