Issue with Virt-manager

I installed virt-manager and I am unable to make it work.

I have tried some of the previously posted answers with no success. I've verified that:

  • The libvirt-bin package is installed
  • The libvirtd daemon has been started
  • I am a member of the libvirtd group
  • libvirt URI is: qemu:///system

This is the error I get when trying to run virt-manager:

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 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission     denied

Solution 1:

You may have to log out and log back in.

Assuming /etc/libvirt/libvirtd.conf has:

# Set the UNIX domain socket group ownership. This can be used to
# allow a 'trusted' set of users access to management capabilities
# without becoming root.
#
# This is restricted to 'root' by default.
unix_sock_group = "libvirtd"

# Set the UNIX socket permissions for the R/O socket. This is used
# for monitoring VM status only
#
# Default allows any user. If setting group ownership, you may want to
# restrict this too.
unix_sock_ro_perms = "0777"

# Set the UNIX socket permissions for the R/W socket. This is used
# for full management of VMs
#
# Default allows only root. If PolicyKit is enabled on the socket,
# the default will change to allow everyone (eg, 0777)
#
# If not using PolicyKit and setting group ownership for access
# control, then you may want to relax this too.
unix_sock_rw_perms = "0770"

It should work if your user is a member of the libvirtd group.

Check if your user is supposed to be in the group, example user vagrant:

$ cat /etc/group|grep $USER
vagrant:x:1000:
libvirtd:x:116:ubuntu,vagrant

If your user is not in the group, you'll need to add it:

$ sudo usermod -a -G libvirtd $USER

If your user was already in the group in /etc/group, then check the output of groups:

$ groups
vagrant libvirtd

If you don't see libvirtd, you'll need to log out and log back in.

Solution 2:

I had the same issue. Try this guide it's works for me. Don't forget relogin after add user to group 'libvirtd'