Bug 527653 - /etc/init.d/ksm: line 69: [: -eq: unary operator expected
/etc/init.d/ksm: line 69: [: -eq: unary operator expected
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
rawhide
All Linux
high Severity medium
: ---
: ---
Assigned To: Mark McLoughlin
Fedora Extras Quality Assurance
:
Depends On:
Blocks: F12VirtBlocker
  Show dependency treegraph
 
Reported: 2009-10-07 03:10 EDT by CAI Qian
Modified: 2009-10-12 03:16 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-10-12 03:16:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description CAI Qian 2009-10-07 03:10:48 EDT
Description of problem:
Running ksm status without loading ksm module or kernel does not support it, it throws out errors.

# /etc/init.d/ksm status
cat: /sys/kernel/mm/ksm/run: No such file or directory
/etc/init.d/ksm: line 69: [: -eq: unary operator expected
ksm is not running

Version-Release number of selected component (if applicable):
qemu-common-0.11.0-3.fc12.x86_64

How reproducible:
always

Steps to Reproduce:
1. make sure the kernel does not have KSM enable.
2. service ksm status
  
Actual results:
untidy error messages

Expected results:
more meaningful error messages like "No KSM support in kernel or the module not loaded."
Comment 1 Mark McLoughlin 2009-10-09 07:11:00 EDT
Thanks, here's the fix I'll push for F-12:

http://gitorious.org/ksm-control-scripts/ksm-control-scripts/commit/c0b6774c9032ac3623a5d4f736707e6855e57867

Look okay to you danken?
Comment 2 Dan Kenigsberg 2009-10-09 08:14:34 EDT
you'd probably prefer to throw away stderr, not stdout, in
$(cat /sys/kernel/mm/ksm/run &>/dev/null)
;-)

and come to think of it, doing
[ "$(cat /sys/kernel/mm/ksm/run &>/dev/null)" != 1 ]
is a bit more robust (or should I say paranoid?).
Comment 3 Mark McLoughlin 2009-10-09 08:31:29 EDT
(In reply to comment #2)
> you'd probably prefer to throw away stderr, not stdout, in
> $(cat /sys/kernel/mm/ksm/run &>/dev/null)
> ;-)

Gah, I fixed that, but forgot to include it before pushing

> and come to think of it, doing
> [ "$(cat /sys/kernel/mm/ksm/run &>/dev/null)" != 1 ]
> is a bit more robust (or should I say paranoid?).  

Okay

Pushed this:

http://gitorious.org/ksm-control-scripts/ksm-control-scripts/commit/71db2c0ac8
Comment 4 Mark McLoughlin 2009-10-09 10:36:32 EDT
* Fri Oct  9 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-6
- Fix fs errors with virtio and qcow2 backing file (#524734)
- Fix ksm initscript errors on kernel missing ksm (#527653)
- Add missing Requires(post): getent, useradd, groupadd (#527087)
Comment 5 Mark McLoughlin 2009-10-09 12:01:38 EDT
tag request: https://fedorahosted.org/rel-eng/ticket/2429
Comment 6 Mark McLoughlin 2009-10-12 03:16:39 EDT
tagged now for F12 GA

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