I'm getting a false positive on Gentoo with an EFI kernel, and the message is confusing because the versions are numerically identical but the file name differs.
Because .efi is part of the filename, needrestart thinks these are different kernels, even though they’re the same build.
needrestart --version
needrestart 3.11 - Restart daemons after library updates.
/etc/needrestart/needrestart.conf:
$nrconf{kernel_linux_glob} = '/efi/EFI/Linux/*-gentoo.efi';
$nrconf{kernelfilter} = qr/(?:\.efi)?$/; # doesn't make a difference
needrestart -k
The currently running kernel version is 6.18.18-gentoo which is not the expected kernel version 6.18.18-gentoo.efi.
uname -a
Linux host 6.18.18-gentoo #3 SMP PREEMPT Fri Mar 20 16:12:52 -03 2026 x86_64 Intel(R) Xeon(R) Gold 6244 CPU @ 3.60GHz GenuineIntel GNU/Linux
uname -r
6.18.18-gentoo
find /efi/EFI/Linux -type f
/efi/EFI/Linux/xxxxx-6.18.12-gentoo.efi
/efi/EFI/Linux/xxxxx-6.18.18-gentoo.efi
I'm getting a false positive on Gentoo with an EFI kernel, and the message is confusing because the versions are numerically identical but the file name differs.
Because .efi is part of the filename, needrestart thinks these are different kernels, even though they’re the same build.