Detect "reboot required" when a loaded kernel module no longer matches the installed driver packages (e.g. NVIDIA)
Environment: PatchMon server 2.1.6, agent 2.1.6, Debian 13 VM (Proxmox, GPU passthrough).
Problem
After a routine apt upgrade, the NVIDIA userspace libraries were updated
(615.71.09 -> 615.71.10) while the already loaded kernel module stayed at
615.71.09. The kernel itself did not change. The GPU became unusable
(nvidia-smi: "Driver/library version mismatch", CUDA_ERROR_NO_DEVICE,
Plex fell back to software transcoding and playback stuttered) until the VM
was rebooted. PatchMon did not flag the host as needing a reboot, so the
problem went unnoticed for two days.
Timeline (from the agent log)
- 2026-10-28 13:57: needs_reboot=true ("Kernel version mismatch", running
6.12.107, installed 6.12.113). Correct.
- 2026-10-28 13:59-14:00: host rebooted, needs_reboot=false.
- 2026-10-28 14:05: second apt upgrade updated the NVIDIA libraries
(.09 -> .10) after the reboot.
- From 14:11 on, every check reports needs_reboot=false, although the loaded
module (.09) no longer matched the installed packages (.10).
Cause
None of the NVIDIA packages create /var/run/reboot-required, and the agent's
reboot check (agent-source-code/internal/system/reboot.go,
CheckRebootRequired) only looks at /var/run/reboot-required,
/run/reboot-needed, needs-restarting -r and the running kernel versus the
newest installed kernel. A loaded module that is older than its installed
package is not covered. The agent binary contains no reference to
needrestart, /proc/driver/nvidia or /sys/module.
Suggested improvement (either would help)
1. Compare the loaded module version (/sys/module/<name>/version or
/proc/driver/nvidia/version) with the installed package version and flag
"reboot required" on mismatch, at least for NVIDIA.
2. Use needrestart -b as an additional source where it is installed
(it reports kernel and microcode state in batch mode).
Happy to test a build and provide logs.
0 Comments
No comments yet. Be the first to share your thoughts.
