virt-manager 无法连接到 libvirt

virt-manager 无法连接到 libvirt

在此处输入图片描述

我正在运行 32 位 Ubuntu 12.04.2。

如果我启动,错误不会显示gksudo virt-manager

  • libvirt-bin已安装。
  • 我不知道如何检查守护进程。
  • 我是 的会员libvirtd

输出ps ax | grep libvirt

9225 ? Sl 0:04 /usr/sbin/libvirtd -d
9302 ? S 0:00 /usr/sbin/dnsmasq -u libvirt-dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file= --except-interface lo --listen-address 192.168.122.1 --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases --dhcp-lease-max=253 --dhcp-no-override`

输出ls -l /var/run/libvirt/libvirt-sock

srwxrwx--- 1 root libvirtd 0 设置 13 15:04 /var/run/libvirt/libvirt-sock

输出getent group libvirtd

 libvirtd:x:130:OTHERUSER,MYUSER

详细错误信息

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

答案1

重新启动安装的系统virt-manager解决了该问题。

答案2

安装 KVM 后,运行此命令,该错误就不会再出现。

sudo virt-manager

答案3

重新启动/注销的替代方法是从终端运行以下命令:

newgrp libvirt
virt-manager

对于在 之后在同一 shell 中启动的进程,该newgrp命令允许用户无需注销即可加入组。当然,这只有当 libvirt 安装程序将您放入 libvirt 组时才有效,您可以使用以下命令进行检查:libvirtnewgrp

getent group libvirt

答案4

必须将登录用户添加到libvirt用户组

sudo usermod -a -G libvirt $USER

相关内容