HP-UX STARTUP AND SHUTDOWN
STARTUP | RUN LEVELS | SHUTDOWN

This section discusses the process used by HP-UX to initialize the system and change operating states, or "run levels", followed by definitions of the various "run levels". It concludes with a series of abbreviated checklists covering specific situations in which the system administrator or console operator would need to change the system run level.


STARTUP -

Normal Startup -
    1. Before turning on the computer, turn on the console, terminals, any other peripherals and peripheral busses that are attached to the computer so that the computer will recognize them as it comes up.

    2. Turn on the computer. You must reset the system to get it to boot. Reset the system by turning the reset key, pressing the reset button, or cycling the main power, depending the model of your computer.

    3. Monitor the boot messages for indications of abnormal behavior. The following is an example of what you will see on the console of an HP 9000/835 (T520) computer when it is booted. Note that the display may vary depending on the model of your computer.

Processor Dependent Code (PDC) Revision 4

Console path = 10/0/1.0
Primary boot path = 10/0/6.0
Alternate boot path = 10/0/3.0

Autoboot from primary boot path enabled. To override, press any key within 10 seconds (do not press keys if the boot process appears normal).

As the boot process completes, you will see messages that convey the following kinds of information:

real mem = amount of physical memory on your system
lockable mem = amount of memory that may be locked via plock(2) or shmctl(2)
avail mem = amount of real memory available to user processes
Console information
Processor information
Interface cards
Subsystem information
File system information
Buffer information
Root Device information
Copyright information

    4. The operating system will continue to boot up and will display additional information about your system. After the boot-up process has completed, you will see the login prompt.

From the time the system is booted to the time a login prompt is displayed, the system performs several important tasks automatically. The system tests the computer hardware, loads and initializes HP-UX, communicates messages to users, and runs scheduled routines. When these system startup tasks are finished, HP-UX is in the initdefault run-level. System startup occurs in the following two phases:
                                                Boot ROM startup
HP-UX startup

Boot ROM Startup -
When the system is powered up, the boot program initializes and tests hardware to bring the system into a usable state by the operating system. When more than one operating system is present on the system’s mass storage devices, both the location of the operating systems and the type of media on which they are stored determine which operating system is loaded. The primary boot path in Stable Storage determines the default boot path.

When the computer is turned on, the Boot ROM goes through the following sequence:

1. Perform System Processing Unit (SPU) self-test.

2. Read the console path from Stable Storage, test it, and assign a display terminal for use as a system console.

3. Read the boot device from Stable Storage, search for the paths using a capability called autosearch, or let the administrator enter the path from the system console and test the boot device path. The default boot disk is located at SCSI address 6 (something like /dev/dsk/c0t6d0) . However, the system may be configured to boot from an alternate device.

4. Load the Initial System Loader (ISL) into memory. The ISL then loads an operating system (/stand/vmunix).

The media on which the bootable system resides has a boot area and a root partition. The boot area contains the bootstrap program and other files needed for bringing up the system. See isl (1M) in the HP-UX Reference for more information on these files. The default disk section where the boot area resides is /dev/dsk/c0t6d0. The root partition contains a file /stand/vmunix, which is the operating system.

Boot ROM Search -
The Boot ROM initializes the primary boot path, loads ISL, and allows the administrator to select either manual, or autoboot mode. In manual, the administrator can select the boot device from all the available peripheral devices. In autoboot mode, the Boot ROM automatically boots the operating system from the primary boot path defined in Stable Storage.

Autoboot - the administrator should use autoboot except for first-time installation and operating system reconfiguration. The ISL autoboot on command enables autoboot. No reboot or automatic reboot on panic is possible. To use autoboot, make sure the boot device is fully powered up and ready for operation before turning on the computer.

Manual - manual boot can be entered by pressing any key during the 10 second override period at the beginning of the autoboot sequence. When manual mode is activated, the Boot ROM prompts for a path to be used. The Primary Boot Path is not altered or disabled. If the SA does not want to boot the system automatically from the Primary Boot Path, disable the autoboot flag in Stable Storage by using the ISL autoboot off command. Note: this is not normally done because the autoboot feature makes the system administration tasks more efficient. Disabling autoboot requires the administrator’s intervention each time the system is rebooted. To re-enable autoboot, use the ISL autoboot on command.

Startup Sequence -
Once HP-UX takes control from the Boot ROM, it performs three tasks:
1. Poll devices and load appropriate device drivers.
2. Find the root file system.
3. Start the init process and bring the system to run-level 2 (multi-user).

Locating Attached Devices -
The kernel device drivers are dynamically loaded and initialized when the system is booted. The script /sbin/ionitrc is executed and scans all the interfaces to find all peripheral devices attached to the system. Next, all the device files are created automatically by invoking the insf command.

The Root File System -
After HP-UX creates all the device files, it searches for the root file system. The root file system is the portion of the file system that forms the base of the file system hierarchy—that is, the portion of the file system on which other file systems can be mounted. The root file system contains the critical files (such as the kernel /stand/vmunix). Generally, the root file system is found on the disk from which HP-UX booted.

After finding it, the operating system starts a shell to read commands from /etc/pre_init_rc. Among these commands is fsck, which checks the root file system (currently in a read-only state). Any problems fsck encounters that it is unable to fix are caught later by /etc/bcheckrc. After fsck exits, the operating system remounts the file system in a read-write state.

Caution: Do not modify the /etc/pre_init_rc script; it might cause the system to be unbootable.

The Init Process -
Next, HP-UX starts its first process, /etc/init. The init process has the process ID of one (1) and no parent process. The init process reads the /etc/inittab initialization file to define the environment for normal working conditions. The init process reads the /etc/inittab file one line at a time, each line contains an entry that describes an action to take. The syntax of inittab entries is:
id:run-levels:action:process

where,
id
An arbitrary one- or two-character ID that uniquely identifies an entry.
run-levels
Defines the run-levels in which the entry can be processed. The administrator can specify multiple run levels (for more information see the following section "Run-Levels"). If this field is empty, all run-levels are assumed. Typically entries tell init to run a process at specific run-levels. If no run-levels are specified, the process can execute in any run-level. For example, the following entry tells init to run the /etc/getty process in all run-levels.
cons::respawn:/etc/getty console H.
action
Identifies what action to take for this entry. The actions are as follows:
sysinitPerforms system initialization on devices needed by init for obtaining run-level information at the console, such as tty characteristics. sysinit entries must finish executing before /etc/inittab continues.
initdefaultCauses the initial (default) run-level to be the value of the run-levels field. If more than one run-level is specified in run-levels, init uses the highest specified run-level.
bootRun the command specified in the process field at boot-time only. Do not wait for process to die before reading the next entry. Before enabling other users to access the system, init executes /etc/inittab entries marked boot or bootwait. These processes are known as boot processes.
BootwaitRun the command specified in the process field at boot time only. Wait for the process to die before moving to the next entry.
slib::bootwait:/etc/recovers[/dev/console]/dev/console 2>&1
brc2::bootwait:/etc/brc>/dev/console 2>&1
waitOn entering the run level that matches the run-levels field of this entry, run process and wait for it to die before reading the next entry.
respawnOn entering the run-level that matches the run-levels field of this entry, run process if it is not already running. Do not wait for process to die before reading the next entry. When process dies, run it again.
ondemandThis instruction is really a synonym for the respawn action. It is functionally identical to respawn.
offWhen the run-level is entered, if the process is running init will send the process a warning signal and wait 20 seconds before killing it. If process is not running, the entry is ignored. Thus, off is also used to deactivate an entry for some time.
powerfailExecute the process associated with this entry only when init receives a power-fail signal (SIGPWR).
powerwaitExecute the process associated with this entry only when init receives a power-fail signal (SIGPWR) and wait until it terminates before continuing any processing of inittab.
onceWhen init enters the run level that matches the entry’s rstate, start the process and wait for its termination. Any subsequent reads of the inittab file when init is in the same run level cause init to ignore this entry.
process
This is the shell command to be run if the entry’s run-levels matches the run-level and/or the action field indicates such an action.


RUN LEVELS

A run-level is a system state in which a specific set of processes are allowed to run. This set of processes is defined in the /etc/inittab file. The predefined run levels for a HP-UX system are:

LevelDescription
   0Halted or reboot level. All kill (‘K’) and start (‘S’) scripts in /sbin/rc0.d are executed.
   SSingle user state. All kill / start scripts in /sbin/rc0.d are executed.
   1Boot time system configuration. Necessary system configuration is done at this state (e.g. hostname, mount of disk file systems, performing software configuration).
   2Multi-user state. All system functions are started
3Networked multi-user state (e.g. mounting NFS systems)
4Standard Run Level for the T520
5 & 6Not defined

SHUTDOWN

The /sbin/shutdown command warns users of impending shutdown, halts daemons, kills unauthorized processes, unmounts file systems, put the system in single user mode, and writes the contents of the I/O buffers to disk. The shutdown command warns all users to log off the system, using a grace period which the administrator can specify.

/sbin/shutdown [-r] [-h] [-y] [gracetime] [message]

Examples:
/sbin/shutdown nowPlace the system in maintenance mode
/sbin/shutdown -r nowShutdown the system and reboot now
/sbin/shutdown -r 300Shutdown the system and reboot in 5 minutes
/sbin/shutdown -h -y nowShut down the system and halt now
/sbin/init 0Shutdown the system and halt

Shutdown performs the following steps:

First, shutdown checks the user for authorization to execute the command. The shutdown command may be used by authorized users who are listed in /etc/shutdown.allow.

Next, if there are other users on the system, shutdown prompts to see whether the administrator would like to send the standard broadcast message or for the administrator to enter a message to the users warning them of the coming system shutdown. If the administrator chooses to send a message - type the message on the terminal when prompted, press [RETURN] and then CTRL-d to signify the end of the message.


After the message, shutdown:
Waits the specified (or default) number of seconds.
Runs all the files in /etc/rc.config.d. These scripts only set variables evaluated later in /etc/rc.
Runs all scripts from the /sbin/rc[current run-level - 1].d/ to /sbin/rc0.d/ with the names beginning with an uppercase ‘K’ (for ‘Kill’) e.g. /sbin/rc1.d/K012cron. This should stop all system processes not necessary for single user mode. The same results may be obtained if the command init 0 is typed.
The next step depends on which options are selected:
                If the system is being halted or rebooted, the /sbin/reboot is executed to finish bringing down the system.
If the system is being brought down to single-user state, then the following steps occur:
                        All currently executed processes are terminated.
All locally mounted file systems are unmounted.

The system is then rebooted or halted by executing the /sbin/reboot if the -h or -r option was chosen. If the system was being brought down to single-user state, a signal is sent to the init process to change states.

You need to be "superuser" or "root" to do the following:

Normal Shutdown -
In order to minimize disruption to on-going work, system shutdown will normally be performed with a warning message to users and a five-minute delay. The following command will accomplish this:

/sbin/shutdown -h -y 300 "Please log off, the system will be shut down in 5 minutes"

Immediate Shutdown -
In the event of an unusual situation requiring an immediate shutdown:

/sbin/shutdown -h -y now

System Reboot -
In the event of a situation requiring a system reboot (and assuming the system is still responding to commands) do the following:

/sbin/shutdown -r 300 "Please log off, the system will be shut down in 5 minutes"

This will shut the system down after a five-minute delay and auto-reboot back to the default run level.

Shutdown to Single-User Run Level -
Some maintenance tasks mandate a shutdown to 'single-user' run state. A typical example would be a situation requiring extending the /usr file system. In such a situation do the following:

/sbin/shutdown 300 "Please log off, the system will be shut down in 5 minutes"

This will take the system to single-user mode after a five-minute delay, shutting down all non-essential processes (and thereby allowing un-mounting of all but the "root" file system).

Prepared by: Everette Smith, Impact Innovations Government Group, Inc.


Back

Home | Index | Startup & Shutdown | SAM | LVM | Devices
| Security | Workbook | Disaster | Information Sources | Glossary


Continue