Bug#926896: sysvinit-utils: pidof is unreliable

Tim Connors tim.w.connors at gmail.com
Wed Oct 20 00:41:47 BST 2021

Package: sysvinit-utils
Version: 2.96-7
Followup-For: Bug #926896

The broken behaviour introduced by the fix to #719273 is the
assumption that all D state processes are stuck.  D is indeed
"uninterruptable sleep", but uninterruptable in the sense that the
process can't respond to a signal until the system call returns.  It
might still be very responsive, but just doing a lot of IO.  For the
one limited use-case of pidof at system shutdown (that apparently
isn't even the case anymore according to[1]), you can be reasonably
sure that D state processes at system shutdown time are indeed stuck
(or just flushing a lot of data out to cache).  But pidof is used

Some processes don't do anything *but* IO - such as find and dd.  I
wasn't excited to find this morning that I couldn't `pidof find`

Now except for pidof being owned by the sysvinit-utils package, I'd
say the behaviour is entirely flipped around from what I'd expect by
the principle of least surprise - pidof should do the sane default of
checking all processes, and only in the limited shutdown case should
there be a flag to invert that behaviour and ignore D state processes
(I mean, I know when my NFS mounts go bad, a lot more goes wrong than
just pidof - do we really want to patch every sar cron.minute job to
ignore D state mounts too?  No, let's not special case everything, and
fix the root problem of a mount being stuck instead).  But sysvinit's
purpose is process management, so perhaps the redhat solution of
having that binary owned by another package, eg procps, is the correct

[1] "Also, at the current time (and IIRC this wasn't the case when we
submitted the original patch), start-stop-daemon is a binary not a
script, and it doesn't call pidof or killall.  Instead it uses its own
code, and that code is subject to the same issue where it hangs on
stuck NFS partitions.  Therefore, as it stands, applying this patch to
'pidof' will no longer resolve the issue; similar changes would have
to be made to 'killall'." -

-- System Information:
Debian Release: 11.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable'), (5, 'testing'), (2, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/12 CPU threads)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages sysvinit-utils depends on:
ii  libc6     2.31-13+deb11u2
ii  lsb-base  11.1.0

sysvinit-utils recommends no packages.

sysvinit-utils suggests no packages.

-- no debconf information

More information about the Debian-init-diversity mailing list