liske / needrestart

Restart daemons after library updates.
GNU General Public License v2.0
420 stars 67 forks source link

Linux kernel >= 6.0 includes two version strings, breaking vmlinuz-get-version #263

Closed tik-stbuehler closed 4 months ago

tik-stbuehler commented 1 year ago

Hi,

vmlinuz-get-version is broken with recent kernels, because they include two version strings, and the first one is the wrong one (empty build-version after #).

For example (on debian testing/bookworm right now):

# tail -c+18126 /boot/vmlinuz-6.1.0-1-amd64 | unxz | grep -ao 'Linux version [0123456789].*'
Linux version 6.1.0-1-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-13) 12.2.0, GNU ld (GNU Binutils for Debian) 2.39.90.20221231) # SMP PREEMPT_DYNAMIC Debian 6.1.4-1 (2023-01-07)
Linux version 6.1.0-1-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-13) 12.2.0, GNU ld (GNU Binutils for Debian) 2.39.90.20221231) #1 SMP PREEMPT_DYNAMIC Debian 6.1.4-1 (2023-01-07)
unxz: (stdin): Compressed data is corrupt

Perhaps the script could prefer the version that doesn't have a space after #; the correct entry should (imho) have a non-empty build-version.

This doesn't affect x86, as needrestart extracts the (correct) version from the (uncompressed) header in that case, and doesn't use vmlinuz-get-version.

See also:

liske commented 4 months ago

Thanks (especially for identifying the cause)!