Could Not Access KVM Kernel Module: Permission Denied

I’m starting to work on replacing my CentOS 6 KVM server with a new CentOS 7 server. As much as I dislike CentOS 7, I’m trying to give it an honest try and make an honest attempt at learning. Working in the IT profession requires you to constantly adapt to change and learn new tech stacks. The problem I have is in CentOS 6 it was so easy to install KVM and set up a VM. CentOS 7 has been issue after issue. The most recent being the “Could Not Access KVM Kernel Module: Permission Denied” error.

error

I started with a bare installation of CentOS version 7.4.1708. I reinstalled the OS several times before I was able to finally find the cause of the problem. Apparently in CentOS 7, when you install libvirt, it doesn’t grant the correct permissions on /dev/kvm. I checked my CentOS 6 machines running KVM and what do you know, they’re all set correctly. Go figure.

By default, the /dev/kvm is owned by root:root with permissions 600.

Changing the owner to root:kvm and permissions to 660 will resolve the problem.

Don’t forget to restart the libvirt service and remember, this is done with systemctl rather than the service command. Doh.

 

Leave a Reply