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?

  • 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. – nwildner Jun 28 '17 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 '17 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 – nwildner Jun 28 '17 at 12:42
  • Is 65-kvm.rules a one liner? – mahmood Jun 28 '17 at 13:09
  • yup. It will set the to allow reading from owner (root) and group(kvm) to that device – nwildner Jun 28 '17 at 13:16
up vote 1 down vote accepted

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.