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

+12
View File
@@ -172,6 +172,18 @@ class AgentReportTest(AgentCase):
"libbar2", "libfoo1:amd64", "linux-headers-6.12.60+deb13-amd64",
"linux-image-6.12.60+deb13-amd64", "man-db"])
def test_held_packages(self):
with open(os.path.join(self.root, "dpkg-all"), "w") as f:
f.write("ii \tcurl\n"
"hi \tlinux-image-amd64\n"
"hi \tpostgresql-16\n"
"hn \tnot-installed\n"
"hc \tremoved-but-held\n"
"iF \tbroken\n")
r = self.report()
self.assertEqual(r["held_packages"], ["linux-image-amd64", "postgresql-16"])
self.assertEqual(r["dpkg_unfinished_packages"], ["broken"])
def test_no_unfinished_packages(self):
with open(os.path.join(self.root, "dpkg-all"), "w") as f:
f.write("ii \tcurl\nrc \told-pkg\n")
+12
View File
@@ -339,6 +339,18 @@ 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_held_kernel_package_is_a_problem(self):
s = self.level(report(held_packages=["linux-image-amd64"]))
self.assertEqual(s.level, "update")
self.assertEqual(s.reasons, ["kernel package on hold, so kernel updates won't install: "
"linux-image-amd64; apt-mark unhold to release"])
def test_other_held_packages_are_a_note(self):
s = self.level(report(held_packages=["postgresql-16", "docker-ce"]))
self.assertEqual(s.level, "ok")
self.assertEqual(s.reasons, ["2 packages on hold, updates to them won't show: postgresql-16, docker-ce"])
self.assertEqual(self.level(report(held_packages=[])).reasons, [])
def test_os_past_end_of_support(self):
s = self.level(report(os_id="debian", os_version_id="11"))
self.assertEqual(s.level, "update")