Flag a /boot too full for the next kernel and packages dpkg left unfinished
CI / tests (Python 3.10) (pull_request) Successful in 29s
CI / tests (Python 3.11) (pull_request) Successful in 30s
CI / tests (Python 3.12) (pull_request) Successful in 29s
CI / tests (Python 3.13) (pull_request) Successful in 28s
CI / lint (pull_request) Successful in 4s
CI / tests (Python 3.10) (pull_request) Successful in 29s
CI / tests (Python 3.11) (pull_request) Successful in 30s
CI / tests (Python 3.12) (pull_request) Successful in 29s
CI / tests (Python 3.13) (pull_request) Successful in 28s
CI / lint (pull_request) Successful in 4s
A full /boot makes the next kernel's postinst fail: apt is left half-done
and the host quietly stays on its old kernel, which kernelwatch only
noticed indirectly, if at all. The agent now reports the size and free
space of the filesystem holding /boot (df) and the packages dpkg didn't
finish installing (half-installed, unpacked, half-configured, trigger
states or reinst-required, as dpkg --audit counts them).
The server puts a host in update when /boot has less than
boot_min_free_mb (default 200, 0 disables) free, or any package is
unfinished, with the fix in the reason ("run dpkg --configure -a"). The
host page shows both. Agents before 0.6.0 send neither field and are
judged as before. Agent 0.6.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e2f550414
commit
70272efed5
13 files changed
+173
-5
No files matched your search
@@ -308,6 +308,37 @@ class EvaluateTest(unittest.TestCase):
|
||||
self.assertEqual(self.level(report(apt_simulation_ok=True)).level, "ok")
|
||||
self.assertEqual(self.level(report()).level, "ok", "agents before 0.5.0 don't send it")
|
||||
|
||||
def test_low_boot_space(self):
|
||||
s = self.level(report(boot_size_kb=487 * 1024, boot_free_kb=95 * 1024))
|
||||
self.assertEqual(s.level, "update")
|
||||
self.assertEqual(s.reasons, ["/boot has 95 MB free, 81% used; the next kernel may not fit"])
|
||||
s = self.level(report(boot_free_kb=95 * 1024))
|
||||
self.assertEqual(s.reasons, ["/boot has 95 MB free; the next kernel may not fit"], "size unknown")
|
||||
|
||||
def test_enough_boot_space_or_unreported(self):
|
||||
self.assertEqual(self.level(report(boot_size_kb=999320, boot_free_kb=200 * 1024)).level, "ok")
|
||||
self.assertEqual(self.level(report(boot_free_kb=None)).level, "ok", "df failed")
|
||||
self.assertEqual(self.level(report()).level, "ok", "agents before 0.6.0 don't send it")
|
||||
|
||||
def test_boot_space_threshold_is_configurable(self):
|
||||
rep = report(boot_size_kb=999320, boot_free_kb=300 * 1024)
|
||||
self.assertEqual(evaluate(NOW, rep, NOW, Config(boot_min_free_mb=500)).level, "update")
|
||||
self.assertEqual(evaluate(NOW, report(boot_free_kb=0), NOW, Config(boot_min_free_mb=0)).level,
|
||||
"ok", "0 disables")
|
||||
|
||||
def test_unfinished_dpkg_packages(self):
|
||||
s = self.level(report(dpkg_unfinished_packages=["linux-image-6.12.60+deb13-amd64"]))
|
||||
self.assertEqual(s.level, "update")
|
||||
self.assertEqual(s.reasons, ["1 package not fully installed: linux-image-6.12.60+deb13-amd64; "
|
||||
"run dpkg --configure -a"])
|
||||
s = self.level(report(dpkg_unfinished_packages=[f"p{i}" for i in range(7)]))
|
||||
self.assertEqual(s.reasons, ["7 packages not fully installed: p0, p1, p2, p3, p4, +2 more; "
|
||||
"run dpkg --configure -a"])
|
||||
|
||||
def test_no_unfinished_dpkg_packages_or_unreported(self):
|
||||
self.assertEqual(self.level(report(dpkg_unfinished_packages=[])).level, "ok")
|
||||
self.assertEqual(self.level(report(dpkg_unfinished_packages=None)).level, "ok")
|
||||
|
||||
def test_reboot_outranks_update(self):
|
||||
s = self.level(report(needrestart_ksta=3, security_count=2))
|
||||
self.assertEqual(s.level, "reboot")
|
||||
|
||||
Reference in new issue
Block a user