Wednesday, October 3, 2012

Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

This error will occurs if the user do not have permissions to connect to virt-manager or virtviewer tools.
To resolve this issue execute below commands

Step1: Conform if your root user account have permissions or not

virsh -c qemu:///system list

if you dont see any issue from root user, try to execute the same command with normal user where you want to start virt-viewer or virt-manager. If you see any issues such as "failed to connect socket" issue with normal user then he should be member of libvirtd group first. Follow below procedure.

Step2: Add the user account as secondary group member to libvirtd group

Note: Before doing anything keep in mind that this user may be member of many other already existing groups so add this user account to them as well.

usermod -G libvirtd,group2,group3 -a username

Step3: Now we have to change the settings in /etc/libvirt/libvirtd.conf. Open /etc/libvirt/libvirtd.conf as root and search for following lines and remove the comments for that lines.
vi /etc/libvirt/libvirtd.conf
Now remove comments from the lines which contains below info.

unix_sock_group = "libvirtd"
unix_sock_ro_perms = "0777"
 unix_sock_rw_perms = "0770"

With the first line we are mentioning that libvirtd group is allowed to very one and r/o and r/w permissions for all the users who belongs to this group.

Hope this helps some one.


Post a Comment