---
deprecated: true
excerpt_separator: <br/>
category: technology
layout: post
title: The Case of the Odd NetworkManager Behavior
date: '2009-04-27T08:31:00.000-04:00'
author: Anna Wiggins
tags:
- fedora
- linux
- Technology
modified_time: '2013-10-22T11:19:50.674-04:00'
blogger_id: tag:blogger.com,1999:blog-4209116010564764361.post-2909430100113595812
blogger_orig_url: http://www.stringofbits.net/2009/04/the-case-of-odd-networkmanager-behavior.html
---

I recently purchased an <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16834220504">Eee PC 1000HE</a>.  This is a very nice machine, and aside from one <a href="https://bugzilla.redhat.com/show_bug.cgi?id=489216">weird bug</a>, Linux support is great.  However, I've run into a very annoying problem with Fedora 10, and at the root of that problem is gnome-keyring-manager.<br/><br/><a name='more'></a><br/><h3>Misconfiguration Most Foul</h3><br/>We begin our tale with NetworkManager.  Since I connect to several wireless networks and a VPN, NetworkManager is a very useful thing to have working.  Its initial setup was great; I loaded nm-applet in my fluxbox startup, it prompted me for a default keyring password, and we were off.<br/><br/>However, on my next boot I was not prompted for my keyring password; I had to enter my WEP key manually.  After some exploration, I learned that gnome-keyring-daemon needs to be running.  The paradox is that it WAS running.<br/><h3>A Red Herring</h3><br/>I found some rather old advice thas suggested I run gnome-keyring-daemon manually from ~/.fluxbox/startup, but this didn't work; gnome-keyring-daemon starts automatically in Fedora 10, thanks to pam_gnome_keyring.so.  I now had two copies of the daemon now running, neither of which worked.<br/><br/>What I eventually discovered was this: if I kill the automatically-started gnome-keyring-daemon (or remove auto_start from the pam_gnome_keyring options in /etc/pam.d/kdm), then start it manually with different options, it works every time.  So, instead of:<br/><br/><code>gnome-keyring-daemon -d --login</code><br/><br/>which is the automatically provided command, I ran:<br/><br/><code>gnome-keyring-daemon -f -c keyring</code><br/><br/>from my fluxbox startup file.  This worked, but turned out to be unnecessary.<br/><h3>An Anwser</h3><br/>My next discovery:  If I disable the daemon's automatic starting (once again by taking the auto_start option out of /etc/pam.d/kdm) and remove my custom invocation from the startup file, it still starts automatically, but with different options than the auto_start version!  In fact, it starts with the options work.<br/><br/>It turns out that nm-applet and gnome-screensaver both automatically start gnome-keyring-daemon if it isn't running.  Since nm-applet runs first, it starts up the daemon, and passes it a completely different set of options than the pam-invoked version.  Thanks for the consistency, gnome!<br/><h3>A Problem</h3><br/>Starting gnome-keyring-daemon manually or allowing nm-applet to start it still poses a problem: the daemon doesn't die when I log out!  This means that, as I log in and out several times, useless instances of the daemon end up sitting around doing nothing.  Since the apps that talk to the daemon use $GNOME_KEYRING_SOCKET to do so, everything keeps working; but it's cruft I'd rather not have.<br/><h3>Elementary</h3><br/>After following this circuitous path, I finally stumbled into the answer: it's a <a href="https://bugzilla.redhat.com/show_bug.cgi?id=453880">known bug</a>.  It is actually related to the lack of a proper $DISPLAY getting set for gnome-keyring-daemon; it isn't related to the passed in options at all.<br/><br/>At this point, I'm forced to fall back on a hack.  I've added the following to my ~/.fluxbox/startup, above the gnome-related apps:<br/><br/><code>killall gnome-keyring-daemon</code><br/><br/>I've also removed the auto_start option from /etc/pam.d/kdm.  Unfortunately, not launching the daemon with pam means that I can't take advantage of the single sign-on feature provided by pam_gnome_keyring.  But until the bug is fixed, I guess this will have to be good enough.<br/><br/>(As for why I don't use gdm, see <a href="http://stringofbits.net/2009/01/5-things-i-hate-about-fedora-10/">this post</a>)<br/><br/><h3>Update: a command explained</h3><br/><br/>If you look at the --help output for gnome-keyring-daemon (or, if you've applied my hack below, gnome-keyring-daemon-bin), you'll see this output:<br/><br/><code>Usage:<br/>  gnome-keyring-daemon [OPTION...] - The Gnome Keyring Daemon<br/><br/>Help Options:<br/>  -?, --help                              Show help options<br/><br/>Application Options:<br/>  -f, --foreground                        Run in the foreground<br/>  -d, --daemonize                         Run as a daemon<br/>  -l, --login                             Use login password from stdin<br/>  -c, --components=ssh,keyring,pkcs11     The components to run</code><br/><br/>Anyone acquainted with Linux will understand the first two options, -f and -d, pretty intuitively.  You'll note in my post above that my 'working' option set included -f; this is because -f prints to standard out, allowing us to capture the GNOME_KEYRING_SOCKET and GNOME_KEYRING_PID variables that the daemon spits out.  However, when run in -d, these variable seem to get set correctly anyway.  Further, the -c option I used in my quest seems superfluous; the daemon defaults to using the keyring component.  I wanted to explain this since it wasn't clear in the original post exactly why I bounced between options.  At the time, I was grasping at straws, and assigned a simple correlation (the different command-line options in use) to a causation (the daemon that started automatically, with the different options, failed to work correctly).<br/><br/>The option that had me baffled, though, was --login.  The information in the help output is cryptic, but I finally worked out its purpose; it allows single sign-on.  pam_gnome_keyring passes your login password to gnome-keyring-daemon, which uses it to unlock a special keyring called the login keyring.  This keyring can then be used to store the passwords to your other keyrings, so that when you log in, everything unlocks automatically.  Your system login doubles as your keyring authentication.<br/><br/><h4>Further Update: Eureka! (or: building a better hack)</h4><br/>Based on a comment in the bugzilla entry for this problem, I have crafted a better (if more system-intrusive) hack.  I simply perform the following:<br/><br/><code>mv /usr/bin/gnome-keyring-daemon /usr/bin/gnome-keyring-daemon-bin<br/>touch /usr/bin/gnome-keyring-daemon<br/>chmod 755 /usr/bin/gnome-keyring-daemon<br/>cat &gt; /usr/bin/gnome-keyring-daemon &lt;&lt; EOF<br/>#!/bin/sh<br/>DISPLAY=&quot;:0.0&quot; /usr/bin/gnome-keyring-daemon-bin &quot;\$@&quot;<br/>EOF</code><br/><br/>This hack creates a wrapper script that sets the $DISPLAY variable before running the keyring daemon.  Until this kdm bug is worked out, this hack performs beautifully.