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:
1 parent
f88261d2f5
commit
4676942108
7 files changed
+61
-1
No files matched your search
@@ -45,6 +45,7 @@ FIELDS: dict[str, str] = {
|
||||
"boot_size_kb": "int",
|
||||
"boot_free_kb": "int",
|
||||
"dpkg_unfinished_packages": "strlist",
|
||||
"held_packages": "strlist",
|
||||
"ubuntu_pro_attached": "bool",
|
||||
"ubuntu_esm_infra": "str",
|
||||
"unattended_upgrades": "str",
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -547,6 +547,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
field("/boot free", None if r.get("boot_free_kb") is None else
|
||||
f"{r['boot_free_kb'] // 1024} MB of {(r.get('boot_size_kb') or 0) // 1024} MB"),
|
||||
field("Unfinished dpkg packages", r.get("dpkg_unfinished_packages"), code=True),
|
||||
field("Packages on hold", r.get("held_packages"), code=True),
|
||||
field("unattended-upgrades", unattended_upgrades_summary(r)),
|
||||
field("Kept back by unattended-upgrades", r.get("unattended_upgrades_kept_back"), code=True),
|
||||
field("Package lists age", duration(r.get("apt_lists_age_seconds"))
|
||||
|
||||
Reference in new issue
Block a user