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 662701 - Option -enable-kvm should exit when KVM is unavailable
Summary: Option -enable-kvm should exit when KVM is unavailable
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.0
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: rc
: 6.1
Assignee: Markus Armbruster
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 661767 (view as bug list)
Depends On:
Blocks: 580953 580954
TreeView+ depends on / blocked
 
Reported: 2010-12-13 16:24 UTC by Markus Armbruster
Modified: 2013-01-09 23:25 UTC (History)
11 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.148.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 11:32:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0534 0 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2011-05-19 11:20:36 UTC

Description Markus Armbruster 2010-12-13 16:24:24 UTC
Description of problem:
Upstream qemu exits unsuccessfully when -enable-kvm is given, but KVM is unavailable.  RHEL-6's qemu continues with KVM disabled.  This is undesirable.  libvirt rightly assumes upstream behaviour.

How reproducible:
Always

Steps to Reproduce:
1. chmod 600 /dev/kvm
2. qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -enable-kvm
  
Actual results:
open /dev/kvm: Permission denied
Could not initialize KVM, will disable KVM support
[qemu runs with KVM disabled]

Expected results:
Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied
[qemu exits unsuccessfully]

Additional info:
I doubt we need to match the error message exactly, exiting unsuccessfully should suffice.

Comment 2 Richard W.M. Jones 2010-12-13 17:01:23 UTC
This seems to leave us in a situation where we have to pass this
parameter in order to have any sort of performance, but we'll fail
unnecessarily if KVM is not available, and with no way to really tell
if KVM will work.

I don't think this is the right way to solve this bug, even for
libvirt.

What we really need here are capabilities.

Comment 3 Dor Laor 2010-12-14 10:12:02 UTC
Until we'll get capabilities and guestfish to use libvirt this is an intermediate solution

Comment 4 Markus Armbruster 2010-12-14 10:20:39 UTC
This bug is about a difference in behavior between RHEL-6 and upstream.  Libvirt is not prepared for this difference; it expects and relies on the upstream behavior.

Whether the upstream behavior is ideal for all use cases is a different question, outside the scope of this bug.  Discussion of this question belongs upstream.

It's pretty much consensus that we could use a structured way to query QEMU "capabilities".  But that's also outside the scope of this bug. "Capabilities" need to be developed upstream.

Comment 5 Richard W.M. Jones 2010-12-14 10:53:23 UTC
We had some discussion on IRC and it looks like the way
we are currently doing it will continue to work even with
this change.

Go ahead and we'll check it still works in QA.

Comment 6 Markus Armbruster 2010-12-14 14:20:32 UTC
I tested 

Upstream        |  default  |-enable-kvm|
----------------+-----------+-----------+
KVM available   | disabled  |  enabled  |
KVM unavailable | disabled  |    fail   |

RHEL-6          |  default  |-enable-kvm|
----------------+-----------+-----------+
KVM available   |  enabled* |  enabled  |
KVM unavailable | disabled  | disabled* |

* deviates from upstream

The deviation in the bottom-right case is the one originally reported.

The deviation in the top-left case is not covered by the original report.

I'd like to realign RHEL-6 with upstream, i.e. remove both deviations. 


Details:

Upstream, KVM available:
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

Upstream, KVM unavailable:
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied
[Exit 1 ]
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

RHEL-6, KVM available:
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q

RHEL-6, KVM unavailable:
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
open /dev/kvm: Permission denied
Could not initialize KVM, will disable KVM support
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q
$ qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio
open /dev/kvm: Permission denied
Could not initialize KVM, will disable KVM support
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

Comment 7 Markus Armbruster 2010-12-14 15:02:27 UTC
Comment#6's "upstream" means "upstream QEMU".  There's also qemu-kvm. Turns out that it differs from upstream QEMU exactly the same way as RHEL-6.  What a mess.


Details:

Upstream qemu-kvm, KVM available:
$ ~/work/qemu-kvm/bld-x86/x86_64-softmmu/qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q
$ ~/work/qemu-kvm/bld-x86/x86_64-softmmu/qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q

Upstream qemu-kvm, KVM unavailable:
$ ~/work/qemu-kvm/bld-x86/x86_64-softmmu/qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
open /dev/kvm: Permission denied
Could not initialize KVM, will disable KVM support
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q
$ ~/work/qemu-kvm/bld-x86/x86_64-softmmu/qemu-system-x86_64 -nodefaults -usb -vnc :0 -S -monitor stdio
open /dev/kvm: Permission denied
Could not initialize KVM, will disable KVM support
QEMU 0.13.50 monitor - type 'help' for more information
(qemu) info kvm 
kvm support: disabled
(qemu) q

Comment 9 Jes Sorensen 2011-01-12 12:24:06 UTC
The problem is that qemu-kvm is expecting KVM to be enabled for default,
and if we start failing if KVM is not available, it means you can only use
qemu-kvm without kvm if you explicitly specify --disable-kvm

There are two ways to handle this:
1) Fail qemu-kvm if KVM is not available, independent on whether --enable-kvm
   is specified.
2) Add an additional internal flag to track whether --enable-kvm was specified
   on the command line, and fail if it was, when KVM is not enabled.

IMHO 2) is really ugly, but I doubt 1) would fly with qemu-kvm maintainers.

Jes

Comment 10 Markus Armbruster 2011-01-14 13:29:59 UTC
Fixed in upstream qemu-kvm commit b724fa4b.

qemu-kvm        |  default  |-enable-kvm|  -no-kvm
----------------+-----------+-----------+-----------
KVM available   |  enabled* |  enabled  |  disabled
KVM unavailable | disabled  |    fail+  |  disabled

* still differs from upstream qemu
+ changed from disabled

Comment 13 Markus Armbruster 2011-02-21 16:14:09 UTC
*** Bug 661767 has been marked as a duplicate of this bug. ***

Comment 16 Chao Yang 2011-02-28 08:33:02 UTC
Can reproduce on following package:
$ rpm -qa|grep qemu
qemu-kvm-0.12.1.2-2.147.el6.x86_64

qemu-kvm        |  default  |-enable-kvm|  -no-kvm
----------------+-----------+-----------+-----------
KVM available   |  enabled  |  enabled  |  disabled
KVM unavailable | disabled  |  disabled |  disabled



Verified on package:
$ rpm -qa|grep qemu
qemu-kvm-0.12.1.2-2.148.el6.x86_64

Steps:
1. launch qemu-kvm with kvm available
$ ls -l /dev/kvm
crw-rw-rw-+ 1 root kvm 10, 232 Feb 22 16:23 /dev/kvm
$ /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q

***Actual Result***:
with -enable-kvm, kvm enabled

$ /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio 
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) q

***Actual Result***
by default, kvm enabled

$ /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio -no-kvm
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

***Actual Result***
with -no-kvm, kvm disabled

2. launch qemu-kvm with kvm unavailable.
$ ls -l /dev/kvm
crw-------+ 1 root kvm 10, 232 Feb 22 16:23 /dev/kvm
$ /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
open /dev/kvm: Permission denied
failed to initialize KVM: Operation not permitted

***Actual Result***
with -enable-kvm, failed

$ /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio 
open /dev/kvm: Permission denied
Could not initialize KVM, will disable KVM support
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

***Actual Result***
by default, kvm disabled

$ /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio -no-kvm
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

***Actual Result***
with -no-kvm, kvm disabled

Comment 19 Chao Yang 2011-03-02 04:48:48 UTC
Renamed /dev/kvm, and verify again.
# /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio -enable-kvm
open /dev/kvm: No such file or directory
failed to initialize KVM: Operation not permitted

***Actual Result***:
with -enable-kvm, failed.

# /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio 
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

***Actual Result***:
by default, kvm disabled

# /usr/libexec/qemu-kvm -nodefaults -usb -vnc :0 -S -monitor stdio -no-kvm
Using CPU model "cpu64-rhel6"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info kvm
kvm support: disabled
(qemu) q

***Actual Result***:
with -no-kvm, kvm disabled

So, I think this issue got fixed.

Comment 20 Miya Chen 2011-03-17 10:02:40 UTC
move to verified based on comment#16 and comment#19

Comment 21 errata-xmlrpc 2011-05-19 11:32:01 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

Comment 22 errata-xmlrpc 2011-05-19 13:00:39 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html


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