Bug 984092 - Unable to connect to libvirt error when outside GNOME
Unable to connect to libvirt error when outside GNOME
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: virt-manager (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-12 14:32 EDT by Michal Fojtik
Modified: 2014-07-17 10:55 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-12 14:44:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michal Fojtik 2013-07-12 14:32:00 EDT
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 14:38:28 EDT
One possible workaround is:

auth_unix_rw = "none"


But this sounds pretty insecure ;-)
Comment 2 Cole Robinson 2013-07-12 14:44:37 EDT
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 04:54:54 EDT
(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ý 2014-01-16 13:00:08 EST
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 13:41:52 EST
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 10:55:21 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.