2

Since beginning of February I keep seeing error messages of this kind:

E: Unknown Error: '<class 'KeyError'>' ("The cache has no package named 'linux-headers-5.4.0-144-generic:amd64'")

apt, apt-cache, aptitude ... none of them see a problem with the files that apt-check bemoans.

My problem is that we're using apt-check to ascertain figures of machines in need of an upgrade for both regular and security fixes. The monitoring stays broken until I actually run an upgrade, and I can't figure out what's stuck where.

Has anyone experienced similar issues, and, better yet, managed to figure out what's going on and fix them?

6
  • 1
    I got the same problem earlier today, in the notifications panel of my Ubuntu MATE. No solution yet.
    – egor83
    Commented Mar 3, 2023 at 1:15
  • 1
    @egor83 - does your problem disappear when you run an apt update && apt upgrade -y?
    – tink
    Commented Mar 3, 2023 at 1:37
  • 1
    I ran apt update and saw no errors related to this, but the error notification on the panel didn't go away yet. I plan to reboot soon, let's see whether it'd change anything.
    – egor83
    Commented Mar 3, 2023 at 3:29
  • 1
    You're lucky then :D ... I emergency patched our monitoring script and rolled it out to all machines via ansible about an hour after posting this ;) @egor83
    – tink
    Commented Mar 3, 2023 at 16:49
  • 1
    @egor83 bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/2007311
    – tink
    Commented Mar 5, 2023 at 21:07

2 Answers 2

2

I haven't found the root cause, but getting about 200 emails from cron every hour telling me that apt-check encountered a problem prompted me to find an alternative, and quickly =}

In the wrapper script that feeds the metrics to prometheus I've replaced the invocation of apt-check with the following:

/usr/bin/unattended-upgrade --dry-run -d 2>/dev/null | /usr/bin/awk 'BEGIN{sec=0;up=0}/^Checking: / {if($0~/archive:[^ ]+-security/){sec++}else{up++}}END{printf "%s;%s",up+sec,sec}'

No, it's not pretty ... but it does the job without making whiney noises.

0

Bug for this issue (backed by a customer case I filed as well for good measure): https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/2007311

Inadvertent fix of issue seems to be done via: https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/2008212

It's not pushed to Focal or Jammy yet but I'm pushing for that now in my customer support case since I have been playing wack a mole with this issue on a 300+ server fleet and it's no fun.

1
  • Thanks for pointing me at the 2nd link (the first one I had already posted in the comments above yesterday) ;) ... can't wait for it to make it out into the wild - not that I need it any longer after my work-around ;) ...
    – tink
    Commented Mar 6, 2023 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .