Bug 182623 - 'service NetworkManager status' erroneously reports 'dead but pid file exists' when run without root privileges
'service NetworkManager status' erroneously reports 'dead but pid file exists...
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
Depends On:
Blocks: FC5Target
  Show dependency treegraph
Reported: 2006-02-23 13:37 EST by Nalin Dahyabhai
Modified: 2014-03-16 22:58 EDT (History)
4 users (show)

See Also:
Fixed In Version: 8.32-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-04-10 18:56:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Use the pid file in status() (847 bytes, patch)
2006-02-27 16:06 EST, Miloslav Trmač
no flags Details | Diff

  None (edit)
Description Nalin Dahyabhai 2006-02-23 13:37:50 EST
Description of problem:
Running '/sbin/service NetworkManager status' as an unprivileged user reports
that NetworkManager is dead, even if it's alive and well.  I blame this for many
an unnecessary 'sudo /sbin/service NetworkManager restart'.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Run '/sbin/service NetworkManager status' as an unprivileged user.
Actual results:
NetworkManager dead but pid file exists

Expected results:
NetworkManager (pid XXX) is running...

Additional info:
There are at least two things going on here.  The call to the 'status' function
in the init script hasn't been modified to pass the new location of the pidfile
(after bug #179903 was fixed) (quick fix: change 'status $processname' to
'status -p $pidfile $processname').

The 'status' function itself passes the -c flag to 'pidof', which due to a
permissions problem, can't determine which root directory NetworkManager is
using, and omits the right PID from its output.  I don't really know how to get
around this one.  Maybe it should be calling pidofproc() instead of __pids_pidof()?
Comment 1 Dan Williams 2006-02-27 02:18:22 EST
Ok, #1 fixed in CVS...

#2 is cute, even the manpage of pidof says "This option does not make sense for
non-root users".

Hopefully this can get pushed to rawhide soon.
Comment 2 Miloslav Trmač 2006-02-27 16:06:09 EST
Created attachment 125353 [details]
Use the pid file in status()

Removing the -c can generate false positives in chroots.

This patch is another way to add false positives :) by checking the pid file;
if the daemon is killed and the PID is reused, status () may report a false
positive.  Note that this doesn't help when unprivileged users don't have the
right to read the pid file (e.g. sendmail, {sys,k}logd).
Comment 3 Christopher Aillon 2006-02-27 16:17:54 EST
That's a patch to initscripts.  If work needs to happen there, it should go to

Note You need to log in before you can comment on or make changes to this bug.