Bug 1262857

Summary: 'pidof -m' option gives inavlid option error
Product: Red Hat Enterprise Linux 6 Reporter: Soumya <soumya.324>
Component: sysvinitAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.7   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-16 11:37:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Soumya 2015-09-14 13:38:11 UTC
With package initscripts-9.03.49-1.el6.centos.x86_64, there is an addition of -m option in function __pids_pidof, in file /etc/rc.d/init.d/functions

-------------------------
183 # Output PIDs of matching processes, found using pidof
184 __pids_pidof() {
185 pidof -c -m -o $$ -o $PPID -o %PPID -x "$1" || \
186 pidof -c -m -o $$ -o $PPID -o %PPID -x "${1##*/}"
187 }
-------------------------

But pidof command isn't recognizing the -m option, though the rpm changelog shows -m option is added.

------------------------
$ pidof -c -m -o 41849 -o 41842 -o %PPID -x SRVC
pidof: invalid options on command line!

$ rpm -qf /sbin/pidof
sysvinit-tools-2.87-6.dsf.el6.x86_64

$ rpm -q --changelog sysvinit-tools-2.87-6.dsf.el6.x86_64 | head -4
* Thu Feb 26 2015 Lukáš Nykrýn <lnykryn> - 2.87-6.dsf
- pidof: add -m option (#883857)
- count with deleted binaries (#760251)
------------------------

Because pidof command gives invalid option error, its not possible to cleanly restart a service [leading service instability].

Comment 2 Lukáš Nykrýn 2015-09-15 13:16:59 UTC
Hmm I can't reproduce the issue:

[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[1] 1428
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[2] 1437
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[3] 1448
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[4] 1461
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[5] 1471
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[6] 1481
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[7] 1490
[lnykryn@notas src(rhel-6.7)]$ ./pidof -c -m -o 1428 -o %PPID -x sleep
[lnykryn@notas src(rhel-6.7)]$

Comment 3 Lukáš Nykrýn 2015-09-15 13:49:46 UTC
and one more test on rhel6 machine:
[root@rhel6 init.d]# rpm -q initscripts sysvinit-tools
initscripts-9.03.49-1.el6.x86_64
sysvinit-tools-2.87-6.dsf.el6.x86_64
[root@rhel6 init.d]# . /etc/init.d/functions 
[root@rhel6 init.d]# sleep 600 &
[3] 1412
[root@rhel6 init.d]# sleep 600 &
[4] 1413
[root@rhel6 init.d]# sleep 600 &
[5] 1414
[root@rhel6 init.d]# sleep 600 &
[6] 1415
[root@rhel6 init.d]# set -x
++ printf '\033]0;%s@%s:%s\007' root rhel6 /etc/init.d
[root@rhel6 init.d]# __pids_pidof sleep
+ __pids_pidof sleep
+ pidof -c -m -o 1379 -o 1375 -o %PPID -x sleep
1415 1414 1413 1412 1405 1404
++ printf '\033]0;%s@%s:%s\007' root rhel6 /etc/init.d

Comment 4 Soumya 2015-09-16 11:27:13 UTC
Ohh, I think I got the issue.. So I installed virtuozzo on top of centos 6.7.. which changes /sbin/pidof:

Earlier:

--------------
[root@ ~]# which /sbin/pidof
/sbin/pidof
[root@ ~]# rpm -qf /sbin/pidof
sysvinit-tools-2.87-6.dsf.el6.x86_64
[root@ ~]# ls -al /sbin/pidof
lrwxrwxrwx. 1 root root 8 Sep 16  2015 /sbin/pidof -> killall5
[root@ ~]# 
--------------

Post virtuozzo installation:

--------------
[root@ ~]# which /sbin/pidof
/sbin/pidof
[root@ ~]# rpm -qf /sbin/pidof
sysvinit-tools-2.87-6.dsf.el6.x86_64
[root@ ~]# ls -al /sbin/pidof
lrwxrwxrwx. 1 root root 8 Sep 16  2015 /sbin/pidof -> /sbin/vzpidof
[root@ ~]# rpm -qf /sbin/vzpidof
vz-redhat-compat-4.6.0-5.x86_64
--------------

So its an issue with the vz package.

Sorry for the trouble, and thanks for your time  Lukáš Nykrýn

Comment 5 Soumya 2015-09-16 11:30:46 UTC
CLOSED

Comment 6 Lukáš Nykrýn 2015-09-16 11:37:20 UTC
Never mind, glad to help.