Bug#1033791: check_running_kernel fails to find version on bookworm/arm64

2023-05-15 Thread Manfred Stock
Package: monitoring-plugins-contrib
Version: 42.20230308
Followup-For: Bug #1033791
Control: tags -1 patch

Hi,

we also ran into this issue on an ARM64 machine running Bookworm, and
the proposed fix seems to work. However, I currently believe that this
is essentially the same bug as reported as Debian bug #1029720 [1], but
on another code path that is triggered on ARM64 kernels which I guess
are not compressed, at least in some cases. So maybe it's preferable to
follow the same approach here, too. I've thus created a merge request
[2] which patches the existing patch (the patch is also attached to this
message for completeness).


Cheers,
Manfred


[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029720
[2] 
https://salsa.debian.org/nagios-team/nagios-plugins-contrib/-/merge_requests/8


-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing')
Architecture: arm64 (aarch64)

Kernel: Linux 6.1.0-9-arm64 (SMP w/6 CPU threads)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

monitoring-plugins-contrib depends on no packages.

Versions of packages monitoring-plugins-contrib recommends:
pn  bc   
ii  bind9-host   1:9.18.12-1
ii  binutils 2.40-2
ii  curl 7.88.1-9
pn  debsecan 
ii  file 1:5.44-3
pn  freeipmi-tools   
ii  libc62.36-9
pn  libcapture-tiny-perl 
pn  libdata-validate-domain-perl 
pn  libdata-validate-ip-perl 
pn  libdate-manip-perl   
pn  libdbd-mysql-perl
pn  libio-socket-ssl-perl
pn  libipc-run-perl  
ii  liblocale-gettext-perl   1.07-5
pn  liblwp-useragent-determined-perl 
pn  libmail-imapclient-perl  
pn  libmemcached11   
ii  libmonitoring-plugin-perl0.40-1
pn  libnet-cups-perl 
pn  libnet-dns-perl  
pn  libnet-dns-sec-perl  
pn  libnet-smtp-ssl-perl 
pn  libnet-smtp-tls-perl 
pn  libnet-smtpauth-perl 
pn  libnet-snmp-perl 
pn  libnet-ssleay-perl   
pn  libreadonly-perl 
pn  libredis-perl
pn  libtimedate-perl 
pn  libwebinject-perl
pn  libxml-simple-perl   
ii  lz4  1.9.4-1
ii  lzop 1.04-2
ii  monitoring-plugins-basic [nagios-plugins-basic]  2.3.3-5
ii  openssl  3.0.8-1
ii  perl 5.36.0-7
ii  perl-base [libsocket-perl]   5.36.0-7
ii  python3  3.11.2-1+b1
pn  python3-pymongo  
ii  ruby 1:3.1
pn  snmp 
pn  whois

Versions of packages monitoring-plugins-contrib suggests:
pn  backuppc   
ii  bind9-dnsutils [dnsutils]  1:9.18.12-1
pn  cciss-vol-status   
pn  expect 
ii  iproute2   6.1.0-2
pn  libsys-virt-perl   
pn  moreutils  
pn  mpt-status 
pn  nagios-plugin-check-multi  
pn  percona-toolkit
pn  perl-doc   
pn  python3-boto   
pn  smstools   

-- no debconf information
>From cbad7b3505ed0ca9aa91cce3a9d06569b81ab842 Mon Sep 17 00:00:00 2001
From: Manfred Stock 
Date: Mon, 15 May 2023 09:00:32 +0200
Subject: [PATCH] Extend fix for on-disk version detection on Bookworm

Commit 4ab7834e added a fix for Debian bug #1029720 [1] but only on the
code path for compressed kernel images. However, it seems like the same
issue also exists on non-compressed images that are used at least on
some ARM64 machines as reported in Debian bug #1033791 [2].

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029720
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033791
---
 

Bug#1033791: check_running_kernel fails to find version on bookworm/arm64

2023-04-01 Thread Peter Palfrader
On Sat, 01 Apr 2023, Peter Palfrader wrote:

> --- /usr/lib/nagios/plugins/check_running_kernel2023-03-08 
> 11:28:49.0 +0100
> +++ ./check_running_kernel  2023-04-01 11:35:33.643925332 +0200
> @@ -164,6 +164,8 @@
> cat_vmlinux "$image" "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a"  "lzop -dc"  0
> # zstd compressed image
> cat_vmlinux "$image" "\x28\xb5\x2f\xfd"  "zstd -dc"  0

Hm.  Maybe guard this cat with it being able to find the linux version
string too:

Something like 
if strings "$image"  | grep -q 'Linux version'; then
> +
> +   cat "$image"
fi
> 

> echo "ERROR: Unable to extract kernel image." 2>&1
> exit 1

weasel
-- 
|  .''`.   ** Debian **
  Peter Palfrader   | : :' :  The  universal
 https://www.palfrader.org/ | `. `'  Operating System
|   `-https://www.debian.org/



Bug#1033791: check_running_kernel fails to find version on bookworm/arm64

2023-04-01 Thread Peter Palfrader
Package: monitoring-plugins-contrib
Version: 42.20230308
Severity: normal

Hi!

check_running_kernel fails on my arm64 system:
  Linux nautilus 6.1.0-7-arm64 #1 SMP Debian 6.1.20-1 (2023-03-19) aarch64 
GNU/Linux

root@nautilus:~# /usr/lib/nagios/plugins/check_running_kernel
WARNING: Running kernel does not match on-disk kernel image: [Linux version 
6.1.0-7-arm64 (debian-ker...@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 
12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP Debian 6.1.20-1 
(2023-03-19) != Linux version 6.1.0-7-arm64 (debian-ker...@lists.debian.org) 
(gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) # SMP 
Debian 6.1.20-1 (2023-03-19)]

It seems just using the image as is, with cat, would help:

root@nautilus:~# ./check_running_kernel
OK: Running kernel matches on disk image: [Linux version 6.1.0-7-arm64 
(debian-ker...@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU 
Binutils for Debian) 2.40) #1 SMP Debian 6.1.20-1 (2023-03-19)]

--- /usr/lib/nagios/plugins/check_running_kernel2023-03-08 
11:28:49.0 +0100
+++ ./check_running_kernel  2023-04-01 11:35:33.643925332 +0200
@@ -164,6 +164,8 @@
cat_vmlinux "$image" "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a"  "lzop -dc"  0
# zstd compressed image
cat_vmlinux "$image" "\x28\xb5\x2f\xfd"  "zstd -dc"  0
+
+   cat "$image"

echo "ERROR: Unable to extract kernel image." 2>&1
exit 1
root@nautilus:~#

Cheers,
weasel
-- 
|  .''`.   ** Debian **
  Peter Palfrader   | : :' :  The  universal
 https://www.palfrader.org/ | `. `'  Operating System
|   `-https://www.debian.org/