4

I am using Ubuntu 14.04. I have installed kvm. When I try to open virtual machine, I get this error:

local host not connected

Unable to connect to libvirt.

Verify that:
 - The 'libvirt-bin' package is installed
 - The 'libvirtd' daemon has been started
 - You are member of the 'libvirtd' group

Unable to connect to libvirt.

Verify that:
 - The 'libvirt-bin' package is installed
 - The 'libvirtd' daemon has been started
 - You are member of the 'libvirtd' group

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1027, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1009, in _try_open
    flags)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 105, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
1
  • Have you installed libvirt-bin? (check with apt-cache policy libvirt-bin)? Are you a member of the libvirtd group? (check with groups)? You should also follow the steps described here to install and use KVM.
    – Byte Commander
    Feb 19, 2016 at 7:57

1 Answer 1

3

Step 1 : Install all packages that are needed.

sudo apt-get install qemu virt-manager  

If they already are installed, you get notified.

Step 2 : Add yourself to the libvirt(d) group.

sudo usermod -G libvirt -a <username>  

(this is valid for newer KVM / Ubuntu versions)

sudo usermod -G libvirtd -a <username>  

(this is valid for older KVM / Ubuntu versions)

Replace <username> with your user name.

Step 3 : Reboot your host operating system.

sudo reboot

Now everything should work as expected.

In case you still get the same error again -

open virt-manager with root privileges :

sudo apt-get install gksu  

gksudo virt-manager  

Close virt-manager and restart the host.

sudo reboot  

Finally it should work with user privileges !

3
  • usermod: group 'libvirtd' does not exist in running step 2 after running step 1. I'm trying to follow this tutorial chromeunboxed.com/… and also have "qemu/kvm not connected" on virtual machine manager
    – Justin
    Dec 8, 2020 at 3:26
  • @Justin This thread is about five years old - meanwhile the group has changed because newer versions of KVM have a default group libvirt - so just execute sudo usermod -G libvirt -a <username>. I have updated the answer accordingly. :)
    – cl-netbox
    Dec 8, 2020 at 14:46
  • Thank you. I actually got it working another way, but I appreciate the reply and updating the answer : )
    – Justin
    Dec 9, 2020 at 16:45

You must log in to answer this question.

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