All files relating to system startup are located in the /etc/rc.d/ directory. These files in /etc/rc.d/ are as follows: $ ls /etc/rc.d init.d/ rc.local* rc0.d/ rc2.d/ rc4.d/ rc6.d/ rc rc.sysinit* rc1.d/ rc3.d/ rc5.d/ Quick Linux Bootstrap: LILO - boot manager - configed w/(/etc/lilo.conf) kernel - linux kernel - configed w/compilation. /sbin/init - master process - configed w/(/etc/inittab) /etc/rc.d/rc.sysinit - machine config file (keyboard, etc). /etc/rc.d/rc - configed w/(runlevel as argument from init) rc will then execute the symbolic links in the runlevel directory. The Linux Bootstrap: 1. LILO is present in the bootsector. It is pulled into memory and then follows the etc/lilo.conf file's settings to call the kernel. 2. The kernel will configure everything and mount the root (/) filesystem. 3. The kernel then calls the /sbin/init program (the master process). 4. init will then take the system to the desired runlevel according to the /etc/inittab file's settings. (man inittab). 5. init will first call /etc/rc.d/rc.sysinit as specified in /etc/inittab. 6. init will also call /etc/rc.d/rc with the runlevel as its argument. The runlevel argument is configured in /etc/inittab. 7. each runlevel will have a directory in the /etc/rc.d/ directory. for example: rc0.d/ rc1.d/ rc2.d/ etc.. 8. rc will now change to the runlevel directory and execute the symbolic links in the specified order (see below: ordering). The symbolic links that are located in the runlevel directories are pointers to the real files which are located in (/etc/rc.d/init.d/). All scripts which bring the system up and down are located in this single directory. With multiple runlevel directories often sharing multiple scripts, this reduces maintaince by allowing an administrator to make changes to only one script while applying to all runlevels which call it. The Linux Runlevels (RedHat flavors): 0: Complete machine stop. 1: Single-user mode. (Emergency runlevel) 2: Multi-user mode. Without network. 3: Multi-user mode. With network. 4: Unused. 5: Multi-user mode. With network. Starts GUI. 6: Restart. A linux runlevel is a directory of symbolic links to scripts located in the /etc/rc.d/init.d (except local). These scripts are responsible for controlling a specific service. The symbolic links are in a specific format which guides /etc/rc.d/rc in calling the scripts. The format is:Example: K15postgresql@ S10network@ K20nfs@ S30syslog@ The S means Start service. The K means Kill or stop service. The 00 is the order in which /etc/rc.d/rc will run the services; if two scripts have the same order, alpha is next. /etc/rc.d/rc calls the K links first with 'stop' as it's argument. The S links are called next with 'start' as it's argument. With the symbolic links listed in the Example above, /etc/rc.d/rc would first call "/etc/rc.d/init.d/postgresql stop". Then K20nfs, until all K links are called. Next rc will run all the S scripts with "/etc/rc.d/init.d/network start" being first. Then S30syslog, until all S links are run. To edit a runlevel, one would simply delete a symbolic link from the runlevel directory (eg rc3.d) to prevent a service from starting or stopping. Moving the link elsewhere with some documentation might be a good idea. /etc/inittab # The following line tells init that the file is to be run # on initialization of the system before anything else. si::sysinit:/etc/rc.d/rc.sysinit # Now init will look for the line containing initdefault to determine # the default runlevel. id:5:initdefault # Now init knows the default runlevel is 5 so it will run the # the following command. 15:5:wait:/etc/rc.d/rc 5 # init is also responsible for respawning that only init can respawn # such as the login programs that run in the 6 virtual terminals. # the second virtual console (tty2) will have the folling line: 2:2345:respawn:/sbin/mingetty tty2 /etc/rd.d/rc.sysinit sets up basic machine configurations: keyboard type, devices, filesystem checking