Booting into the Default Runlevel

Entries in /etc/inittab use a field-based notation that determines the runlevelwhen to execute the process, whether or not the process is executed when booting, whether or not to wait for the process to complete, and when to execute the process during booting. The default choices are adequate and only need be changed in unique circumstances that the average user is not likely to encounter.

The value of the default entry, or the initdefauit line in /etc/inittab, determines the particular system state in which Ubuntu will be when the login prompt is finally presented. For example, id:5:initdefault:

In this example, Ubuntu boots to runlevel 5, a network-enabled, multi-user mode with an active X session and a graphical login. The value 5 is forwarded to the script named rc under the /etc/init.d directory. This script is used when booting or changing runlevels; it also acts as an interpreter when you boot Ubuntu in "Interactive" mode by pressing i during the boot.

At this point, init uses the corresponding /etc/inittab entry that matches the designated default runlevel. Using the previous example, the line in /etc/inittab would then be l5:5:wait:/etc/rc 5

Under the /etc directory are a series of directories that correspond to each runlevel:

Assuming that the value is 1, the rc script then executes all the scripts under the /etc/rc.1 directory and then launches the graphical login.

If Ubuntu is booted to runlevel 1, for example, scripts beginning with the letter K followed by scripts beginning with the letter S under the /etc/rc1.d directory are then executed:

K01gdm K19hplip K2 0laptop-mode K20vsftpd K80slapd

K01usplash K20acpi-support K20makedev k21acpid K86ppp

K19cupsys K2 0inetutils-inetd K20ssh K74-bluez-utils S20single

These scripts are actually symbolic links to system service scripts under the /etc/init.d directory.

The rc1.d links are prefaced with a letter and number, such as K15 or S10. The (K) or (S) in these prefixes indicate whether or not a particular service should be killed (K) or started (S) and pass a value of stop or start to the appropriate /etc/init.d script. The number in the prefix executes the specific /etc/init.d script in a particular order. The symlinks have numbers to delineate the order in which they are started. Nothing is sacred about a specific number, but some services need to be running before others are started. You would not want your Ubuntu system to attempt, for example, to mount a remote Network File System (NFS) volume without first starting networking and NFS services.

Was this article helpful?

0 0

Post a comment