python-keyring timeout on import if started with sudo

Bug #1181344 reported by Germar
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNOME Keyring
Fix Released
Medium
Salt
New
Undecided
Unassigned
gnome-keyring (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

steps to reproduce:
$ sudo python
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyring

this will take ~25 seconds only on Xubuntu. If you do this on Ubuntu or Kubuntu (all version 12.10) it will return immediately. Also if you import keyring with normal user on Xubuntu it will return immediately.

It is caused by a dbus call in /usr/share/pyshared/keyring/backend.py function SecretServiceKeyring.supported:
$ sudo python
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
>>> bus = dbus.SessionBus()
>>> bus.get_object('org.freedesktop.secrets', '/org/freedesktop/secrets')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Tags: xubuntu
Revision history for this message
Germar (germar) wrote :
Revision history for this message
Germar (germar) wrote :
description: updated
Germar (germar)
tags: added: xubuntu
Revision history for this message
Germar (germar) wrote :

It's the same on Arch Linux (was reported by orschiro in https://aur.archlinux.org/packages/backintime/?comments=all and confirmed by others):

http://pastebin.com/eS7kTHm5

no longer affects: xubuntu-meta (Ubuntu)
Changed in python-secretstorage:
status: New → Confirmed
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

As mentioned in the bug description, this bug occures even when using D-Bus directly, without SecretStorage or python-keyring.

So this most probably indicates a bug in your Secret Service server, which is probably gnome-keyring.

Changed in python-secretstorage:
status: Confirmed → Invalid
affects: python-keyring (Ubuntu) → gnome-keyring (Ubuntu)
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Can you please:

1) Check if the file /usr/share/dbus-1/services/org.freedesktop.secrets.service exists and paste its contents somewhere?
2) Install seahorse and check if it works (i.e. you can see a list of your secrets).

Changed in gnome-keyring (Ubuntu):
status: New → Incomplete
Revision history for this message
Germar (germar) wrote :

I agree with you that this is a gnome-keyring bug (didn't know how dbus works when I reported this)

$ cat /usr/share/dbus-1/services/org.freedesktop.secrets.service
[D-BUS Service]
Name=org.freedesktop.secrets
Exec=/usr/bin/gnome-keyring-daemon --start --foreground --components=secrets

This file is the same on all systems I tested. If I run the Exec command with sudo the faulty systems report this:

$ sudo /usr/bin/gnome-keyring-daemon --start --foreground --components=secrets

** (gnome-keyring-daemon:30328): WARNING **: couldn't create socket directory: No such file or directory

** (gnome-keyring-daemon:30328): WARNING **: couldn't bind to control socket: /root/.cache/keyring-9D34R9/control: No such file or directory

I created 'sudo mkdir /root/.cache' and voila no more timeout and no more dbus exceptions :D

So the fix would be in gnome-keyring-daemon to create '$HOME/.cache' if it isn't available.

Changed in gnome-keyring (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Thanks for finding the issue. Can you please report this upstream (https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-keyring)?

Revision history for this message
Germar (germar) wrote :

Done in https://bugzilla.gnome.org/show_bug.cgi?id=711810
Thanks for your support!

Changed in gnome-keyring (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
Changed in gnome-keyring:
importance: Unknown → Medium
status: Unknown → New
Changed in gnome-keyring:
status: New → Confirmed
no longer affects: python-secretstorage
Changed in gnome-keyring:
status: Confirmed → Fix Released
Changed in gnome-keyring (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.