There are basically to ways to start X: from the console
or via a graphical login manager. It depends upon the default runlevel set in '/etc/inittab'
which method is used. The line
tells the system to boot to the console. The line
takes you straight to the X login screen. Notice that
you can override this setting by specifying a different run level on the
boot manager prompt:
linux init 3
will boot to the console, regardless of the setting
in '/etc/inittab', and
linux init 5
boots into X. You can change the default setting either
by editing '/etc/inittab' directly as 'root' or via the Mandrake Control
Center ('Boot' - 'Boot Config' - 'Launch the X Window system at start').
section index top
The X Window System consists of two components: a client
and a server. Because of this architecture, there are two sets of configuration
files, one set for the client side and one set for the server side. Client
side configuration can be overruled by special files in a user's home directory.
Client side configuration:
- '/etc/X11/Xsession': This script determines which
window manager or desktop environment is run on X. Settings can be overruled
by '.xinitrc' or '.xsession' (although the later is rarely used these days)
or by options to the 'startx' command (see below).
- '/etc/X11/wmsession.d/': This directory contains
the start scripts for the window managers and desktop environments installed
on this system. Sessions can be checked, added and deleted via the 'chksession'
command. See man chksession.
Server side configuration:
Other configuration files:
- '/etc/X11/XF86Config-4': This file contains the hardware
configuration and settings like default screen resolution or color depth.
Usually you do not edit it by hand but with tools like 'XFdrake'. See man
- '/etc/X11/xdm/Xservers': This file contains the command
line to start up the X server(s). Might be interesting when you want to start
more than one server or turn off X' network capatibilities for security reasons
('-nolisten' option). A list of options and syntax is available in man
- '/etc/X11/fs/config': The configuration file for
the 'xfs' font server. Seeman xfs.
- '/etc/X11/Xressources' and files in '/etc/X11/app-defaults':
These files determine the appearance of some of programs which are part of
the XFree86 suite (like 'xterm'). Settings can be overruled by '~/.Xdefaults'.
Since almost everybody uses GTK+ or Qt substitutes these days, these are
of a rather marginal interest. See man xrdb.
- '/etc/X11/Xmodmap' contains some default key mappings
for the 'Backspace' and the 'Windows' keys. See the article on Keyboard on X.
- '/etc/X11/XftConfig' contains the configuration for
anti-aliasing text via the RENDER extension. See the article on X Fonts.
section index top
After logging in, you are in your home directory. In
order to start X, enter
Startup in detail
'startx' is but a starter script for 'xinit', the X
After initializing the server with the options listed in '/etc/X11/xdm/Xservers',
'xinit' looks for a file '.xinitrc' in your home directory. If there isn't
such a file, it looks up its own configuration file '/etc/X11/xinit/xinitrc'.
This file in turn points 'xinit' to '/etc/X11/Xsession', the central startup
'/etc/X11/Xsession' sets a default background color,
starts the SSH agent
if available, processes user preference files like '.Xresources' and '.Xdefaults'
and sets the $BROWSER variable.
It then executes
to see which window managers and desktop environments are available on the
system. 'chksession' gets this list from the scripts in '/etc/X11/wmsession.d',
the order is determined by the two digits in front of each file name.
Next the scripts in '/etc/X11/xinit.d' are processed
(usually the menu update and some minor keyboard stuff).
The next bit checks if you have specified any window
manager or desktop environment on the command line. If not, it checks if
you've done so in a ~/.desktop file. If not, '/etc/sysconfig/desktop' is
checked for a setting. If one of these steps is successful, the variable
$DESKTOP is set.
The script the goes on to check if a XIM input server
is needed (mainly for Asiatic languages) and if the 'first time wizard' should
After all that is done, the script finally starts the
graphical environment in this order:
The window manager or desktop environment specified
in the $DESKTOP variable set above. The appropriate startup script in /etc/X11/wmsession.d
If the script failed to set the $DESKTOP variable,
'/usr/sbin/chksession -F' is executed.
This prints the first available session entry which is then started.
If that fails, too, the script checks for the 'icewm'
window manager and starts that window manager.
If 'icewm' shouldn't be installed either, it checks
for 'icewm-light', then for 'twm' (XFree's own very basic window manager).
As you can see, you can influence the startup process
in several ways:
By supplying options to the 'startx' command. There
are two sets of options which can be passed via 'startx', options to the
client and options to the server. Options to the client usually state the
session name of window manager to use:
starts X with the Window Maker window manager. Notice
that you have to use the exact session name as listed by the /usr/sbin/chksession
-l command. The second set of options is passed to the server. These
include things like color depth or DPI settings. Available options are listed
in man XF86Config. Server options are separated by a double dash:
startx WindowMaker -- -depth 16 -dpi 100
starts X with the Window Maker window manager and
a color depth of 16 bit and a dot per inch setting of 100.
Options provided with 'startx' overrule all options specified elsewhere.
By writing an '.xinitrc' file. An .xinitrc file
tells X which scripts or programs to execute and which window manager to
start. Here's an example:
The first line runs a commandline utility to change
The second starts an instance of the xterm terminal emulator. Notice the
'&' at the end of the line, it is needed if you start graphical programs
via '.xinitrc' to send those programs 'in the background'. Otherwise the startup
process would simply hang as long until the program is terminated.
The last line uses the shell's 'exec' command, which replaces the current
shell with the command which follows. This command is the executable name
of the window manager (here Window Maker).
Via a '~/.desktop' file. Create a file with the
name '.desktop' in your home directory with this line in it:
where session_name is the name of your
preferred graphical environment as shown by /usr/sbin/chksession -l.
section index top
Graphical logins are handled by so-called display managers.
Mandrake Linux comes with three display managers: KDM (KDE Display Manager),
GDM (GNOME Display Manager) and XDM (guess ... ;-)), KDM being the default.
Display managers offer greater convenience when it comes
to starting and leaving X sessions. They also allow remote session logins.
Especially GDM offers a wealth of options. On the other hand they are consuming
system resources during the whole X session and might pose a security risk
when configured wrongly.
KDM is part of the 'kdebase' RPM, GDM comes in its own
'gdm' RPM and XDM is part of the XFree86 package. GDM does not require GNOME
to be installed.
Startup in detail
If runlevel 5 is set as the default runlevel in '/etc/inittab',
a special command for that runlevel is executed:
The syntax of this line is 'id:runlevel:action:command',
in this case: when entering runlevel 5 (id 'x'), start a recurring process
using the command '/etc/X11/prefdm -nodaemon'. The process 'recurs' in that
it is restarted every time it terminates (i.e. if you log out of an X session,
the display manager login window will reappear and you will not be dropped
onto the console.).
'/etc/X11/prefdm' is a script which tries to determine
which display manager you want to use. First it checks if 'autologin' is
configured in '/etc/sysconfig/autologin'. If so, the configured EXEC command
(usually '/usr/X11R6/bin/startx') is executed and the user will be put directly
into their preferred environment. This can be configured via the 'Mandrake
Control Center' ('Boot' - 'Boot Config').
If autologin is not activated, 'prefdm' checks '/etc/sysconfig/desktop'
for the DISPLAYMANAGER variable (possible values: GDM, KDM or XDM). If this
variable isn't set, it checks for the DESKTOP variable in the same file.
If that variable is set to GNOME, GDM is assumed as the preferred display
manager, if to KDE, KDM.
If none of these apply, the script checks for which
display managers are installed and starts the first it finds. KDM is looked
up first, then GDM and then XDM.
Both GDM and KDM can be configured via their configuration
modules in the respective desktop command centers. Check their online help
systems. The central configuration file for GDM is '/etc/X11/gdm/gdm.conf',
KDM uses '/usr/share/config/kdm/kdmrc'.
GDM can also be configured as 'root' via the gdmconfig command
or via the menu ('Configuration' - 'Boot and Init'). It offers much
more configuration options than KDM, especially in regard to remote login
However, you should be very careful and considerate in regard to
those options since a wrong configuration can make it very easy for intruders
to take control of your system.
If you install GDM and are using KDE, remember to set
in '/etc/sysconfig/desktop' or otherwise the system
will continue to use KDM.
section index top