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 972314 - Every upgrade starts 'ksmd' due to broken initscript 'status' function
Summary: Every upgrade starts 'ksmd' due to broken initscript 'status' function
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Novotny
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-08 10:59 UTC by Enrico Scholz
Modified: 2014-02-02 22:39 UTC (History)
11 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.380.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-21 06:59:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Simple patch that fixes this issue (1.20 KB, patch)
2013-06-25 12:48 UTC, Michal Novotny
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:1553 0 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2013-11-20 21:40:29 UTC

Description Enrico Scholz 2013-06-08 10:59:29 UTC
Description of problem:

[root@bintak qemu]# /etc/init.d/ksm stop
Stopping ksm:                                              [  OK  ]
[root@bintak qemu]# /etc/init.d/ksm condrestart
Stopping ksm:                                              [  OK  ]
Starting ksm:                                              [  OK  ]

--> 'service ksm condrestart' (which is executed by %post script) starts always ksm.

This happens due do broken status() function:

----
status() {
         ...
        RETVAL=0
    fi; fi
}
  ...

  condrestart|try-restart)
        status >/dev/null 2>&1 || exit 0
        restart
----

E.g. 'RETVAL' is computed but never returned so that 'status' always succeeds and the 'restart' is executed unconditionally.


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

qemu-kvm-0.12.1.2-2.355.el6_4.5.x86_64

Comment 2 Qunfang Zhang 2013-06-08 12:35:19 UTC
Reproduce this issue on qemu-kvm-0.12.1.2-2.375.el6.x86_64.

1. Stop ksm service
[root@localhost home]# service  ksm stop
Stopping ksm:                                              [  OK  ]

2. [root@localhost home]# service ksm condrestart
Stopping ksm:                                              [  OK  ]
Starting ksm:                                              [  OK  ]
[root@localhost home]# 

Expected result:
After step 2, ksm should not be restarted if it's stopped previously.

Comment 3 Ademar Reis 2013-06-12 12:54:24 UTC
Enrico, thanks for taking the time to enter a bug report with us. We appreciate
the feedback and look to use reports such as this to guide our efforts at
improving our products. That being said, we're not able to  guarantee the
timeliness or suitability of a resolution for issues entered here because this
is not a mechanism for requesting support.

If this issue is critical or in any way time sensitive, please raise a ticket
through your regular Red Hat support channels to make certain  it receives the
proper attention and prioritization to assure a timely resolution.

For information on how to contact the Red Hat production support team, please
visit: https://www.redhat.com/support/process/production/#howto

Comment 7 Michal Novotny 2013-06-25 12:48:44 UTC
Created attachment 765072 [details]
Simple patch that fixes this issue

Simple patch that fixes this issue

Comment 9 Michal Novotny 2013-06-25 13:05:11 UTC
(In reply to Enrico Scholz from comment #0)
> Description of problem:
> 
> [root@bintak qemu]# /etc/init.d/ksm stop
> Stopping ksm:                                              [  OK  ]
> [root@bintak qemu]# /etc/init.d/ksm condrestart
> Stopping ksm:                                              [  OK  ]
> Starting ksm:                                              [  OK  ]
> 
> --> 'service ksm condrestart' (which is executed by %post script) starts
> always ksm.
> 
> This happens due do broken status() function:
> 
> ----
> status() {
>          ...
>         RETVAL=0
>     fi; fi
> }
>   ...
> 
>   condrestart|try-restart)
>         status >/dev/null 2>&1 || exit 0
>         restart
> ----
> 
> E.g. 'RETVAL' is computed but never returned so that 'status' always
> succeeds and the 'restart' is executed unconditionally.
> 
> 
> Version-Release number of selected component (if applicable):
> 
> qemu-kvm-0.12.1.2-2.355.el6_4.5.x86_64

Thanks for your analysis Enrico. You are correct, it's been caused by return value not used. See comment #7 for fix :-)

Thanks,
Michal

Comment 12 Qunfang Zhang 2013-07-09 08:11:17 UTC
Verified pass on qemu-kvm-0.12.1.2-2.377.el6.

[root@t2 home]# service  ksm stop
Stopping ksm:                                              [  OK  ]
[root@t2 home]# service  ksm status
ksm is not running
[root@t2 home]# service ksm condrestart
[root@t2 home]# 
[root@t2 home]# service  ksm status
ksm is not running
[root@t2 home]# 
[root@t2 home]# service ksm start
Starting ksm:                                              [  OK  ]
[root@t2 home]# service  ksm status
ksm is running
[root@t2 home]# service ksm condrestart
Stopping ksm:                                              [  OK  ]
Starting ksm:                                              [  OK  ]
[root@t2 home]# service  ksm status
ksm is running

Comment 16 errata-xmlrpc 2013-11-21 06:59:17 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/RHSA-2013-1553.html


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