Possibilities to merge some parts of some of the daemons-that-need-to-be-restarted checkers (was: Re: Bug#776628: ITP: needrestart-session -- [...])
sorry for reopening this thread. I don't read firstname.lastname@example.org
regularily and stumbled upon this thread by accident via some blog
(Cc'ing Ritesh as requested as well the primary maintainers of the
mentioned packages where I'm co-maintainer, and upstream of
needrestart. See also below.)
Paul Wise wrote:
> On Fri, Jan 30, 2015 at 6:48 PM, Ritesh Raj Sarraf wrote:
> > Just FYI. Guido Gunther has done something similar with whatmaps
> > https://honk.sigxcpu.org/piki/projects/whatmaps
> I count at least 6 implementations of the concept now:
> checkrestart (from debian-goodies)
> needs-restarting (from yum)
There is at least one more in Debian:
The "libs" check in the package hobbit-plugins:
(Initially seems to be forked from dsa-check-libs to be adapted for
working together with the Hobbit/Xymon monitoring system, but has
grown to have more features including being configurable. It also took
ideas from needrestart for the hobbit-plugins libs check, too, before
this had grown to be more controllable via command-line. See below.)
Being co-maintainer of debian-goodies and hobbit-plugins as well as a
happy user (and like pabs a sedulous bug-reporter :-) of needrestart,
I'm well aware of at least these three implementations. Unfortunately
merging them is not easy:
* checkrestart is written in Python
* needrestart is written in Perl, requires to be run as root and is
focused on actually doing the restart
* hobbit-plugins/client-ext/libs is written in Perl, runs as
non-privileged users and outsources only a few root-permissions
requiring commands via sudo.
Merging tools written in Python and Perl means at least one of them
needs to be completely rewritten. And hence I don't expect this to
But what IMHO could be merged to some extent is at least the blacklist
knowledge about daemons which should not be restarted automatically.
Maybe also some more common data.
I imagine a separate package which just contains the well maintained
blacklist of daemons not to restart automatically. AFAIK the list is
neither small for needrestart nor for checkrestart. The package could
be named something like daemon-restart-blacklist and provide the list
e.g. in JSON or YAML format, maybe even both. (I personally would at
least avoid XML. :-)
Preferably this package would be maintained by upstream developers
and/or maintainers from multiple of these packages together.
With regards to hobbit-plugins' libs check, it's also on my TODO list
to check how far I can make use of needrestart and or checkrestart to
further reduce the number of implementations and code copying without
needing to remove too many of its features. Since the check itself
runs under an unprivileged user and only runs lsof, etc. via sudo, the
actual programming language of the test doesn't matter so much.
Unfortunately checkrestart doesn't yet have machine-readable yet
(https://bugs.debian.org/568359), so it's less optimal for that
Thankfully, needrestart's upstream (Thomas Liske, Cc'ed) already
integrated a few commandline switches after a discussion with me (and
possibly others) which allow to just run the tests and report the
results without actually restarting anything. Citing a short
explanation for the feature from a private mail by Thomas to me (now
translated to English by me):
| > By using the following options only the specified checks are
| > performed:
| > -k check for obsolete kernel
| > -l check for obsolete libraries
| together with -b (Batch Mode) this results in a usable output on
This is part of needrestart since 1.1. And 1.2 (hopefully) will be
part of Jessie.
167/1/0 root@c-crosser:pts/8 [~] # needrestart -b -k
168/0/0 root@c-crosser:pts/8 [~] # needrestart -b -l
169/0/0 root@c-crosser:pts/8 [~] #
(JFTR: The two listed services are some of those on the mentioned
blacklist. The output is from needrestart 1.2 as currently in Jessie.
The one machine where I have needrestart 2.0 installed currently
doesn't have any daemons to restart, so I can't test immediately if it
has the same behaviour.)
See also https://bugs.debian.org/762896 (by pabs).
For completeness' sake:
>From experience I'd say that both, libc6 and one of the library
packages built by the openssl source package seem also to have a
minimal implementation of that concept in their postinst scripts. But
actually checking /var/lib/dpkg/info/libc6:amd64.postinst and
/var/lib/dpkg/info/libssl1.0.0:amd64.postinst it seems that it's just
a hardcoded package list, though.
> Only needrestart seems to have the ability to notify user sessions
> about things that need restarting.
Yes. And that works quite well for me -- except that the desktop
notifications look quite ugly in Awesome's notifier widget. That one
neither seems to do automatic line wrapping nor does it interpret
HTML tags and hence shows them as plain text.
,''`. | Axel Beckert <email@example.com>, http://people.debian.org/~abe/
: :' : | Debian Developer, ftp.ch.debian.org Admin
`. `' | 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5
`- | 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE