Package: needrestart Severity: wishlist On Debian using dkms or module-assistant one can dynamically build and load existing and new modules. There are modules in Debian that have different build and upload cycles than the Linux kernel in Debian. It would be nice for needrestart to report when the module in memory is different to the one on disk and therefore needs to be reloaded.
It appears that there is a way to tell if the loaded module is the same as the one on disk by using the Build-Id exposed by the Linux kernel in sysfs with the Build-Id present in the module file on disk. When the two Build-Ids are different, the module definitely needs reloading but when they are the same the module should not need to be reloaded. Usually it isn't safe to unload and reload a module so that should be left to the system administrator to do. The report should only happen when the Linux kernel version on disk is the same as the one in memory, since when Linux itself has been updated a full reboot is needed so reloading modules and then rebooting is not particularly useful. On systems with the Linux kernel livepatch support enabled, some modules might be different to the normal modules as IIRC the Linux kernel code in RAM gets patched via modules. $ modinfo realtek | head -n1 filename: /lib/modules/5.4.0-4-amd64/kernel/drivers/net/phy/realtek.ko $ file /lib/modules/5.4.0-4-amd64/kernel/drivers/net/phy/realtek.ko /lib/modules/5.4.0-4-amd64/kernel/drivers/net/phy/realtek.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=b5a51fad4e4a91c3cef79b3d5412d90c87e7dd2a, not stripped $ objdump -s --section .note.gnu.build-id /lib/modules/5.4.0-4-amd64/kernel/drivers/net/phy/realtek.ko /lib/modules/5.4.0-4-amd64/kernel/drivers/net/phy/realtek.ko: file format elf64-x86-64 Contents of section .note.gnu.build-id: 0000 04000000 14000000 03000000 474e5500 ............GNU. 0010 b5a51fad 4e4a91c3 cef79b3d 5412d90c ....NJ.....=T... 0020 87e7dd2a ...* $ hd /sys/module/realtek/notes/.note.gnu.build-id 00000000 04 00 00 00 14 00 00 00 03 00 00 00 47 4e 55 00 |............GNU.| 00000010 b5 a5 1f ad 4e 4a 91 c3 ce f7 9b 3d 54 12 d9 0c |....NJ.....=T...| 00000020 87 e7 dd 2a |...*| 00000024 -- bye, pabs https://wiki.debian.org/PaulWise
signature.asc
Description: This is a digitally signed message part

