Certification Objective 3.02Performing Boot and Shutdown Procedures


Certification Objective 3.02—Performing Boot and Shutdown Procedures

Exam Objective 3.5: Perform system boot and shutdown procedures, including identifying the system's boot device, creating and removing custom device aliases, viewing and changing NVRAM parameters, and interrupting an unresponsive system.

The Solaris operating system is designed to run continuously, but there will be situations that will require shutdown and reboot. Consequently, you need to know the shutdown and boot procedures and how to control them by using appropriate commands and by setting the appropriate configuration variables.

Performing System Shutdown

You would shut down a Solaris system only when some system administration task or an emergency situation requires it, such as adding or removing hardware or preparing for an anticipated power outage. Shutting down the system means bringing it down to a run level where it is safe to turn off the power. Guess which command is used to shut down the system. Yes, you are right, it is the shutdown command. Because shutting down a running system is equivalent to changing its run level, the init command will work as well. When you shut down a system, remember the following:

  • Obviously, you need the privileges of a superuser to shut down the system by using the proper commands (that is, to shut down the system gracefully).

  • The commands that can be used for shutting down the system are init and shutdown.

  • You should use the shutdown command to shut down a server. That is because with this command logged-in, users and systems that have mounted resources from the server are notified before the server is actually shut down.

Both the shutdown and init commands take a run level as an argument. The appropriate run level to use for a system shutdown depend on the situation. Different run levels to be used for different situations are listed in Table 3-4.

Table 3-4: Different ways of shutting down a system under different situations

Reason for System Shoutdowm

Action

To turn off system power due to an anticipated power outage.

Shut down to run level 0 where it is safe to turn off the power, or shut down to run level 5 where the power will be turned off automatically if the hardware supports this feature.

Changed kernel parameters in the /etc/ system file.

Shut down to run level 6 (reboot).

To perform tasks related to file system maintenance.

Shut down to single-user mode: run level S or 1, according to your need.

To reboot the system by using the kernel debugger (kmdb) in case the debugger can't be loaded at runtime.

Shut down to run level 6.

The procedure for shutting down the system by using the shutdown command is described here step by step:

  1. Become a superuser.

  2. Issue the following command to determine whether users are logged in to the system:

        Who 

    The command will display the list of all users logged on to the system. You may want to broadcast a message with the shutdown command to alert the users.

  3. Issue the shutdown command which has the following syntax:

     /usr/sbin/shutdown [-y] [-g <gracePeriod>] [-i <initState>] [<message>] 

    The options are described here:

    • -y. Pre-answers the confirmation questions so that the command continues without asking for your intervention.

    • -g <gracePeriod>. Specifies the number of seconds before the shutdown begins. The default value is 60.

    • - i <initState>. Specifies the run level to which the system will be shut down. Default is the single-user level: S.

    • <message>. Specifies the message to be appended to the standard warning message that will be sent out. If the <message> contains multiple words, it should be enclosed in single or double quotes.

      For example:

       shutdown -i 0 -g 120 "!!!! Power Outage Time Approaching!!!" 

    If you used the -y option in the command, you will not be prompted to confirm.

  4. If you are asked for confirmation, type y.

        Do you want to continue? (y or n): y 

  5. Use Table 3-5 to verify that the system is at the run level that you specified in the shutdown command.

  6. If you brought the system to single-user mode, press CTRL-D to proceed with normal startup after you are finished with the system administration tasks. This will bring the system to default run level.

Table 3-5: Prompts for different run levels

Specified Run Level

System Prompt: SPARC

System Prompt: ×86

Single-user level: S

#

#

Power-down level: 0

ok

>

Press any key to reboot

Multiuser level: 3

<loginPrompt>

<loginPrompt>

There are several commands available to shut down the system; these commands are summarized in Table 3-6.

Table 3-6: Different commands for shutting down the system under different situations

Command

Description

When to Use

init

Kills all active processes and synchronizes the file systems before changing to the target run level (0 or 5).

Recommended for standalone systems when users will not be affected.

halt

poweroff

Synchronizes the file systems and stops the processor.

Not recommended, because it does not shut down all the processes. Not a clean shutdown, should be used only in an emergency.

reboot

Synchronizes the file systems and initiates a multiuser reboot.

The init command is the preferred command.

shutdown

Calls the init program to shut down the system; the default target run level is S.

Recommended for servers, because users are notified before the shutdown.

Now that you have learned about the run levels and the system shutdown procedures, here are some practical scenarios and their solutions.

SCENARIO & SOLUTION

You want to bring your server down for an anticipated power outage, and you want a clean shutdown with a 5-minute warning to the users.

Issue the shutdown command as follows:

    shutdown -i5 -g300 -y "System going    down in 5 minutes." 

You have changed the kernel parameters on your server and want to apply the new values. What command will you issue?

Reboot the system, for example:

    shutdown -i6 -y 

You want to shut down your standalone system.

init 0

You want to shut down a system immediately in an emergency.

Issue one of the following commands:

    halt    poweroff 

After you shut down a system, at some point you will need to boot it.

Performing System Boot

The boot process was discussed in detail previously in this chapter. After a system has been shut down, it is booted as described here:

  • By using the boot command on the boot PROM prompt if the system is on the SPARC machine. If the value of the auto-boot? variable is true, the system will be booted automatically. We discuss further on in this chapter how to find out the values of this and other variables.

  • By using the boot command at the Primary Boot Subsystem menu if the system is on the x86 machine.

On the Job 

It is possible to reboot a system by turning the power off and then back on. However, use this method only in emergency situations when there is no graceful alternative. Note that this method is likely to cause file system damage because system services and processes are being terminated abruptly.

You can also boot a system from the network in the following cases:

  • When the system is installed.

  • If the system does not boot from the local disk or if the system is a diskless client.

Different methods for booting under different situations are listed in Table 3-7. As you know by now, the first step in the booting process is to check the hardware devices. These devices have complicated names, and you can create aliases for them.

Table 3-7: Different methods for booting under different situations

Reason for Reboot

Appropriate Boot Option

System power turned off, for example, due to anticipated power outage.

Turn the system power back on.

Changed the kernel parameters in the /etc/system file.

Reboot the system to run level 3.

Performed administrative tasks in single-user run level.

Press CTRL-D to transition the system back to run level 3.

Hardware added to or removed from the system.

Turn the power back on after the hardware addition or removal task is complete.

To recover from a hung system and force a crash dump.

Recovery boot: use Stop-A and halt -d. Take a look at the exercise in a previous section.

Creating and Removing Device Aliases

OpenBoot directly deals with the hardware devices in the system. Each device is identified by its full path, which includes the type of the device and where it is located. The device path can be represented by a short name called a device alias. You can create a temporary device alias with the devalias command or a permanent device alias with the nvalias command.

The devalias command issued without any arguments displays all the device aliases on the system:

    devalias 

To display the device path name corresponding to an alias, issue the following command:

    devalias <alias> 

The <alias> argument specifies the alias for which you want to know the device path. To create an alias specified by <alias> for a device path specified by <devicePath>, issue the following command:

    devalias <alias> <devicePath> 

If the device path specified by <devicePath> already has an alias, it is overwritten with the new alias. The aliases created by the devalias command are temporary and are lost when the system is reset or power-cycled.

To create permanent aliases that persist across power cycles, you can use the nvalias command which has the following syntax:

    nvalias <alias> <devicePath> 

The argument <alias> specifies the alias, and the argument <devicePath> specifics the device path for which the alias is being created. An alias created by the nvalias command will persist along system shutdowns (power-cycles) until the nvrunalias command is used, which has the following syntax:

    nvrunalias <alias> 

This will delete the alias specified by the <alias> argument.

The boot process is controlled by the configuration variables stored in the NVRAM chip, and therefore these variables are also called NVRAM parameters.

Working with NVRAM Parameters

The system configuration variables are stored in NVRAM and therefore are also called NVRAM parameters. These variables determine the startup configuration for the system as well as some related communication characteristics. If you make changes to these variables, the changes will persist across power cycles because they are stored in non-volatile memory.

Commonly used NVRAM parameters are described in Table 3-8.

Table 3-8: A list of NVRAM parameters, also called openboot configuration variables

Parameter Name

Description

Default Value

auto-boot?

If true, boot automatically after power-on or reset, else display the open boot prompt: ok, after power-on or reset.

true

boot-command

Execute this command if auto-boot? is true.

boot

boot-device

The device from which the system boots.

disk or net

boot-file

Arguments passed to the boot program.

Empty string

diag-device

Diagnostic boot source device.

net

diag-file

Arguments passed to the boot program in diagnostic mode.

Empty string

diag-switch?

If true, run in diagnostic mode, else not.

false

fcode-debug

If true, include name fields for plugin device FCodes.

false

input-device

Console input device such as keyboard, ttya, or ttyyb.

keyboard

nvramrc

The NVRAMRC content.

Empty

oem-banner

Customized oem banner.

Empty string

oem-banner?

If true, use customized oem-banner specified by oem-banner.

false

oem-logo

Customized oem logo displayed in hexadecimal.

No default

oem-logo?

If true, display customized oem logo specified by oem-logo.

false

output-device

Console output device such as screen, ttya, or ttyb.

screen

screen-#columns

Number of columns on the screen: number of characters per line.

80

screen-#rows

Number of on-screen rows (lines).

34

security-#badlogins

Number of incorrect security password attempts.

No default

security-mode

Firmware security level: none, command, or full.

None

security-password

Firmware security password. It's never displayed, for good.

No default

use-nvramc?

If true, execute commands in NVRAMRC during system startup, else not.

false

The values of the NVRAM configuration variables can be viewed and changed by using the commands listed in Table 3-9. Remember that these command's are issued at the OpenBoot PROM prompt: ok.

Table 3-9: Commands to view and change the values of the NVRAM parameters

Command

Description

printenv

Displays the current variables and their values.

printenv <var>

Displays the current value of the variable specified by <var>.

set-defaults

Sets the values of all the variables to the factory default.

set-default <var>

Sets the value of the variable specified by <var> to its factory default.

setenv <var> <value>

Sets the value of the variable specified by <var> to the value specified by <value>.

For example, the printenv command will generate an output like the one shown here:

    ok printenv    Variable Name Value Default Value    oem-logo 

    oem-logo? false false    oem-banner? False false    output-device ttya screen    input-device ttya keyboard 

The following command will display the current default boot device for the system:

    ok printenv boot-device 

To change the boot device, you can issue the following command:

    ok setenv boot-device <value> 

The <value> parameter specifies the default device from which to boot such as disk or net.

On the Job 

Many variable changes do not take effect during the current power cycle. The new values will certainly be used during the next power cycle or after a system reset.

You can also use the eeprom command from the OS command line to display or change the boot configuration variables. For example, the following command will display the values of the boot configuration variables:

    /usr/sbin/eeprom 

Any user can use this command, but only the superuser can use the command to change the values of a variable by using the following syntax of the command:

    eeprom <parameter>=<value> 

For example the following command will set the value of the auto-boot? variable to false:

    eeprom auto-boot?=false 

You can find out the OpenBoot PROM revision on your system by issuing the following command:

    prtconf -V 

Although the read-only memory used to boot a SPARC machine is called PROM, the read-only memory to boot an x86 (PC) machine is called BIOS, which we explore next.




Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 168

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