Bug 984092

Summary: Unable to connect to libvirt error when outside GNOME
Product: [Fedora] Fedora Reporter: Michal Fojtik <mfojtik>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: berrange, crobinso, fche, hbrock, jforbes, jpokorny, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-12 18:44:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Fojtik 2013-07-12 18:32:00 UTC
Description of problem:

I'm using pekwm window manager and as a user I want to start the virt-manager.
Unfortunatelly I got this error:

Unable to connect to libvirt.

authentication failed: polkit: polkit\56retains_authorization_after_challenge=1
Authorization requires authentication but no agent is available.

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1002, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 984, in _try_open
    flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: authentication failed: polkit: polkit\56retains_authorization_after_challenge=1
Authorization requires authentication but no agent is available.

Everything works find when I'm under gnome or using '$ su -c virt-manager'.
I'm dunno if this is a bug or I need to configure something to allow user to connect to libvirt.

Version-Release number of selected component (if applicable):

0.10.0

How reproducible:

Start alternative WM, like fluxbox or pekwm.
Then run 'virt-manager' as a regular user.

Comment 1 Michal Fojtik 2013-07-12 18:38:28 UTC
One possible workaround is:

auth_unix_rw = "none"


But this sounds pretty insecure ;-)

Comment 2 Cole Robinson 2013-07-12 18:44:37 UTC
This isn't virt-manager's fault. polkit requires that something in your session provide implement a simple dbus API for launching an auth dialog. I know the major DE like KDE, XFCE all provide one. You can do it manually by running /usr/libexec/polkit-gnome-authentication-agent-1 in your session.

Comment 3 Michal Fojtik 2013-07-15 08:54:54 UTC
(In reply to Cole Robinson from comment #2)
> This isn't virt-manager's fault. polkit requires that something in your
> session provide implement a simple dbus API for launching an auth dialog. I
> know the major DE like KDE, XFCE all provide one. You can do it manually by
> running /usr/libexec/polkit-gnome-authentication-agent-1 in your session.

Thanks Cole, that fixed it!

I know this is not a bug, but the error reported pretty much looks like a bug. One think that could be improved here is the error message (something nice, like 'you need to run polkit manually' would be awesome.)

Comment 4 Jan Pokorný [poki] 2014-01-16 18:00:08 UTC
Hit this too (F20/LXDE):

> Unable to connect to libvirt.
> 
> authentication failed: polkit: polkit\56
>   retains_authorization_after_challenge=1
> Authorization requires authentication but no agent is available.
> 
> Libvirt URI is: qemu:///system
> 
> Traceback (most recent call last):
>   File "/usr/share/virt-manager/virtManager/connection.py", line 898,
>   in _open_thread
>     self._backend.open(self._do_creds_password)
>   File "/usr/share/virt-manager/virtinst/connection.py", line 159,
>   in open
>     open_flags)
>   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 102,
>   in openAuth
>     if ret is None:raise libvirtError('virConnectOpenAuth() failed')
> libvirtError: authentication failed: polkit: polkit\56
>   retains_authorization_after_challenge=1
> Authorization requires authentication but no agent is available.

However, double-clicking "localhost (QEMU)" triggered the working
authentication dialog, so no extra steps were needed to workaround
this inconvenience (still sounds like a bug to me, though).

Comment 5 Cole Robinson 2014-01-16 18:41:52 UTC
If it isn't working, the issue is elsewhere, either your desktop's session or some race somewhere. virt-manager/libvirt just request polkit access, it's up to other parts of the stack to register an agent and make sure it starts up correctly.

Comment 6 Frank Ch. Eigler 2014-07-17 14:55:21 UTC
Please note that this can happen if one wishes to run virt-manager
remotely (e.g. via ssh X11 forwarding).  It would be nice if virt-manager
gave a better error indication if it detects the absence of other local
infrastructure.