LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-02-2006, 09:00 PM   #1
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Question How do login managers start WM sessions?


I'm currently working on fixing a problem with my login to KDE, and it's led me to wondering if there's something wrong with my login setup. Or at least I want to be sure that it's working correctly. So now I need to know something about how it works when you log in graphically.

Reading around, I understand that if you run startx manually from a terminal, it will read your .xinitrc file and launch whatever graphic environment and programs you have set up there. Pretty simple so far. But things get fuzzy for me when it comes to session managers.

I prefer to use gdm myself, and I see that it provides a list of different WM/DE's to choose from. So, you choose the one you want, say KDE, and log in...then what? Some of the things I've read say it then looks at your .xsession or .Xclients file, but I don't see how this works exactly. If your choice of WM can change, then it can't be included directly in the .xsession file, can it? So unless there's some kind of scripting going on in the file, and I don't think there is, the actual WM startup must be started somewhere else.

So I guess my real question is, when you use xdm, gdm, or kdm, how exactly is the Desktop Environment launched? Where should I look to be sure that everything is working correctly?
 
Old 05-02-2006, 10:06 PM   #2
TomaCzar
Member
 
Registered: Dec 2003
Location: Roc City (Rochester-NY)
Distribution: Slacker 4 Life
Posts: 125

Rep: Reputation: 15
"Where should I look to be sure that everything is working correctly?"

You still haven't said what the problem is so that's a pretty open-ended question.

"when you use xdm, gdm, or kdm, how exactly is the Desktop Environment launched?"

Well, first I'd like to correct a mistake earlier in your post. Actually the .xsession file is a script. Here's an example:

Code:
bash-3.1$ cat .xsession
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

# Start the window manager:

#exec /usr/bin/soffice -quickstart &

exec /usr/bin/X11/xscreensaver -no-splash &

exec /usr/bin/gkrellm &

exec /usr/X11R6/bin/fluxbox
notice how I call fluxbox (my window manager) on the last line. That's how XDM ( my graphical login manager) knows to launch Flux when I login. If you take a closer look at some of the files associated with the software you're referring to (XDM, GDM, KDM) you should be able to discern a better understanding of the process. If some cloudiness remains, you can always 'man' the particular file you don't understand.
 
Old 05-03-2006, 12:27 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Original Poster
Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
No, no. I understand all that. I know what xsession does. The problem is, as your example shows, there is only ONE window manager listed in it. If you were to change the selection in gdm to Gnome, for example, how would it know how to start that one instead of Flux? It seems that .xsession alone can't account for all the choices possible.

That's what I want to know, how the session manager manages to open the correct WM, no matter what your choice, and what files/scripts are involved. If I know what it's supposed to be doing, then I can compare it with what's on my own system and hopefully fix it.
 
Old 05-03-2006, 02:17 AM   #4
TomaCzar
Member
 
Registered: Dec 2003
Location: Roc City (Rochester-NY)
Distribution: Slacker 4 Life
Posts: 125

Rep: Reputation: 15
My .xsession is hacked down to what I want it to do. You can edit the file to start whatever WM you want. The original file is /etc/X11/xdm/Xsession which if you take a look has multiple WMs in it and maybe a clue towards exactly what you're looking for (because I'm just not sure what that is).

-TomaCzar
 
Old 05-03-2006, 03:27 AM   #5
kevkim55
Member
 
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353

Rep: Reputation: 32
From what I know, when you select the Window Manager from the combo on kdm or xdm login screen, kdm/xdm pass the name of WM to .xsession as an argument. .xsession takes that argument and passes it to $startup defined in it. .xinitrc knows how to react based on the WM choosen. Thus KDM/XDM simply execute .xsession with WM as a CL argument.

KDM/XDM/GDM are DMs while, KDE, Gnome, fluxbox.... are WMs.
 
Old 05-03-2006, 08:40 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
One day I got angry about the logic of gdm and I decided to track how it was working.
I came up with this:
http://www.linuxquestions.org/questi...24#post2101024

One month later they changed the logic and I didn't bother to look again. .xsession has changed a lot and seems more logical.

Basically:

WHen the system boots, the scripts in /etc/init.d/ are started.
Like xdm first , which looks in /etc/X11/default-display-manager (this is maybe debian specific) and if returns without doing anything if its name is not in this file,..
until it arrives on gdm.
Then have a look at /etc/init.d/gdm , the start part.
Look at /etc/X11/Xsession which calls all scripts in /etc/X11/Xsession.d/
Help yourself by putting some comments on top of each scripts:
Code:
echo "I'm there with these args:$*" | logger
and look the result in /var/log/messages.

My
 
Old 05-03-2006, 02:36 PM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Original Poster
Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Thank you all, especially nx5000. One of the hardest things about linux is finding accurate, comprehensive, and up-to-date information on how things work (that isn't too technical). A lot of things you find on the net are old or not detailed enough to really help you.

The main things I could gather so far were that manual starting and xdm will run whatever's in your .xsession or .xinitrc. But some of the pages I saw said that gdm and xdm uses .xsession, and some of them say they bypass them entirely. Apparently gdm will run .xsession if you run the "default" choice, but bypasses it if you choose something else. kdm seems to do something else entirely.

I'm still not completely clear on it, but it's getting more understandable. Now I've got to take a look at /etc/X11/Xsession.d.
 
Old 05-03-2006, 04:53 PM   #8
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Original Poster
Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
All right, I've been reading the Xsession man page, and I think I understand the beginning part of it a bit better now. Let'see if I'm following it straight so far:

1) When you start an X window session, via init.d, or startx, it can either immediately run the /etc/Xsession script, or it can start a display manager.

2a) In the first case, it's relatively simple. Xsession will run those files and scripts it's set up to do, usually ending in a window manager or desktop environment. A ~/.xsession or similar file will override the global defaults.

2b) A DM can either run Xsession or not, depending on how it's set up. xdm will always run it, I gather, but others may not. If the DM does run Xsession, it can optionally pass on a program to run as an argument, usually the window manager. If you have an ~/.xsession file set up, it will ignore the argument and run whatever is in it instead.

Now for what I still don't know.

1) Which DM's do and don't run Xsession? And how can you tell? Especially gdm, the one I want to use.

(Update, it seems that gdm has it's own separate version of Xsession that it runs instead of the main one. (/etc/gdm/Xsession))

2) If they don't run Xsession, then what do they really do when starting a WM?

From what I gather, I think kdm is the real oddball here. I'm not sure, but I'm guessing it's the main one that bypasses Xsession.

So, have I got it right?
 
Old 05-03-2006, 05:31 PM   #9
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Original Poster
Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Hmm, from /etc/gdm/Xsession:

Quote:
# This is SORT OF LIKE an X session, but not quite. You get a command as the first argument (it could be multiple words, so run it with "eval"). As a special case, the command can be:
# failsafe - Run an xterm only
# default - Run the appropriate Xclients startup (see the code below)
# custom - Run ~/.xsession and if that's not available run 'default'
Much clearer. But what are the "appropriate Xclients" here? Is it referring to the WM's themselves, called from the gdm-passed argument, or are they yet more scripts somewhere that in turn start the WM? The "code below" doesn't make it clear to me.
 
Old 05-04-2006, 05:34 AM   #10
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
Quote:
Originally Posted by David the H.
Hmm, from /etc/gdm/Xsession:



Much clearer. But what are the "appropriate Xclients" here? Is it referring to the WM's themselves, called from the gdm-passed argument,
Yes I think its the parameter passed as argument. I don't have gdm anymore (it pulled two many dependencies from gnome which I don't have) so I can't confirm. Take care that as I said, the code has changed less than 2 months ago and I wouldn't be supprised that the documentation has been updated (look at the source..)
Xclients is also a generic term from the X-window terminology
http://en.wikipedia.org/wiki/X_Windo...k_transparency
 
Old 05-04-2006, 08:38 PM   #11
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Original Poster
Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Well, all is well with the world. a new update of gdm came out today, and it seems to have fixed the problem. Thanks for the help everyone. I really learned a lot here.

And I've always intended to learn more about how the X server works. I guess I'm going to be reading a bit more now. (^_^)

Last edited by David the H.; 05-04-2006 at 08:45 PM.
 
  


Reply

Tags
gdm, kdm, login, startup, xdm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing login managers stonehurstX11 Mandriva 3 04-19-2006 12:59 PM
login managers and consoles eeades Slackware 3 08-31-2005 10:19 AM
Multiple login managers? debuser Linux - General 5 03-26-2004 11:44 AM
Switching login managers Twiggy794 Linux - Software 1 12-07-2003 09:59 PM
Gnome Login sessions Ian Benjamin General 0 02-23-2001 09:04 AM


All times are GMT -5. The time now is 08:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration