Skip to main content
Topic: Can't start virtual machines with libvirt/virt-manager (KVM: Permission denied) (Read 114 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Can't start virtual machines with libvirt/virt-manager (KVM: Permission denied)

Every time I try to start my virtual machines (they worked before I changed this system to use Artix) through virt-manager it comes up with this error:

Code: [Select]
Error starting domain: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
2018-07-08T17:10:31.289729Z qemu-system-x86_64: failed to initialize KVM: Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 125, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 82, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1508, in startup
    self._backend.create()
  File "/usr/lib/python2.7/site-packages/libvirt.py", line 1068, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
2018-07-08T17:10:31.289729Z qemu-system-x86_64: failed to initialize KVM: Permission denied

I added my user to the kvm and libvirt groups, to no avail. Adding myself to libvirt did remove the password prompt, so that's at least something. Looks like the problem here is that my user can't access /dev/kvm, since cat /dev/kvm returns with "Permission denied" as well. What is up here?

Also, to even get libvirtd to start I had to comment out the need firewalld line in /etc/init.d/libvirtd or run it with rc-service start libvirtd -D, otherwise it would complain that that service doesn't exist. Pretty sure this has nothing to do with this issue, but it's a bit strange in my opinion.

Re: Can't start virtual machines with libvirt/virt-manager (KVM: Permission denied)

Reply #1
Looks like you are using virtmanager is that GUI frontend? Can you use the terminal to access a virtual machine, are there any error messages when you use the terminal i wonder?

I notice in the AUR there is firewalld-openrc which is for my chosen init, i dont think that firewalld should affect running a virtual machine with qemu/kvm though? I dont use a GUI to access vm's just command line but i did notice that libvirtd wanted or needed firewalld service in passing boot logs.

Here is the openrc init script: https://aur.archlinux.org/packages/firewalld-openrc/

Re: Can't start virtual machines with libvirt/virt-manager (KVM: Permission denied)

Reply #2
So, I've found out that if I manually do chmod g+rw /dev/kvm; chgrp kvm /dev/kvm like it's apparently supposed to be set up (on my system /dev/kvm has the permissions 600 and user/group root:root instead of 660 and root:kvm for some reason) it works perfectly. Is there some openrc service I missed to start that sets this up? How do the permissions look on your system?

I don't think using the terminal to access virtual machines will be any different, since my user can't access KVM at all without the manual permission change.

Re: Can't start virtual machines with libvirt/virt-manager (KVM: Permission denied)

Reply #3
You may not have libvirt-openrc installed?

Im not using virt manager so im not much help sorry, i use the terminal to run my Vm's.

/dev/kvm on my system is 600 and i dont have any issues.

Code: [Select]
[[email protected] ~]$ stat --format '%a' /dev/kvm 
600
Code: [Select]
[[email protected] ~]$ ls -la /dev/kvm 
crw------- 1 root root 10, 232 Jul 13 18:07 /dev/kvm






Re: Can't start virtual machines with libvirt/virt-manager (KVM: Permission denied)

Reply #4
No, I do have it installed. I guess I'll just write a startup script that sets the permissions or whatever