关于kvm使用local socket 连接报错:“authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'”

Setup Local connection

Ihor Dvoretskyi edited this page on 7 Nov 2015 · 2 revisions

This configuration is useful for situations when webvirtmgr is installed on the same host as KVM/libvirt hypervisor.

On webvirtmgr web page click on Connections, then Add Connection and choose the Local Socket. Enter any label name and click Add. Your local connection is added.

Possible issues:

Error after creating local connection in web-interface:

Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
Or in /var/log/supervisor/webvirtmgr.log log file:

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

Both errors are caused by unsufficient permissions to access the libvirt Unix socket.

$ ls -l /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root libvirtd 0 févr. 12 16:03 /var/run/libvirt/libvirt-sock

$ sudo usermod -a -G libvirtd $USER
# Where $USER is a user, that runs a gunicorn instance, which manages the webvirtmgr connections.
To find that user you may run:
$ ps -ef | grep run_gunicorn | awk 'NR==1{ print $1 }'

#上面为原文的回答,而我本地稍有不同,用户组不同
#创建libvirt组,将需要用于管理的非root用户添加到libvirt组。
groupadd libvirt
usermod -a -G libvirt $USER

#获取$USERE
ps -ef | grep run_gunicorn | awk 'NR==1{ print $1 }'

nginx

After adding the user to the group the supervisor service should be restarted:

Ubuntu, Debian

$ sudo service supervisor stop
$ sudo service supervisor start

CentOS, RedHat, Fedora

$ sudo service supervisord stop
$ sudo service supervisord start

来自:

Setup Local connection · retspen/webvirtmgr Wiki:

https://github.com/retspen/webvirtmgr/wiki/Setup-Local-connection

posted @ 2020-05-19 16:00  Chris_huang  阅读(471)  评论(0编辑  收藏  举报
返回项部