System States System Startup

Most of the initialization activities are specified and carried out by means of the system rc initialization scripts stored in the etc directory and its subdirectories. Rc initialization scripts are usually named in the way that they include the acronym rc as part of their names as a prefix, a suffix, or in a fullpath name. rc stands for run−command and basically explains the purpose of the scripts. These mostly Bourne shell programs are organized differently on BSD and System V platforms, although their purpose is the same. As with any other script, rc initialization scripts are readable, so we can manage them in a very comprehensive way. Besides that, rc scripts are sufficiently verbose during execution, and this is a great help if the system hangs midway through the startup, or if there are any other related problems. Main administrative activities are related to this phase. System site−related customization means editing the rc initialization scripts. Any system upgrade means to upgrade or to add rc initialization scripts; any startup modification means to do something with rc initialization scripts. The rest of this section exclusively addresses these issues. Afterward, a full picture of the necessary administration in this segment should be complete.

4.2.3.2 Terminal Line Initialization

The terminal line initialization is a part of the overall system initialization; however, the implemented initialization technique is quite different than that in the rc system initialization, which is sufficient reason to handle this topic separately. UNIX is extremely cautious with terminal line initialization — terminal lines are gates to the outside world. Users access the system via terminal lines, and the essence of UNIX existence is to serve users. Once the initialization scripts have been executed, the system is fully operational, except for the fact that no one can log in to the system. In order to provide login via a particular terminal line, there must be a corresponding controlling process listening on it usually the getty process, but the ttymon is used on the Solaris platform. At the final initialization phase, init spawns the getty processes to all indicated terminals and the startup procedure is completed. Today, users typically log in over a network using pseudo−terminals; however, the getty program is still doing its job. Terminal line initialization is fully covered in Chapter 11.

4.2.4 System States

Once the initialization activities are completed, the UNIX system enters the multi−user mode, and users may log in to the system. But init can also place the system in single−user mode instead of completing the initialization tasks required for multi−user mode. The single−user mode corresponds to a functionally reduced UNIX system. In single−user mode, a UNIX system looks very much like a personal computer. The single−user mode is primarily dedicated to administrative and maintenance activities that require complete control over the system. The user has all superuser privileges. In some cases, the system will automatically enter single−user mode if there are any problems in the boot process that the system cannot handle on its own for example, filesystem problems that fsck cannot fix, so the system administrator must resolve the problem. The init simply spawns the Bourne shell on the systems console and waits for it to terminate before continuing with the rest of the startup sequence. Entering CTRL−D or the exit command from the shell prompt can terminate the spawned single−user shell. Once this is done, the system may continue into multi−user mode. 91 Single−user mode can be a security problem for a system, because full control over the system is granted. On older UNIX systems, no password was required, but physical access to the system was required in the single−user mode. On some systems, a front panel lock with normal secure vs. maintenance service key positions enabled multi−user vs. single−user mode; the system protection was the key, and only authorized personnel could acquire the key. Modern UNIX systems usually require a root password to enter single−user mode. None of these approaches are perfect, and all of them have some disadvantage. A request for the root password could make difficulties under different circumstances, if the root password was forgotten. While the BSD flavored system could be in one of three possible states — off, single−user, and multi−user mode — the System V platform explicitly defines a series of system states, called run−levels designated by a one−character name. System V run−levels are flavor dependent; an example is listed in the following table: Run−Level Name and Uses Power−down state = safe to power−off the system 1 Administrative state s or S Single−user mode on many systems same as 1 2 Multi−user mode for stand−alone system 3 Multi−user mode for networked system, possibly sharing disks with other systems = via RFS, TCPIP, and NFS, or some other protocol 4 Unused = can be user defined locally 5 Firmware state = for maintenance and running diagnostics, and for booting from an alternate not−root disk 6 Shutdown and reboot state = to reboot system from some running state s, 2, 3, or 4; the system is taken down to run−level 0 and then rebooted back To display the current system run−level, the following command is available: who −r .run−level 3 Mar 14 11:14 3 0 S The system was taken to run−level 3, from run−level S, via run−level 0, on March 14, at 11:14. The leading dot is by default at the beginning of the line. On the System V platform, movement between run−levels is managed by init, and each run−level is controlled by its own set of initialization scripts.

4.2.5 The Outlook of a Startup Procedure