Report packages on hold, and flag held kernel packages

A held package never upgrades, and apt's simulation leaves it out, so
its updates (security ones included) appear nowhere. A leftover hold on
linux-image-amd64 or linux-generic keeps a host on its kernel while it
looks current.

The agent reports installed held packages (dpkg's "hi") as
held_packages. A held linux-* package puts the host in update with the
apt-mark unhold hint; other holds, usually deliberate, get a note. The
host page lists them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Opus 5.5 committed 2026-11-01 15:24:27 -05:00
1 parent f88261d2f5
commit 4676942108
7 files changed
+61 -1

No files matched your search

+15
View File
@@ -327,6 +327,21 @@ def evaluate(received_at: int | None, report: dict[str, Any] | None, now: float,
more = f", +{n - 5} more" if n > 5 else ""
status.raise_to("update", f"{n} package{'s' if n != 1 else ''} not fully installed: "
f"{', '.join(unfinished[:5])}{more}; run dpkg --configure -a")
# Held packages never upgrade, and the simulation doesn't list them, so a held
# kernel package would make a host look current forever. Other holds are
# usually deliberate, but their updates (security ones too) are invisible.
if held := report.get("held_packages"):
kernel = [p for p in held if p.startswith("linux-")]
other = [p for p in held if not p.startswith("linux-")]
if kernel:
status.raise_to("update", f"kernel package{'s' if len(kernel) != 1 else ''} on hold, so "
f"kernel updates won't install: {', '.join(kernel[:5])}"
f"{', …' if len(kernel) > 5 else ''}; apt-mark unhold to release")
if other:
more = f", +{len(other) - 5} more" if len(other) > 5 else ""
status.note(f"{len(other)} package{'s' if len(other) != 1 else ''} on hold, "
f"updates to {'them' if len(other) != 1 else 'it'} won't show: "
f"{', '.join(other[:5])}{more}")
if low := boot_space_low(report, cfg):
status.raise_to("update", low)