2

I am running Gentoo Linux for AMD64 using kernel 3.12.21 AMD64 on an HP Pavilion Touch 14-N009LA with an AMD A8-4555M CPU. My desktop environment is KDE 4.12.5. I have installed KVM, libvirtd, polkit and virt-manager. However, when I open virt-manager, I get the following error and am unable to do anything with virtual machines:

Unable to connect to libvirt.

authentication failed: polkit: Error getting authority: Error initializing authority: Could not connect: No such file or directory

Detail output is here:

Unable to connect to libvirt.

authentication failed: polkit: Error getting authority: Error initializing authority: Could not connect: No such file or directory

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1002, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 984, in _try_open
    flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 105, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: authentication failed: polkit: Error getting authority: Error initializing authority: Could not connect: No such file or directory

Googling around I found the following tips to try and make it work, and here's how they went:

  • Making sure that a polkit authentication agent is running. I checked and it is indeed running:
black@rockshooter ~ $ ps -ef | grep polkit
black     5039     1  0 04:31 ?        00:00:00 /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
  • Creating a group called kvm, adding my user ID to it, and creating a polkit rule to authenticate users of group kvm who wish to manage VMs. I did it like this and it didn't work:
root@rockshooter /etc/polkit-1/rules.d # cat 50-default.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.libvirt.unix.manage" &&
        subject.isInGroup("kvm")) {
            return polkit.Result.YES;
    }
});
root@rockshooter /etc/polkit-1/rules.d # grep kvm /etc/group
kvm:x:78:qemu,black
  • Connecting to the hypervisor from the command line (using virsh). I get the exact same error.
black@rockshooter ~ $ virsh --connect qemu:///system
error: failed to connect to the hypervisor
error: authentication failed: polkit: Error getting authority: Error initializing authority: Could not connect: No such file or directory
6
  • Maybe your system policy prevents management of local virtualized systems. Did you try with su?
    – Peque
    Aug 14, 2014 at 9:05
  • I am running virt-manager as root actually.
    – RAKK
    Aug 14, 2014 at 12:01
  • Ok, as I saw $ virsh --connect qemu:///system with $ and not # thought maybe that could be the problem. ;-)
    – Peque
    Aug 14, 2014 at 14:47
  • Oh yeah... yeah, it's just that, well, it's been a while since I got to this problem and forgot a few details... OK so there it goes: I'm having to run virt-manager as root, which is something I'm very much not enthusiastic about. I would like to run it as a regular user. But I can't. Hence why I'm not using the root prompt. Don't want to have stuff running unrestricted on my machine :3
    – RAKK
    Aug 14, 2014 at 15:01
  • Well, that would be another question then: how to run it without root permissions. Opening a user-space application with root privileges is not a good idea, I agree, and that's why a "normal" user (my granny) would never need to run anything as root, but virtualization is for administrators and not users. It is meant to be run as root. So my suggestion is: use su. There's nothing wrong with that. ;-)
    – Peque
    Aug 14, 2014 at 15:40

1 Answer 1

2
+50

Your system policy prevents management of local virtualized systems. You should use su to run virt-manager, virsh --connect qemu:///system and any other virtualization-related task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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