needrestart icon indicating copy to clipboard operation
needrestart copied to clipboard

Xanmod kernel and needrestart

Open og900aero opened this issue 1 year ago • 1 comments

Hello. I use Xanmod kernel with Debian 12 stable. When I upgrade Xanmod kernel, then needrestart package show message:

Képernyőkép 2024-05-17 065502

I rebooted server and fastfetch show uses new kernel, but needrestart show again this message. What should I do?

og900aero avatar May 17 '24 05:05 og900aero

I've had the same issue with needrestart and xanmod kernels on Ubuntu for a long time now, on all versions of Ubuntu: 24.04, 23.10, ...

$ needrestart -k
Scanning linux images...                                                                                            

Pending kernel upgrade!

Running kernel version:
  6.8.10-x64v3-xanmod1

Diagnostics:
  The currently running kernel has an ABI compatible upgrade pending.

Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting.
[Return]

No amount of restarts gets rid of this false-positive result.

Kernels in GRUB for reference:

$ sudo update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.10-x64v3-xanmod1
Found initrd image: /boot/initrd.img-6.8.10-x64v3-xanmod1
Found linux image: /boot/vmlinuz-6.8.9-x64v3-xanmod1
Found initrd image: /boot/initrd.img-6.8.9-x64v3-xanmod1
Found linux image: /boot/vmlinuz-6.8.0-31-generic
Found initrd image: /boot/initrd.img-6.8.0-31-generic
Found memtest86+x64 image: /memtest86+x64.bin
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

phd avatar May 24 '24 20:05 phd

This might be related to #263. Could you apply d3e33025 locally (or switch to git HEAD) to check if the issue is already resolved?

liske avatar Aug 10 '24 08:08 liske

This might be related to #263. Could you apply d3e3302 locally (or switch to git HEAD) to check if the issue is already resolved?

I installed needrestart from Debian 12 repo (apt install needrestart). Can I get apply patch to this, or I must use git version?

og900aero avatar Aug 10 '24 20:08 og900aero

Try the following patch:

diff --git a/lib/vmlinuz-get-version b/lib/vmlinuz-get-version
index 3740f25..619a3a3 100755
--- a/lib/vmlinuz-get-version
+++ b/lib/vmlinuz-get-version
@@ -19,8 +19,10 @@
 
 get_version()
 {
-    # search and output version string pattern
-    grep -aom 1 'Linux version [0123456789].*' "$1" && exit 0
+    # search and output version string pattern,
+    # prefer the final version string (linux 6.1+)
+    grep -aoEm 1 'Linux version [[:digit:]].*#[^[:space:]]' "$1" && exit 0
+    grep -aoEm 1 'Linux version [[:digit:]].*#' "$1" && exit 0
 }
 
 try_decompress()

To apply this patch run this command patch /usr/lib/needrestart/vmlinuz-get-version as root and paste the patch to stdin. This change will be overriden next time you upgrade or reinstall needrestart.

liske avatar Aug 10 '24 22:08 liske

patch /usr/lib/needrestart/vmlinuz-get-version

I applied this patch, but when I run sudo needrestart, I get message (like first post) again. Maybe need reboot, and try again?

og900aero avatar Aug 11 '24 08:08 og900aero

A reboot ist not required, can you please provide the output of needrestart -v -k ?

liske avatar Aug 11 '24 09:08 liske

A reboot ist not required, can you please provide the output of needrestart -v -k ?

╰─$ sudo needrestart -v -k
[main] eval /etc/needrestart/needrestart.conf
[main] needrestart v3.6
[main] running in root mode
[Core] Using UI 'NeedRestart::UI::stdio'...
[main] systemd detected
[Kernel] Linux: kernel release 6.10.3-x64v3-xanmod1, kernel version #0~20240804.ga89cde1 SMP PREEMPT_DYNAMIC Sun Aug  4 06:16:42 UTC
Failed to load NeedRestart::Kernel::kFreeBSD: [Kernel/kFreeBSD] Not running on GNU/kFreeBSD!
[Kernel/Linux] /boot/vmlinuz-6.10.3-x64v3-xanmod1 => 6.10.3-x64v3-xanmod1 (root@runner-6areqvs9r-project-51590166-concurrent-0) #0~20240804.ga89cde1 SMP PREEMPT_DYNAMIC Sun Aug  4 0 [6.10.3-x64v3-xanmod1]
[Kernel/Linux] /boot/vmlinuz-6.9.11-x64v3-xanmod1 => 6.9.11-x64v3-xanmod1 (root@runner-huzfz3a5r-project-51590166-concurrent-0) #0~20240725.gd9c0ea3 SMP PREEMPT_DYNAMIC Thu Jul 25 1 [6.9.11-x64v3-xanmod1]
[Kernel/Linux] Expected linux version: 6.10.3-x64v3-xanmod1

Pending kernel upgrade!

Running kernel version:
  6.10.3-x64v3-xanmod1

Diagnostics:
  The currently running kernel has an ABI compatible upgrade pending.

Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. [Return]

og900aero avatar Aug 11 '24 09:08 og900aero

Try the following patch:

I patched vmlinuz-get-version, but the issue still occurs:

$ sudo needrestart -v -k
[main] eval /etc/needrestart/needrestart.conf
[main] needrestart v3.6
[main] running in root mode
[Core] Using UI 'NeedRestart::UI::stdio'...
[main] systemd detected
[Kernel] Linux: kernel release 6.10.3-x64v3-xanmod1, kernel version #0~20240804.ga89cde1 SMP PREEMPT_DYNAMIC Sun Aug  4 06:16:42 UTC
Failed to load NeedRestart::Kernel::kFreeBSD: [Kernel/kFreeBSD] Not running on GNU/kFreeBSD!
[Kernel/Linux] /boot/vmlinuz.old => 6.10.3-x64v3-xanmod1 (root@runner-6areqvs9r-project-51590166-concurrent-0) #0~20240804.ga89cde1 SMP PREEMPT_DYNAMIC Sun Aug  4 0 [6.10.3-x64v3-xanmod1]
[Kernel/Linux] /boot/vmlinuz-6.10.3-x64v3-xanmod1 => 6.10.3-x64v3-xanmod1 (root@runner-6areqvs9r-project-51590166-concurrent-0) #0~20240804.ga89cde1 SMP PREEMPT_DYNAMIC Sun Aug  4 0 [6.10.3-x64v3-xanmod1]
[Kernel/Linux] /boot/vmlinuz-6.9.12-x64v3-xanmod1 => 6.9.12-x64v3-xanmod1 (root@runner-5zaukmnig-project-51590166-concurrent-0) #0~20240728.ge137ddd SMP PREEMPT_DYNAMIC Sun Jul 28 1 [6.9.12-x64v3-xanmod1]
[Kernel/Linux] /boot/vmlinuz-6.8.0-40-generic => 6.8.0-40-generic (buildd@lcy02-amd64-075) #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul  5 10:34:03 UTC 2024 [6.8.0-40-generic]
[Kernel/Linux] /boot/vmlinuz => 6.8.0-40-generic (buildd@lcy02-amd64-075) #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul  5 10:34:03 UTC 2024 [6.8.0-40-generic]
[Kernel/Linux] Expected linux version: 6.10.3-x64v3-xanmod1

Pending kernel upgrade!

Running kernel version:
  6.10.3-x64v3-xanmod1

Diagnostics:
  The currently running kernel has an ABI compatible upgrade pending.

Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. [Return]
KERNELS:
     - vmlinuz-6.8.0-40-generic
     - vmlinuz-6.9.12-x64v3-xanmod1
     - vmlinuz-6.10.3-x64v3-xanmod1
CURRENT: Linux 6.10.3-x64v3-xanmod1

phd avatar Aug 11 '24 19:08 phd

Thanks for checking.

Sadly the above patch was incomplete. I've tested needrestart's git HEAD on a test vm with xanmod kernel and the issue did disappear.

liske avatar Aug 11 '24 20:08 liske

needrestart's git HEAD on a test vm with xanmod kernel and the issue did disappear.

How can I run needrestart from git? # ./needrestart doesn't seem to work. Do I have to make install?

phd avatar Aug 13 '24 19:08 phd

needrestart's git HEAD on a test vm with xanmod kernel and the issue did disappear.

How can I run needrestart from git? # ./needrestart doesn't seem to work. Do I have to make install?

sudo apt remove needrestart git clone https://github.com/liske/needrestart.git cd needrestart/ sudo make install

og900aero avatar Aug 14 '24 05:08 og900aero