Bug 192461 - gdm no longer honors -nodaemon
gdm no longer honors -nodaemon
Product: Fedora
Classification: Fedora
Component: gdm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ray Strode [halfline]
Mike McLean
: 192464 193284 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2006-05-19 15:58 EDT by Chris Ball
Modified: 2007-11-30 17:11 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-05-24 14:36:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
strace (3.88 MB, text/plain)
2006-05-19 15:58 EDT, Chris Ball
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Desktop 342831 None None None Never

  None (edit)
Description Chris Ball 2006-05-19 15:58:09 EDT
Description of problem:
prefdm is chewing CPU after an upgrade to today's (20050519) Rawhide.

I did update yesterday and this issue wasn't present, so I suspect one of the
packages in today's update.  gdm was updated, but initscripts wasn't.  

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

unity:cjb~ % rpm -q initscripts
unity:cjb~ % rpm -q gdm

How reproducible:

Always, on reboot.

Steps to Reproduce:
1. Log in to gnome via GDM.

Additional info:

I'll attach an strace of a couple of seconds of prefdm time.  /usr/sbin/gdm
-nodaemon is spawned as often as possible, even though it's already running.

I'm also seeing the below on logging in to the tty.  It's also new either today
or recently.
/etc/profile.d/kde.sh:4: = not found

The top of kde.sh is:

# When/if using prelinking, avoids (some) use of kdeinit
if [ -f /etc/sysconfig/prelink ] ; then
   source /etc/sysconfig/prelink
   if [ "$PRELINKING" == yes ] ; then
Comment 1 Chris Ball 2006-05-19 15:58:11 EDT
Created attachment 129623 [details]
Comment 2 Chris Ball 2006-05-19 16:01:37 EDT
Speaking of which, shouldn't that == above be a =?
Comment 3 Bill Nottingham 2006-05-19 16:11:27 EDT
So, the question is, how did prefdm get started twice?

Basically, it execs gdm, which fails (as it's already running), so it restarts,
so it execs gdm...

Comment 4 Valdis Kletnieks 2006-05-23 11:35:01 EDT
Let's look at this code:

# Fallbacks, in order
gdm "$@" >/dev/null 2>&1
if [ $? -ne 127 ]; then
        exec $0 "$@"
        exit $?

Now what happens if /usr/sbin/gdm manages to leave with a return code of 0?
Yes, that's right, it will exec prefdm again... Whoops.

Maybe that should be 'exec gdm $@' instead? (and similarly for the other places?
Comment 5 Bill Nottingham 2006-05-23 11:43:21 EDT
Look at /etc/inittab - prefdm is 'once',not 'respawn'. So it's written this way
so that gdm (or whatever) will respawn.
Comment 6 Michal Jaegermann 2006-05-23 12:01:16 EDT
Re comment #4.  In /etc/X11/prefdm a little bit above quoted code there
is that:

if [ -n "$preferred" ]; then
        $preferred "$@" >/dev/null 2>&1
        if [ $? -ne 127 ]; then
                exec $0 "$@"
                exit $?

so if $preferred is not blank we are doing the same crazy re-execs
a bit earlier.  Makes /var/log/messages quite boring. :-)

Hm, 'once' in inittab does not seem to help.
Comment 7 Valdis Kletnieks 2006-05-23 12:05:16 EDT
Once versus respawn isn't the point - the problem is that init spawns prefdm
once, then prefdm spawns gdm. It then botches the return code check, and as a
result respawns gdm and then exec's itself.  The exec'ed copy (still on the same
PID, as it hasn't forked, so it's still the some "once" to init) then tries to
spawn gdm, botches the return code check, and execs itself. Lather, rinse, repeat.

It's quite possible for '$preferred' to not be set - unless there's a settig in
/etc/sysconfig/desktop for $DISPLAYMANAGER, it won't be set.  At least in mine,
there was a setting for $DESKTOP, but not $DISPLAYMANAGER.
Comment 8 Bill Nottingham 2006-05-23 15:08:35 EDT
I'm still confused as to what you mean.

It runs the display manager once, and waits for it to exit.

When the display manager exits, it respawns itself, so the display manager will
then get run again. This behavior seems correct to me.

With the behavior you're suggesting, if gdm exits zero during normal use it will
never respawn.
Comment 9 Valdis Kletnieks 2006-05-23 15:21:57 EDT
Looking at gdm 2.15.3 source, in daemon/gdm.c, function gdm_daemonify certainly
looks like it's doing the usual fork-to-detach - and the parent is going to exit
very soon - at which point prefdm's wait() will be fulfilled.

Quick test, which I can't try right this instant - does changing the invocation
to 'gdm -nodaemon' stop the prefdm looping? If so, that's the problem.
Comment 10 Bill Nottingham 2006-05-23 15:28:30 EDT
But, -nodaemon should be inherited from the prefdm args, unless I'm misreading.

Comment 11 Chris Ball 2006-05-23 15:39:01 EDT
It is indeed being inherited:

[pid  1283] execve("/usr/sbin/gdm-binary", ["/usr/sbin/gdm-binary",
"-nodaemon"], [/* 27 vars */]) = 0
Comment 12 Bill Nottingham 2006-05-23 15:47:32 EDT
We discussed this a bit on IRC - gdm 2.15 moves to GOption based parsing, and
lost the support for the -nodaemon commandline option (it does take --nodaemon).
Comment 13 Bill Nottingham 2006-05-23 15:48:32 EDT
*** Bug 192464 has been marked as a duplicate of this bug. ***
Comment 14 Valdis Kletnieks 2006-05-23 15:51:20 EDT
That's a simple one-liner fix in /etc/inittab then.
Comment 15 Ray Strode [halfline] 2006-05-23 16:19:09 EDT
I added code to gdm to make it recognize -nodaemon.  Can someone try the updated
package in tomorrow's compose and tell me if it fixes the problem?
Comment 16 Chris Ball 2006-05-24 14:15:57 EDT
Tested today's package, and fixed.  Many thanks.
Comment 17 Ray Strode [halfline] 2006-05-24 14:36:11 EDT
great, thanks. closing.
Comment 18 Bill Nottingham 2006-05-26 16:24:09 EDT
*** Bug 193284 has been marked as a duplicate of this bug. ***

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