needrestart
needrestart copied to clipboard
Linux kernel >= 6.0 includes two version strings, breaking vmlinuz-get-version
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 ([email protected]) (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 ([email protected]) (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:
- kernel commit breaking it: https://github.com/torvalds/linux/commit/2df8220cc511326508ec4da2f43ef69311bdd7b9
- lkml: answer to report of two version strings