xfce4-session fails to include variables into environment output by gnome-keyring-daemon --start

Bug #564831 reported by Lars Volker
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Xfce4 Session
Unknown
Unknown
xfce4-session (Debian)
Fix Released
Unknown
xfce4-session (Ubuntu)
Fix Released
Medium
Lionel Le Folgoc

Bug Description

Binary package hint: xfce4-session

I'd like to use the ssh-agent functionality provided by gnome-keyring-daemon, but i can't get it to work for the following reason.

During login, the keyring-daemon is started via dbus, right? If it is started by dbus, then that might as well be the source of my trouble: http://live.gnome.org/GnomeKeyring/RunningDaemon
It says, that launching gnome-keyring-daemon from dbus only provides "basic password operations" without further functionality like ssh-agent. Bug #357346 sounds, as if xfce4-session indeed relies on dbus to start the keyring-daemon.

However starting the daemon consists of two steps, the second of which is running "gnome-keyring-daemon --start" and including the printed information into the environment. In /etc/xdg/autostart there are three file each of which controls a single feature of gnome-keyring-daemon. Alltogether they are started by xfce4-session, but their printed variables are not included into the env, as they are not surrounded by eval ``. Therefore, the variable definitions show up in ~/.xsession-errors.

I think i read some time ago, that gnome-keyring-daemon was capable of registering the environment-variables in the session via dbus. However this also doesn't happen, which means, SSH_AUTH_SOCK does not get set.

However, in all this mess, GNOME_KEYRING_PID gets set. If i run ' eval `gnome-keyring-daemon --start` ' in .xprofile, i break the password storage, which indicates, that this seems to happen before dbus (but after pam of course).

If i run
eval `gnome-keyring-daemon --start
export GNOME_KEYRING_CONTROL SSH_AUTH_SOCK
then the ssh-agent is working in this shell, but of course nowhere else.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: xfce4-session 4.6.1-1ubuntu3
ProcVersionSignature: Ubuntu 2.6.32-21.31-generic 2.6.32.11+drm33.2
Uname: Linux 2.6.32-21-generic x86_64
NonfreeKernelModules: fglrx
Architecture: amd64
Date: Fri Apr 16 18:35:39 2010
InstallationMedia: Xubuntu 10.04 "Lucid Lynx" - Alpha amd64 (20100415)
ProcEnviron:
 PATH=(custom, user)
 LANG=de_DE.utf8
 SHELL=/bin/bash
SourcePackage: xfce4-session

Revision history for this message
Lars Volker (lv) wrote :
Revision history for this message
Lars Volker (lv) wrote :

I found out the following:

- gnome-keyring-daemon --login gets started by gdm right after login.
- gdm then starts xfce, which calls gnome-keyring-daemon --start -c {ssh...}
- in /var/log/auth.log, the following error appears:

Apr 17 01:50:20 feorag gnome-keyring-daemon[7103]: couldn't set environment variable in session: The name org.gnome.SessionManager was not provided by any .service files

Indeed, I don't find any files named like that in /usr/share/dbus-1.

Also I found this thread: http://bugs.archlinux.org/task/13986
Maybe it is related.

Revision history for this message
Charlie Kravetz (cjkgeek) wrote :

Thanks for reporting this bug and any supporting documentation. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here. Thanks for taking the time to make Ubuntu better!

Changed in xfce4-session (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Forest (foresto) wrote :

I just posted more info about this very problem in bug 357346. It looks like upstream xfce4-session did run gnome-keyring-daemon --start and capture/export the environment variables, but an ubuntu-specific patch disabled that behavior in a misguided attempt to fix another problem. The patch is called xubuntu_gnome-keyring-daemon-compat.patch

Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Thanks for your work. The interesting comments are https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/357346/comments/5 and https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/357346/comments/6

If you're willing to try, I can provide a deb package without the patch applied to see if it improves the situation (or you can try on your own if you prefer).

Revision history for this message
Noel J. Bergman (noeljb) wrote :

I am experiencing the same thing with Gnome.

Revision history for this message
Forest (foresto) wrote :

Okay, I removed xubuntu_gnome-keyring-daemon-compat.patch, rebuilt the package, and gave it a try. That brought back the .xsession-errors message that was reported in bug 357346:

Failed to run gnome-keyring-daemon: Failed to start child process « gnome-keyring-daemon » (No such file or directory)

Looking a bit closer at the source code and Gtk docs, I saw that gnome_keyring_daemon_startup() was being called without an absolute path to the executable and without the G_SPAWN_SEARCH_PATH flag. That explains the error message above. I made a patch to take care of it, which I will attach here as 10_spawn-gnome-keyring-daemon-with-path.patch.

Testing my newly patched build, I saw that gnome-keyring-daemon was being launched, but without the --start option and without its printed environment variables getting exported. Another look at the source revealed that gnome_keyring_daemon_startup() was only attempting to capture and export the GNOME_KEYRING_PID variable, and not even looking for it intelligently. I made another patch, this one called 11_export-gnome-keyring-daemon-variables.patch.

With both my new patches applied, gnome-keyring-daemon finally seems to work as it should on xubuntu. It functions as both a secret store and an ssh agent. It works with GDM auto-login and with manual login. It can be found by ssh (using environment variables) and by programs like empathy and seahorse (using libgnome-keyring0 and dbus).

I think my patches might be applicable upstream. I'll have to take a look at the current xfce source code to see if these problems still exist there. In the mean time, anyone want to review and/or test my patches?

Revision history for this message
Forest (foresto) wrote :

I have uploaded my patched version of xfce4-session to my PPA. It should be built soon.

https://launchpad.net/~foresto/+archive/ppa/+packages

Revision history for this message
Forest (foresto) wrote :
Revision history for this message
Forest (foresto) wrote :
Revision history for this message
Forest (foresto) wrote :

Note:

When I tested my patched xfce4-session, I had already disabled the gnome-keyring-daemon autostart .desktop files that were inherited from GNOME. These will launch the daemon, but they won't capture the environment variables (and therefore should probably not be enabled for Xfce sessions). They might interfere with the correct launching of the daemon by xfce4-session, and/or cause extra copies of the daemon to be run. They live in /etc/xdg/autostart/. You can disable them in your own Xfce sessions using the GUI:

Applications -> Settings -> Xfce 4 Settings Manager -> Session and Startup -> Application Autostart

Uncheck these three entries:

Certificate and Key Storage (GNOME Keyring: PKCS#11 Component)
SSH Key Agent (GNOME Keyring: SSH Agent)
Secret Storage Service (GNOME Keyring: Secret Service)

Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Okay, sorry for the delay, I had finally a chance to test that, and it seems to work fine, I think I'm going to include it into maverick (and it should be included in debian as well).

Changed in xfce4-session (Ubuntu):
assignee: nobody → Lionel Le Folgoc (mrpouit)
status: Triaged → In Progress
Revision history for this message
Forest (foresto) wrote :

You might want to use Luca Niccoli's patches (which were derived from mine) instead:

http://bugzilla.xfce.org/show_bug.cgi?id=5912

It's great to see this will be fixed in Maverick!

Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Oops, forgot to close the bug in the changelog…

Changed in xfce4-session (Ubuntu):
status: In Progress → Fix Released
Changed in xfce4-session (Debian):
status: Unknown → 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.