Certification Objective 3.04-The First Process and etcinittab


Certification Objective 3.04-The First Process and /etc/inittab

Once kernels and drivers are loaded, Linux starts loading the rest of the system. This all starts with the First Process, known as init. It loads based on the parameters defined in /etc/inittab, which specifies runlevels, the system initialization script, virtual consoles, and more.

The First Process

The Linux kernel continues the boot process by calling init. The init process in turn runs /etc/rc.d/rc.sysinit, which performs a number of tasks, including network configuration, SELinux status, keyboard maps, system clock, partition mounts, and host names. It also loads the modules described in the previous section. It does even more: the default version of this file contains more than 500 lines.

/etc/inittab

The init process then determines which runlevel it should be in by looking at the initdefault directive in /etc/inittab. A runlevel is defined as a group of activities. For example, the entry

 id:5:initdefault: 

shows a default starting point in runlevel 5, which is associated with the GUI. For more information on runlevels, read the "Runlevels" section later in this chapter. The virtual console commands are described in the "Virtual Consoles" section toward the end of the chapter.

There are four other default commands in /etc/inittab. The first of these commands captures the CTRL-ALT-DELETE key combination and associates it with the shutdown command shown, which executes the command after 3 seconds, in reboot mode, starting the 3-second countdown immediately:

 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now 

The next two commands are associated with the signal from an uninterruptible power supply (UPS). If you have a UPS connected to your system and a power failure occurs, the UPS should take over powering your computers. But as a UPS can keep your system running for only a limited amount of time, the following command starts the shutdown process in 2 minutes and warns your users as such:

 pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" 

This specific command skips running fsck on reboot and powers down (halts) the system. If the power is restored before shutdown is executed, the next command cancels the shutdown sequence:

 pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" 

Finally, the last command refers to the /etc/X11/prefdm file, which is run if the default runlevel is 5. As you'll see in Chapter 14, the default GUI login manager is configured in this and related files.

Virtual Consoles

A virtual console is a command line where you can log into and control Linux. As RHEL is a multiterminal operating system, you can log into Linux, even with the same user ID, several times.

It's easy to open a new virtual console. Just use the appropriate ALT-function key combination. For example, pressing ALT-F2 brings you to the second virtual console. You can switch between adjacent virtual consoles by pressing ALT-RIGHT ARROW or ALT-LEFT ARROW. For example, to move from virtual console 2 to virtual console 3, press ALT-RIGHT ARROW.

Virtual Consoles in /etc/inittab

Virtual consoles are configured in /etc/inittab. By default, RHEL is configured with six virtual consoles. You can configure up to twelve virtual consoles in /etc/inittab. Here are the default /etc/inittab entries for the first six virtual consoles:

 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 

Virtual consoles really bring the multiuser capabilities of Linux to life. You can be viewing a man page on one console, compiling a program in another, and editing a document in a third virtual console. Other users who are connected through a network can do the same thing at the same time.

Virtual Consoles in the GUI

The GUI is, in one way, just another console. By default, six virtual consoles are configured with Linux, so the GUI is next in line, at console 7. To switch from the GUI to a regular virtual console, press CTRL-ALT-Fx, where x represents one of the other virtual consoles.



RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302)
Linux Patch Management: Keeping Linux Systems Up To Date
ISBN: 0132366754
EAN: 2147483647
Year: 2004
Pages: 227
Authors: Michael Jang

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net