X Window System Administration

An introduction to X structure, configuration and customization.
Running xdm Automatically

After you have used xdm from root's command line to successfully start an X session, the next step is to run xdm automatically during system initialization. This can be done in several different ways. I will describe three—the normal way, an odd way and a weird way. Take a look at your /etc/inittab file. You should find these two lines:

id:3:initdefault:
x:5:respawn:/usr/bin/X11/xdm -nodaemon

The first line sets the default runlevel to 3 (full multi-user mode, with networking) when the system is booted, and the second tells the init process to run xdm when the system's runlevel is 5. On some Linux systems, such as Slackware, this may be 4.

The normal way to have the system run xdm automatically is by changing the first line to:

id:5:initdefault:

This will cause the system to boot to runlevel 5 instead of runlevel 3. In the second line, “respawn” tells init that if xdm exits, to immediately restart it. Startup scripts will be run from /etc/rc.d/rc5.d rather than /etc/rc.d/rc3.d. This means if you have configured your runlevel 3 daemons just the way you want them, you will have to do it again for runlevel 5.

If that seems like too much bother, use the odd method and change the second line instead of the first one, like this:

x:3:respawn:/usr/bin/X11/xdm -nodaemon

This will start up the xdm process in runlevel 3 instead of runlevel 5, preserving your runlevel setup.

Finally, the weird way is to start xdm like any other daemon process and ignore the /etc/inittab file entirely. Add a script to the directory /etc/rc.d/init.d that looks like this:

#!/bin/sh
# /etc/rc.d/init.d/X.init - Start X Window System
echo "Starting X Window Services: xdm"
/usr/X11/bin/xdm

Then, put a symbolic link to the script in the directory /etc/rc.d/rc3.d. When the system is booted, init runs these scripts in the same alphanumerically sorted order that the ls command would display them. On my system, I put in a link called S97X that causes X to be started after almost everything else. Take a look at the other files in the rc3.d directory (using ls -l) and follow their examples. This method can be handy, because it doesn't restart xdm each time xdm exits, and sometimes that might be desired. A simpler way to do the same thing using inittab is by typing the line:

x:3:once:/usr/bin/X11/xdm -nodaemon
One note of caution is needed here. The /etc/inittab file is one of the most critical files on your system. If you mess up your inittab file, your system may not be able to boot, so maybe that weird method isn't so bad after all.

Conclusion

Well, there you have it. I did my best to crunch a book on X Window System administration into one magazine article. I've covered most of the basics of managing X, but also left out quite a bit. If you want more information, check out the sources of definitive documentation listed in the “Resources” sidebar.

Jay Ts has been using UNIX since the year 6 B.X. (before X), and now provides consulting services for Linux. He can be reached at jayts@bigfoot.com; his web page is at http://www.kachina.net/~jay/.

______________________

Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

Upcoming Webinar
8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
11am CDT, April 29th
Moderated by Linux Journal Contributor Mike Diehl

Sign up now

Sponsored by Skybot