Bug#888743: pidofproc returns PIDs in foreign chroots and containers
AFAICS these bug reports seem to be related:
#742588: stop action of init script on the host system kills nscd daemons in linux containers
#858837: lsb-base: pidofproc should limit itself to processes in host system if running on an LXC host
#888569: sysv startup script stumbles over smtpd running in a LXC container
Probably there are more.
Since I replaced "pidof" by "pidof -c" in a private lsb-base package
Debian's startup procedure became much more stable in my environment
(appr >200 hosts running Jessie and Stretch, systemd and sysvinit).
I would suggest to include this change into experimental. Patch is
attached.
Another option might be to ignore pidof completely and rely upon the
services' pidfiles.
Regards
Harri
diff -ur lsb-9.20161125/debian/changelog lsb-9.20161125+nmu1/debian/changelog
--- lsb-9.20161125/debian/changelog 2016-11-25 16:15:24.000000000 +0100
+++ lsb-9.20161125+nmu1/debian/changelog 2018-01-29 14:32:26.000000000 +0100
@@ -1,3 +1,10 @@
+lsb (9.20161125+nmu1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * pidofproc: use "pidof -c" (Closes: #888743)
+
+ -- Harald Dunkel <harald.dunkel@aixigo.de> Mon, 29 Jan 2018 14:32:26 +0100
+
lsb (9.20161125) unstable; urgency=medium
[ Didier Raboud ]
diff -ur lsb-9.20161125/init-functions lsb-9.20161125+nmu1/init-functions
--- lsb-9.20161125/init-functions 2016-11-25 16:00:10.000000000 +0100
+++ lsb-9.20161125+nmu1/init-functions 2018-01-29 14:32:26.000000000 +0100
@@ -107,7 +107,7 @@
# pid file doesn't exist, try to find the pid nevertheless
if [ -x /bin/pidof ] && [ ! "$specified" ]; then
status="0"
- /bin/pidof -o %PPID -x $1 || status="$?"
+ /bin/pidof -c -o %PPID -x $1 || status="$?"
if [ "$status" = 1 ]; then
return 3 # program is not running
fi
Reply to: