Linux Boot Camp: How Linux Boots (part 1) - page 2
Linux Boot Camp Part I: SysV Init
Once init knows the runlevel, it passes control to a master script that will run the rest of the boot scripts. Its exact location varies, but look for something with a name like /etc/init.d/rc.
The files in /etc/rc2.d are symbolic links with names like K09apache2@ and S20postfix. The scripts they reference live in /etc/init.d:
$ ls -l /etc/rc2.d/S20postfix lrwxrwxrwx 1 root root 17 2009-10-04 12:57 /etc/rc2.d/S20postfix -> ../init.d/postfix
The "S" in S20postfix means the script will be run with the argument "start" when entering that runlevel. A "K" (kill) means the script will be run with the argument "stop". Most init scripts can take a few other arguments, such as "restart", useful if you ever need to run them by hand or via the service command.
The "20" indicates how early the script will be run. Startup scripts are run in numerical order, so S10sysklogd will be run very early in the boot process, S99acpi-support near the end.
One of the last scripts to run is S99rc.local. All it does is look for a file called /etc/rc.local and run it. rc.local is a great place to put special commands you want on your own personal system.
We're almost done! On Gnome systems, one of the last init scripts executed is S99gdm (S99kdm on KDE systems). The Gnome or KDE Display Manager starts X and gives you your login screen. Without it, you'd boot to a text console prompt.
And your system is booted, running X, and waiting for you to log in! All by means of a few shell scripts.
Akkana Peck is a freelance programmer and writer, and author of the book Beginning GIMP: From Novice to Professional. She also fiddles with way too many kernels and Linux distros.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Linux from Scratch, Ubuntu 14.01 Beta and Arch Updates