liske/needrestart

Kernel checks fail when more than one kernel is available

izaera opened this issue ยท 3 comments

izaera commented

I'm using Arch Linux and I have two linux kernels available (current and LTS).

This is how my /boot directory listing looks like:

-rwxr-xr-x 1 root root    81920 ago  9 22:33 amd-ucode.img
drwxr-xr-x 4 root root     4096 oct  1  2022 EFI
-rwxr-xr-x 1 root root 75954024 sep  4 16:42 initramfs-linux-fallback.img
-rwxr-xr-x 1 root root 37745668 sep  4 16:42 initramfs-linux.img
-rwxr-xr-x 1 root root 72305024 sep  8 09:19 initramfs-linux-lts-fallback.img
-rwxr-xr-x 1 root root 37227592 sep  8 09:18 initramfs-linux-lts.img
drwxr-xr-x 3 root root     4096 sep 15 07:40 loader
-rwxr-xr-x 1 root root 12673312 ago 26 12:45 vmlinuz-linux
-rwxr-xr-x 1 root root 11455744 sep  8 09:18 vmlinuz-linux-lts

As you can see there are two vmlinuz-... files.

Now, apparently these lines of code check for those files and choose the wrong one. I don't know perl, so I may be wrong, but since I get this output from needrestart I guess that's the cause:

Scanning linux images...                                                                                                                                                                                            

Pending kernel upgrade!

Running kernel version:
  6.1.52-1-lts

Diagnostics:
  The currently running kernel version is not the expected kernel version 6.4.12-arch1-1.

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

You could use the #$nrconf{kernelfilter} config option to filter the kernel by a regex.

Multi kernel support in a generic way is not a trivial task. Since the config file is pure perl code you even could add some code to filter the image filenames depending on the running kernel.

Hey @liske thanks for your reply (and sorry for the late response).

I'll try to configure it in my local machine. I think that will do the job. If it doesn't work for any reason (which I doubt) I'll reopen the issue.

Thanks again :-)

Finally set the filter to $nrconf{kernelfilter} = qr(vmlinuz-linux-lts); (in Arch Linux, for LTS kernel) and it does the job perfectly ๐Ÿ‘Œ

Thx again.