Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
"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:
bash-3.1$ cat .xsession
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
if [ -f $sysmodmap ]; then
if [ -f $userresources ]; then
xrdb -merge $userresources
if [ -f $usermodmap ]; then
# Start the window manager:
#exec /usr/bin/soffice -quickstart &
exec /usr/bin/X11/xscreensaver -no-splash &
exec /usr/bin/gkrellm &
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.
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.
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).
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.
One month later they changed the logic and I didn't bother to look again. .xsession has changed a lot and seems more logical.
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:
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.
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.
# 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.
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