How can we (more) easily determine if a kernel-change-reboot is required in Debian, other than doing this in a script (which is a bit cumbersome)?
Ubuntu has /var/run/reboot-required
and per our experience it works well. However, thus far Debian (at least in Buster, 10.6) does not. Some package(s) might have done this in the past (prior to Debian Jessie) and were replaced thigns that try/claim to do it today, but we've seen nothing work (in 10.6). Details below.
Things we've tried (in Debian 10.6) with no success:
- checkrestart (no simple binary state report for kernel boot)
- needrestart (same problem as #1)
- Despite https://serverfault.com/a/667082/104173 claiming so,
/var/run/reboot-required.pkgs
has not yet been visible on our Debian 10.6 system (after a kernel upgrade). - reboot-notifier does not seem to offer anything that works.
lsof | grep lib | grep DEL
does not (yet) seem to provide what we need.
"Nagios output mode" for some of the above options do not (yet) seem easily parsable.
What about checking the return code?
needrestart -k -p > /dev/null; echo $?
gives0
for an up-to-date kernel, and2
if the running kernel is not the expected one.