KVM 管理工具无法连接 libvirt qemu:///system 报错
后知后觉 暂无评论

在使用 virt-manager 时报错 Unable to connect to libvirt qemu:///- system

具体报错信息如下

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

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 1185, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1167, 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

查看文件权限

kane@kane-E500:/var/run/libvirt$ ll
total 0
drwxr-xr-x 2 root root     40 Dec 24 14:20 hostdevmgr/
drwx------ 2 root root     60 Dec 24 14:20 interface/
srw------- 1 root root      0 Dec 24 14:20 libvirt-admin-sock=
srw-rw---- 1 root libvirt   0 Dec 24 14:20 libvirt-sock=
srw-rw-rw- 1 root root      0 Dec 24 14:20 libvirt-sock-ro=
drwxr-xr-x 2 root root    140 Dec 24 14:20 network/
drwx------ 2 root root     60 Dec 24 14:20 nodedev/
drwx------ 2 root root     60 Dec 24 14:20 nwfilter/
drwx------ 2 root root     40 Dec 24 14:20 nwfilter-binding/
drwxr-xr-x 3 root root    100 Dec 24 14:20 qemu/
drwx------ 2 root root     60 Dec 24 14:20 secrets/
drwxr-xr-x 2 root root     80 Dec 24 14:20 storage/
srw------- 1 root root      0 Dec 24 14:20 virtlockd-admin-sock=
srw------- 1 root root      0 Dec 24 14:20 virtlockd-sock=
srw------- 1 root root      0 Dec 24 14:20 virtlogd-admin-sock=
srw------- 1 root root      0 Dec 24 14:20 virtlogd-sock=

将文件 libvirt-sock 权限改为 666 即可

sudo chmod 666 /var/run/libvirt/libvirt-sock

重启 virt manager 即可。


附录

参考链接

本文撰写于一年前,如出现图片失效或有任何问题,请在下方留言。博主看到后将及时修正,谢谢!
禁用 / 当前已拒绝评论,仅可查看「历史评论」。