Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 11

Run Levels and Boot Files (Tasks)

This chapter provides overview information and tasks that are related to run levels and boot files.

This is a list of the step-by-step instructions in this chapter.

This is a list of the overview information in this chapter.

Run Levels

A system's run level (also known as an init state) defines what services and resources are available to users. A system can be in only one run level at a time.

The Solaris environment has eight run levels, which are described in the following table. The default run level is specified in the /etc/inittab file as run level 3.

Table 11-1 Solaris Run Levels

Run Level

Init State

Type

Purpose

0

Power-down state

Power-down

 

To shut down the operating system so that it is safe to turn off power to the system.

s or S

Single-user state

Single-user

To run as a single user with some file systems mounted and accessible.

1

Administrative state

Single-user

To access all available file systems. User logins are disabled.

2

Multiuser state

Multiuser

For normal operations. Multiple users can access the system and all file system. All daemons are running except for the NFS server daemons.

3

Multiuser level with NFS resources shared

Multiuser

For normal operations with NFS resources shared. This is the default run level for the Solaris environment.

4

Alternative multiuser state

 

Currently unavailable.

5

Power-down state

Power-down

To shut down the operating system so that it is safe to turn off power to the system. If possible, automatically turns off power on systems that support this feature.

6

Reboot state

Reboot

To shut down the system to run level 0, and then reboot to multiuser level with NFS resources shared (or whatever level is the default in the inittab file).

How to Determine a System's Run Level

Display run level information by using the who -r command.

$ who -r

Use the who -r command to determine a system's current run level for any level, except run level 0.

Example--Determining a System's Run Level

This example displays information a system's current run level and information about previous run levels.

$ who -r
 .    run-level 31  Dec 13 10:102   33   04 S5
$
  1. Identifies the current run level

  2. Identifies the date of last run level change

  3. Also identifies the current run level

  4. Identifies the number of times the system has been at this run level since the last reboot

  5. Identifies the previous run level

The /etc/inittab File

When you boot the system or change run levels with the init or shutdown command, the init daemon starts processes by reading information from the /etc/inittab file. This file defines three important items for the init process:

  • The system's default run level

  • What processes to start, monitor, and restart if they terminate

  • What actions to take when the system enters a new run level

Each entry in the /etc/inittab file has the following fields:

id:rstate:action:process

The following table describes the fields in an inittab entry.

Table 11-2 Fields Descriptions for the inittab File

Field

Description

id

Is a unique identifier for the entry.

rstate

Lists the run levels to which this entry applies.

action

Identifies how the process that is specified in the process field is to be run. Possible values include: initdefault, sysinit, boot, bootwait, wait, and respawn.

initdefault identifies the default run level. For a description of the other action keywords, see inittab(4).

process

Defines the command or script to execute.

Example--Default inittab File

The following example shows an annotated default inittab file that is installed with the Solaris release:

 
1 ap::sysinit:/sbin/autopush -f /etc/iu.ap
2 ap::sysinit:/sbin/soconfig -f /etc/sock2path
3 fs::sysinit:/sbin/rcS sysinit   >/dev/msglog 2<>/dev/msglog </dev/console
4 is:3:initdefault:
5 p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/...
6 sS:s:wait:/sbin/rcS              >/dev/msglog 2<>/dev/msglog </dev/console
7 s0:0:wait:/sbin/rc0              >/dev/msglog 2<>/dev/msglog </dev/console
8 s1:1:respawn:/sbin/rc1           >/dev/msglog 2<>/dev/msglog </dev/console
9 s2:23:wait:/sbin/rc2             >/dev/msglog 2<>/dev/msglog </dev/console
10 s3:3:wait:/sbin/rc3             >/dev/msglog 2<>/dev/msglog </dev/console
11 s5:5:wait:/sbin/rc5             >/dev/msglog 2<>/dev/msglog </dev/console
12 s6:6:wait:/sbin/rc6             >/dev/msglog 2<>/dev/msglog </dev/console
13 fw:0:wait:/sbin/uadmin 2 0      >/dev/msglog 2<>/dev/msglog </dev/console
14 of:5:wait:/sbin/uadmin 2 6      >/dev/msglog 2<>/dev/msglog </dev/console
15 rb:6:wait:/sbin/uadmin 2 1      >/dev/msglog 2<>/dev/msglog </dev/console
16 sc:234:respawn:/usr/lib/saf/sac -t 300
17 co:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: " 
   -T terminal-type -d /dev/console -l console
-m ldterm,ttcompat  
  1. Initializes STREAMS modules

  2. Configures socket transport providers

  3. Initializes file systems

  4. Defines default run level

  5. Describes a power fail shutdown

  6. Defines single-user level

  7. Defines run level 0

  8. Defines run level 1

  9. Defines run level 2

  10. Defines run level 3

  11. Defines run level 5

  12. Defines run level 6

  13. Defines an unused level, firmware

  14. Defines an unused level, off

  15. Defines an unused level, reboot

  16. Initializes Service Access Controller

  17. Initializes console and identifies the terminal type

 
 
 
  Previous   Contents   Next