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
@@ -308,6 +308,15 @@ security_repo() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Installed packages on hold (`apt-mark hold`, or dpkg's "hold" selection). apt
|
||||
# never upgrades them and the simulation doesn't list them, so their updates,
|
||||
# security ones included, don't show up anywhere else.
|
||||
held_packages() {
|
||||
dpkg-query -W -f='${db:Status-Abbrev}\t${binary:Package}\n' 2>/dev/null |
|
||||
awk -F '\t' 'substr($1, 1, 2) == "hi" { print $2 }' |
|
||||
sort -u || true
|
||||
}
|
||||
|
||||
# Size and free space of the filesystem holding /boot, in KiB, as "SIZE FREE";
|
||||
# empty if df can't tell. That's the root filesystem when /boot isn't its own
|
||||
# mount. A full /boot makes the next kernel's postinst fail, so the host stays
|
||||
@@ -456,6 +465,7 @@ build_report() {
|
||||
printf '"boot_size_kb":%s,' "$(json_int "$boot_size")"
|
||||
printf '"boot_free_kb":%s,' "$(json_int "$boot_free")"
|
||||
printf '"dpkg_unfinished_packages":%s,' "$(unfinished_packages | json_str_array)"
|
||||
printf '"held_packages":%s,' "$(held_packages | json_str_array)"
|
||||
case $pro_attached in
|
||||
true | false) printf '"ubuntu_pro_attached":%s,' "$pro_attached" ;;
|
||||
*) printf '"ubuntu_pro_attached":null,' ;;
|
||||
|
||||
Reference in new issue
Block a user