2

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:

  1. checkrestart (no simple binary state report for kernel boot)
  2. needrestart (same problem as #1)
  3. 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).
  4. reboot-notifier does not seem to offer anything that works.
  5. 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.

Johnny Utahh
  • 227
  • 1
  • 3
  • 12

1 Answers1

4

What about checking the return code? needrestart -k -p > /dev/null; echo $? gives 0 for an up-to-date kernel, and 2 if the running kernel is not the expected one.

gxx
  • 5,591
  • 2
  • 22
  • 42
  • `-k`, first time I'm seeing this option, thanks. I'll try it out. Question: is there an authoritative reference somewhere that specifies these `0` and `2` values, to authoritatively confirm the above translations? (eg: is this part of the Nagios definition for parsing return codes, per `-p`? @gf_ ) – Johnny Utahh Dec 16 '20 at 16:28
  • 1
    @JohnnyUtahh `0` maps to `OK`, while `2` maps to `Critical`, as per https://nagios-plugins.org/doc/guidelines.html#AEN78. Also, these return codes are configurable, as per https://github.com/liske/needrestart/blob/debian-buster/ex/needrestart.conf#L202-L214. – gxx Dec 16 '20 at 17:52
  • We ran some tests and `needrestart` appears (in a small # of test scenarios) to behave as specified above. Very cool. However: `needrestart` is very noisy and/or unacceptably intrusive in it's default behavior, even when used as above (as part of a script). Here's our config file changes (from `/etc/needrestart/needrestart.conf`'s defaults) to get it to "keep quiet" and/or not get in our way (these changes were educated guesses on our part), per Debian 10.6 / `needrestart` v3.4 (`etckeeper` change tracking): https://imgur.com/a/WtgpmgU – Johnny Utahh Dec 18 '20 at 00:44
  • All in all: we still do not understand why Debian needs to make a reboot-for-kernel-upgrade signal so bloody, freagin' hard. `/var/run/reboot-required` works wonderfully in Ubuntu; can anybody offer or speculate why has it not yet been adopted in Debian? – Johnny Utahh Dec 18 '20 at 00:46
  • Finally: big big thanks @gf_ for providing the above references and details. Super appreciated. – Johnny Utahh Dec 18 '20 at 00:47