RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 991473 - 'service dnsmasq status' incorrectly identifies the libvirt dnsmasq process.
Summary: 'service dnsmasq status' incorrectly identifies the libvirt dnsmasq process.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: dnsmasq
Version: 6.4
Hardware: x86_64
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Tomáš Hozza
QA Contact: Jan Ščotka
URL:
Whiteboard:
Depends On:
Blocks: 947782 994246
TreeView+ depends on / blocked
 
Reported: 2013-08-02 13:37 UTC by Robert McSwain
Modified: 2018-12-03 19:30 UTC (History)
6 users (show)

Fixed In Version: dnsmasq-2.48-14.el6
Doc Type: Bug Fix
Doc Text:
Previously, the Dnsmasq service status verification in the init script was not sufficiently robust and only determined the presence of all the instances of Dnsmasq running on the system. As a consequence, the init script identified Dnsmasq as running even when no Dnsmasq system instance had been initiated. The init script has been fixed to explicitly verify the process with the process ID written in the PID file of the system instance. As a result, the status of the Dnsmasq system instance is now identified correctly even if there are running instances not started by the init script.
Clone Of:
Environment:
Last Closed: 2014-06-16 14:35:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed fix (663 bytes, patch)
2013-08-12 13:51 UTC, Tomáš Hozza
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 419973 0 None None None Never
Red Hat Product Errata RHBA-2014:0757 0 normal SHIPPED_LIVE dnsmasq bug fix update 2014-06-16 18:35:25 UTC

Description Robert McSwain 2013-08-02 13:37:24 UTC
'service dnsmasq status' incorrectly identifies the libvirt dnsmasq process.

Symptom:

Running the command 'service dnsmasq status' returns the value 'dnsmasq (pid 14397) is running...' even if there is no pid file in /var/run.

Cause:

This happens when the libvirtd service is started as is spawns its own copy of dnsmasq with the pid file down in /var/run/libvirt/network.

Issue:

When identifying services on a system, dnsmasq incorrectly shows as a *system* service as opposed to a subcomponent of libvirt.

Requested Remedy:

Please ensure that the system init script checks for the *system* dnsmasq, not the libvirt dnsmasq.


Output of scenario:

[root@test ~]# service dnsmasq status
dnsmasq (pid 2434) is running...
[root@test ~]# service dnsmasq stop

[root@test ~]# echo $?
0
[root@test ~]# service dnsmasq status
dnsmasq (pid 2434) is running...
[root@test ~]# service libvirtd status
libvirtd (pid  2329) is running...
[root@test ~]# ps -ef | grep dnsmasq
nobody    2434     1  0 01:26 ?        00:00:00 /usr/sbin/dnsmasq
--strict-order --local=// --domain-needed
--pid-file=/var/run/libvirt/network/default.pid --conf-file=
--except-interface lo --bind-interfaces --listen-address 192.168.122.1
--dhcp-range 192.168.122.2,192.168.122.254
--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
--dhcp-lease-max=253 --dhcp-no-override
--dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
--addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts

Patch Levels: Should be current as of 7/10/13
Kernel: 2.6.32-358.11.1.el6.x86_64
libvirt: libvirt-0.10.2-18.el6_4.9.x86_64
dnsmasq: dnsmasq-2.48-13.el6.x86_64

It appears this should've been resolved by https://bugzilla.redhat.com/show_bug.cgi?id=850944 however there is a lingering issue here.

Comment 1 Tomáš Hozza 2013-08-12 13:51:29 UTC
Created attachment 785691 [details]
Proposed fix

Fix dnsmasq initscript to correctly identify the system dnsmasq instance.

Comment 2 Robert McSwain 2013-08-12 14:02:43 UTC
In testing this from our end we cannot seem to reproduce this:

[root@testsystem-63vm ~]# uname -a
Linux testsystem-63vm 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed May 15 10:48:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@testsystem-63vm ~]# service libvirtd status
libvirtd is stopped
[root@testsystem-63vm ~]# service dnsmasq status
dnsmasq is stopped
[root@testsystem-63vm ~]# service dnsmasq start
Starting dnsmasq:                                          [  OK  ]
[root@testsystem-63vm ~]# service dnsmasq status
dnsmasq (pid  3134) is running...
[root@testsystem-63vm ~]# service dnsmasq stop
Shutting down dnsmasq:                                     [  OK  ]
[root@testsystem-63vm ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [FAILED]
Starting libvirtd daemon:                                  [  OK  ]
[root@testsystem-63vm ~]# service dnsmasq status
dnsmasq is stopped
[root@testsystem-63vm ~]# 

The user has seen that the 'pidof' code in /etc/init.d/functions appears to grab the pid of the process from the process table if it can't find a file in /var/run.

There is no file in /var/run so it's (correctly) using the pid from the libvirt instance and from what the user has investigated in the code, it seems to back up what he's seeing. 

I feel that this could be a holdover from the following bug as they seem to be fairly closely related.

https://bugzilla.redhat.com/show_bug.cgi?id=850944

The user's version of the package matches the errata that was released for this bug shown here however:

http://rhn.redhat.com/errata/RHSA-2013-0277.html

Output from the user's system:
[root@test ~]# rpm --verify dnsmasq
.......T.  c /etc/dnsmasq.conf

[root@test ~]# rpm -q dnsmasq
dnsmasq-2.48-13.el6.x86_64

[root@test ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)

Finally, the customer's /var/lib/libvirt/dnsmasq has three files:

default.addnhosts
default.hostsfile
default.leases

All of these are empty. Otherwise, user is not using dnsmasq and all files from the package verify cleanly (no changes).

Comment 3 Tomáš Hozza 2013-08-12 14:53:19 UTC
(In reply to Robert McSwain from comment #2)
> In testing this from our end we cannot seem to reproduce this:

You can reproduce this as follows:

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# ps -C dnsmasq
  PID TTY          TIME CMD
[root@localhost ~]# service dnsmasq status
dnsmasq is stopped
[root@localhost ~]# service libvirtd status
libvirtd (pid  2450) is running...
[root@localhost ~]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------

[root@localhost ~]# virsh net-start default
Network default started

[root@localhost ~]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
default              active     yes           yes

[root@localhost ~]# ps -C dnsmasq
  PID TTY          TIME CMD
 2785 ?        00:00:00 dnsmasq  -> *** started by libvirt ***
[root@localhost ~]# service dnsmasq status
dnsmasq (pid 2785) is running...  -> *** should be "dnsmasq is stopped" ***
[root@localhost ~]# service dnsmasq start
Starting dnsmasq:                                          [  OK  ]
[root@localhost ~]# service dnsmasq status
dnsmasq (pid  2826) is running...
[root@localhost ~]# service dnsmasq stop
Shutting down dnsmasq:                                     [  OK  ]
[root@localhost ~]# service dnsmasq status
dnsmasq (pid 2785) is running...  -> *** should be "dnsmasq is stopped" ***

> The user has seen that the 'pidof' code in /etc/init.d/functions appears to
> grab the pid of the process from the process table if it can't find a file
> in /var/run.
> 
> There is no file in /var/run so it's (correctly) using the pid from the
> libvirt instance and from what the user has investigated in the code, it
> seems to back up what he's seeing.

initscript uses function "status" from /etc/init.d/functions if
'service dnsmasq status' is called. 

> I feel that this could be a holdover from the following bug as they seem to
> be fairly closely related.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=850944

This issue is different from what I've fixed in Bug #850944. It was unidentified
at that time. But it is related to process pids, pidfiles in that the initscript
is incorrectly identifying a process that was not started using it.

Hope this and the reproducer helps you. Anyway if you have a customer ticket
for this issue I'm recommending adding it to this Bug so there is a higher chance
of getting it fixed in the future RHEL-6 releases.

Comment 4 Robert McSwain 2013-08-12 15:23:44 UTC
I've added the customer ticket to this issue. Thank you!

Comment 10 RHEL Program Management 2013-10-13 23:18:24 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 16 errata-xmlrpc 2014-06-16 14:35:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0757.html


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