Red Hat Bugzilla – Bug 972314
Every upgrade starts 'ksmd' due to broken initscript 'status' function
Last modified: 2014-02-02 17:39:01 EST
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
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.
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
Created attachment 765072 [details] Simple patch that fixes this issue Simple patch that fixes this issue
(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
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
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