The X Window System Startup
The startup sequence for the X Window System (which I refer to in this article as X) is fairly complex, but understanding it can be very helpful if things go wrong. First, we will walk through an example startup (OpenLinux). In the section that follows, we'll explore how to wind your way through any startup sequence.
OpenLinux is a good distribution to investigate because its startup sequence is relatively simple but still has enough levels to be interesting.
X is started initially by the init process. In OpenLinux's /etc/inittab, X is started by the following line:
gu:5:respawn:/bin/sh -c 'C=/etc/rc.d/rc.gui;[ -x $C ]&&exec $C;init 3'
This line executes only if you are in run level 5; it instructs init to run /etc/rc.d/rc.gui if that file exists. Otherwise, init switches to run level 3. This helps prevent your system from locking up if the GUI startup script doesn't exist or has any problems.
/etc/rc.d/rc.gui does one thing for OpenLinux: start kdm. In the process, though, it also redirects output to /var/log/gui.log. This is good to know if you're having any GUI-related problems because this is one of the log files you should check.
kdm is the K Display Manager, a complete replacement for the older xdm. In reality, kdm is just a wrapper around old xdm code, which is why many of the configuration files are the same.
When a user logs in, kdm calls /etc/X11/kdm/Xsession, which runs /etc/X11/xinit/kdeinitrc, which calls /opt/kde/bin/startkde.
kdm is configured by /etc/X11/kdm/xdm-config. Note that this is xdm-config, not kdm-config.
/opt/kde/bin/startkde runs the various applications required to provide the KDE environment.