0

One user in the root group and not in the kvm group. He can run qemu-system-x86_64 -enable-kvm with no problem. There is also another user that is not in the root group but he belongs to kvm group. However, he can not use -enable-kvm option! and gets

failed to initialize KVM: Permission denied

What is the fix to fix that?

6
  • Maybe kvm device is not kvm group owned? chown root:kvm /dev/kvm as root and then try to run qemu with your user that is member of kvm group.
    – user34720
    Jun 28, 2017 at 11:07
  • Interesting... I did that. The user then ran qemu-system-x86_64 -enable-lvm with success. Then he closed the opened qemu window and ran the command again. Then he received permission denied!!!
    – mahmood
    Jun 28, 2017 at 12:36
  • 1
    That happened cause the permission could been changed. Maybe if you create a udev rule to get this permission fixed: Create a file named /etc/udev/rules.d/65-kvm.rules with the content KERNEL=="kvm", NAME="%k", GROUP="kvm", MODE="0660" and reload udev rules with the command(as root): udevadm control --reload-rules && udevadm trigger. This will get this permisson permanent fixed for this device file, and you will be able to issue --enable-kvm permanently
    – user34720
    Jun 28, 2017 at 12:42
  • Is 65-kvm.rules a one liner?
    – mahmood
    Jun 28, 2017 at 13:09
  • yup. It will set the to allow reading from owner (root) and group(kvm) to that device
    – user34720
    Jun 28, 2017 at 13:16

1 Answer 1

3

This is caused by a misconfigured permission at /dev/kvm device. This should have a read permisson by the kvm group. Steps to solve:

  1. Create the file /etc/udev/rules.d/65-kvm.rules as root
  2. Put the following line inside this file: KERNEL=="kvm", NAME="%k", GROUP="kvm", MODE="0660"
  3. Reload rules with udevadm control --reload-rules && udevadm trigger
  4. With an user that is member of kvm group, try to execute qemu with the -enable-kvm option.

This was fixed a long time ago on Arch Linux(task 14165, April 2009). Maybe you should also report this issue to your distribution developer list.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .