Linux system startup.

One of the most important services provided by a linux kernel is to manage processes. At boot time, once the kernel is loaded and has finished initialization, the final step (and the start of "user mode" is to launch the first process, PID 1, the mother of all processes, known as "init". This is the executable /sbin/init.

In classical unix systems, the init program would read the file /etc/inittab which governed what the init program would do. Currently (in my case, in 2009 with Fedora 11 and a 2.6.30 kernel) this is no longer true. The file /etc/inittab now has only one line (apart from comments) which specifies the default run level. The line looks like this to specify run level 5 as the default:

id:5:initdefault:

What has happened is that good old systemV init has been replaced with the new event based "upstart" version of init. (Most likely the authors will wince at upstart being called a "version of init", too bad). One of the motivating factors was a desire for better support of event based changes such a usb drives and other hotplug devices.

The directory /etc/event.d now contains one file per "managed job". The old runlevels are now just a subset of these managed jobs.

Run levels

In case you don't have this down cold, the linux runlevels are:

X11, display managers, and all that

The waters get pretty muddy here.

On one hand, one might think that the rc5 "job" would handle all this, this is not the case. There is a "prefdm" job which starts the preferred display manager, and this seems to be the crux of getting X11 going. The most important line in this "job" seems to be:

exec /etc/X11/prefdm -nodaemon
If you have ever rummaged around in /etc/rc5.d or /etc/init.d wondering what script got X11 running, now you know why you never found it.

There is no man page for prefdm. This seems to be some kind of X11 tradition, you just get to kind of grope in the dark. It turns out though that prefdm is just a shell script. In a simple world, you would not need prefdm, but would simply launch xdm and be done with it. In a more complex world, you have choices, in this case kdm, gdm, and good old xdm, maybe even other display managers. The prefdm script looks at /etc/sysconfig/desktop if it exists (it does not on my system), and if it exists, launches the chosem display manager. In the absence of such a preference, it first tries to exec gdm (which works on my system, so the game ends there.) If it had not been able to find gdm, it would then have tried kdm, and after that any thing it could find in the rpm database that claimed to provide a graphical-login service.

Gdm

The purpose of GDM is to provide a graphical login that will allow a user to be chosen and authenticated (and in addition, to allow things like shutdown and reboot).

Once a user has authenticated, we are on to the business of starting a gnome session, which is discussed in my notes on Gnome session startup.

Gdm itself is quite configurable. There used to be a file /etc/gdm.conf, but these days the config file is /etc/gdm/custom.conf. There are more options that you can shake a stick at.

There is online documentation at the gnome website, try GDM version 2.24 documentation. Note that GDM was entirely rewritten for GDM 2.22, and some previous features were entirely dropped. Note also that GDM 2.28 is shipping with Fedora 12 (and my Fedora 11 systems run 2.26).

User session startup

This is a whole separate topic, covered in my Gnome session startup page.
Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org