Wednesday, June 10, 2009

CentOS5 display management

From the top...

When the Linux kernel boots, the last thing it does is start the init process. This process is the parent of all processes on the system. It creates processes according to the contents of its configuration file: /etc/inittab. You can read all about it in the manual pages for init and inittab.

On a CentOS5 system with X Windows installed, /etc/inittab will include the following:
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
The first line is just a comment. The second causes init to run /etc/X11/prefdm whenever the system is running in runlevel 5 and to restart it if it terminates.

The /etc/X11/prefdm script (it's just a shell script) reads the /etc/sysconfig/desktop file to determine which display manager is preferred: by reading the DISPLAYMANAGER variable set in that configuration file. If the variable is set and prefdm is able to, the specified display manager is run. Otherwise, first gdm, then kdm then xdm are tried.

The /etc/X11/prefdm script runs display managers by exec'ing them. Thus the display manager replaces the shell process running the script. If no display manager can run, then the script exits with exit status 1. Otherwise the display manager exits with whatever status it likes.

When the script or the display manager it executed terminates, the init process runs the script again.

No comments:

Labels