- Introduction
- Booting a System
- The OpenBoot Environment
- The OpenBoot Architecture
- The OpenBoot Interface
- Getting Help in OpenBoot
- PROM Device Tree (Full Device Pathnames)
- OpenBoot NVRAM
- OpenBoot Security
- OpenBoot Diagnostics
- OpenBoot PROM Versions
- Booting a System
- The Kernel
- System Run States
- System Shutdown
- Chapter Summary
- Apply Your Knowledge
Apply Your Knowledge
Exercises
CAUTION
Don't Do This on a Production System! Because some of the steps involved in the following exercises could render a system unbootable if they're not performed properly, you should not perform these exercises on a production system.
3.1 - Using OpenBoot Commands
In this exercise, you will halt the system and use the OpenBoot commands to set parameters and gather basic information about your system.
Estimated time: 30 minutes
-
Issue the OpenBoot command to display the banner, as follows:
banner
- Set parameters to their default values, as follows:
reset-all
-
Display the list of OpenBoot help topics, as follows:
help
-
Use the banner command to get the following information from your system:
ROM revision
Amount of installed memory
System type
System serial number
Ethernet address
Host ID
-
Display the following list of OBP parameters by using the printenv command:
Output-device Input-device Auto-boot Boot-device
-
Set the auto-boot? parameter to false to prevent the system from booting automatically after a reset. From the OpenBoot ok prompt, type the following:
setenv auto-boot? false
Verify that the parameter has been set by typing the following:
printenv auto-boot?
From the Unix prompt, set the auto-boot? parameter back to true:
eeprom auto-boot?=true
Take the system back down to init state 0 and verify that the auto-boot? parameter is set to true.
-
Use the following commands to display the list of disk devices attached to your system:
probe-scsi probe-scsi-all probe-ide
Explain the main differences between these commands.
CAUTION
Preventing a System Hang If any of these commands returns a message warning that your system will hang if you proceed, enter n to avoid running the command. Run reset-all before running probe- again and then respond y to this message.
-
List the target number and the device type of each SCSI device attached to your system by using the OpenBoot commands in step 7.
-
From the OpenBoot prompt, identify your default boot device as follows:
printenv boot-device
-
Use the show-disks OpenBoot command to get a listing of the disk drives on your system, as follows:
show-disks
Display the full device path for the disk4 device alias, as follows:
devalias disk4
Create a permanent device alias named disk4 that points to SCSI target 4, as follows:
nvalias disk4 /iommu/sbus/espdma@f,400000/\ esp@f,800000/sd@4,0
Reset the system and verify that the device alias is still set by typing the following:
reset devalias disk4
-
Boot the system, log on as root, and use the eeprom command to list all NVRAM parameters.
-
Use the eeprom command to list only the setting of the boot-device parameter, as follows:
eeprom boot-device
Reset boot-device to its default parameter from the OpenBoot prompt, as follows:
set-default boot-device
From the OpenBoot prompt, remove the alias disk4, as follows:
nvunalias disk4
Reset the system and verify that disk4 is no longer set, as follows:
reset printenv
Set all the OpenBoot parameters back to their default values, as follows:
set-defaults
3.2 - Booting the System
This exercise takes you through the steps of powering on and booting the system.
Estimated time: 5 minutes
-
Turn on power to all the peripheral devices, if any exist.
-
If the OpenBoot parameter auto-boot is set to false, you should see the ok prompt shortly after you power on the system. If the system is set to auto-boot, you should see a message similar to the following displayed onscreen:
SunOS Release 5.8 Version Generic_108621-04 64-bit Copyright 1983-2000 Sun Microsystems, Inc. \ All rights reserved.
You should see the system begin the boot process. Interrupt the boot process by pressing Stop+A. The ok prompt appears.
-
At the ok prompt, type boot to boot the system.
3.3 - Booting an Alternate Kernel
In this exercise, you'll practice booting from a backup copy of the /etc/system file. You should use this process if your /etc/system file ever becomes corrupt or unbootable.
Estimated time: 15 minutes
-
Log in as root.
-
Create a backup copy of the /etc/system file by typing this:
cp /etc/system /etc/system.orig
-
Now remove the /etc/system file by typing this:
rm /etc/system
-
Halt the system by typing this:
/usr/sbin/shutdown y g0 i0
-
At the ok prompt, boot the system by using the interactive option to supply the backup name of the /etc/system file. You do that by typing this:
boot a
-
You are prompted to enter a filename for the kernel and a default directory for modules. Press Return to answer each of these questions. When you are prompted with this message to use the default /etc/system file
Name of system file [etc/system]:
enter the following:
/etc/system.orig
-
Later you'll be asked to enter the root file system type and the physical name of the root device. At that point, press Return to answer both questions.
-
When the system is ready, log in as root and put the original /etc/system file back in place:
cp /etc/system.orig /etc/system
3.4 - Using Run Control Scripts
In this exercise, you'll practice creating run control scripts and shutting down the system.
Estimated time: 10 minutes
-
Log in as root and change to the /etc/init.d directory. Copy the file named lp to test:
cd /etc/init.d cp lp test
-
Use the vi editor to edit the file named test. Replace line 16, which reads
[ -f /usr/lib/lpsched ] && /usr/lib/lpsched
with a line that reads
echo ""; /usr/bin/banner "Ready"; echo ""
Now replace line 20, which currently reads
[ -f /usr/lib/lpshut ] && /usr/lib/lpshut
with the following line:
echo ""; /usr/bin/banner "System going down"; echo ""
-
Verify that the test script runs properly by using the start and stop arguments:
./test start ./test stop
-
Change to the /etc/rc2.d directory and create a hard link to the test script that you just created:
cd /etc/rc2.d ln /etc/init.d/test S22test
-
Change to the /etc/rcS.d directory and create another link to the test script that will run when the system goes into run level S:
cd /etc/rcS.d ln /etc/init.d/test K99test
-
Shut down the system to single-user mode:
init S
Watch the output on the console. Does the shutdown message from the K99test script appear?
-
Halt the system:
/usr/sbin/shutdown y g0 i0
-
At the ok prompt, boot up the system again:
boot
-
Watch the system messages on the console. Does the startup message from the S22test script appear?
Review Questions
The hardware-level user interface that you see before the operating system has been started is called what?
OpenBoot
EEPROM
Firmware
Boot PROM
Which of the following is where the system identification information, such as the hosted, is stored?
Firmware
OpenBoot
NVRAM
Kernel
What tasks are performed by OpenBoot? (Select the two best answers.)
Executing POST
Loading bootblk
Executing ufsboot
Loading the operating system kernel
Which of the following is not a task of the OpenBoot firmware?
Testing and initializing the system hardware
Loading the kernel
Starting up the operating system from either a mass storage device or from a network
Allowing modification and management of system startup configuration, such as NVRAM parameters
Which of the following is attached to a host computer through a hierarchy of interconnected buses on the device tree?
SBus cards
SCSI peripherals
Plug-in device drivers
Nodes
What is /pci@1f,0/pci@1,1/ide@3/disk?
Full device pathname
Physical device
Logical device
Instance
Which of the following is used to obtain information about devices and to display device pathnames in OpenBoot?
show-devs
dmesg
pwd
sysdef
Which of the following commands creates a temporary device alias named disk3?
setenv disk3 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0
set disk3 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0
nvalias disk3 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0
devalias disk3 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0
If you want to create permanent aliases in NVRAM (that show up after a reboot), which of the following commands should you use?
devalias
nvalias
setenv
eeprom
Which NVRAM variable specifies the device from which to start up?
boot-device
boot-file
output-device
input-device
Which command cannot be used to modify NVRAM variables?
set-defaults
setenv
nvalias
set-default
If a system will not start due to a bad NVRAM variable, which of the following, performed before you see the OpenBoot prompt, resets the NVRAM variables to their default settings?
set-default <variable>
Stop+N
set-defaults
Ctrl+N
Which of the following can restrict the set of operations that users are allowed to perform at the OpenBoot prompt?
security-password
security-mode
set-secure
set-security
Which of the following is used in OpenBoot to test all devices that have built-in self-test methods below the specified device tree node?
diag
probe-scsi
test-all
test
Which option do you use with the OpenBoot boot command so that you are prompted for the name of the standalone program to load?
v
f
s
a
What resides in blocks 115 of the startup device?
bootblk
superblock
kernel
ufsboot
Which of the following loads the operating system kernel?
ufsboot
openBoot
bootblk
init
Which of the following commands lists all hardware devices, system devices, loadable modules, and the values of selected kernel tunable parameters?
more /var/adm/messages
adb
dmesg
sysdef
What key combination would you enter to interrupt a system that is not responding?
Ctrl+B
Ctrl+C
Stop+A
Ctrl+Alt+Delete
Ctrl+Break
What is the function of the auto-boot parameter that is set in the OpenBoot PROM?
Boots automatically after power-on or reset
Sets the default boot device
Reboots after a watchdog reset
Automatically performs a system reboot when a system core file has been generated
Which of the following commands is used to set the auto-boot parameter?
setenv auto-boot?=false
set auto-boot=false
eeprom auto-boot?=false
nvset
To display all OpenBoot parameter settings, such as boot-device and ttya-mode, what should you type?
nvalias
devalias
printenv
show all
To check the target IDs on all the SCSI devices connected to all the SCSI controllers, what should you type?
test-all
probe-scsi
probe-scsi-all
test-scsi
The kernel reads which of the following files when loading? (This is where system configuration information is stored.)
/etc/system
/platform/<arch>/kernel/unix
/etc/inittab
/kernel/unix
Select the sequence of events that best describes the boot process.
Boot PROM phase, boot program phase, kernel initialization phase, init phase
Boot program phase, boot PROM phase, kernel initialization phase, init phase
Boot program phase, boot PROM phase, init phase, kernel initialization phase
Boot PROM phase, boot program phase, init phase, kernel initialization phase
What consists of a small static core and many dynamically loadable modules?
The kernel
ufsboot
The shell
The bootblock
By default, how many usable system run states does Solaris 9 have?
3
7
6
8
At what run state is the /export/home file system still available? (In this state, all services except the most basic operating system services are shut down in an orderly manner.)
S
1
2
0
What is the first task that the kernel starts up?
sched
init
ufsboot
load loadable modules
How can system messages displayed at bootup be viewed later?
By issuing the dmesg command
By viewing the /var/messages file
By issuing the sysdef command
By viewing the /etc/boot.log file
To boot a system into a single-user state, what command is entered at the ok prompt?
boot
boot s
boot a
boot -n
Which command, typed at the ok prompt, stops and asks for input during the boot process?
boot i
boot a
boot v
boot -s
Which of the following programs examines the contents of the /etc/inittab file to determine the order for starting up other processes and what to do when one of these processes ends?
init
boot
kernel
swapper
Which of the following commands is equivalent to the init 5 command?
poweroff
halt
reboot
boot s
Which of the following programs is responsible for executing ufsboot?
bootblk
kernel
init
boot
What command do you use to change run levels?
run
init
kill
su
The respawn action in the /etc/inittab file does which of the following:
Restarts the command
Reboots the system
Restarts all system processes
Waits for a command to be completed
Where are the startup scripts for run level 3 located?
/etc/rc.boot
/etc/rc3
/etc/rc3.d
/sbin/rc3
What is the best method to add a run control script for run level 3?
Add the script to /usr/local/bin.
Add the script to /etc/init.d and link it to the /etc/rc3.d directory.
Add the script to /etc/rc3 and make a link to /etc/init.d.
Add the script to /sbin/rc3.
Answers to Review Questions
-
A. The hardware-level user interface that you see before the operating system starts is called the OBP. For more information, see the section "The OpenBoot Environment."
-
C. NVRAM is where the system identification informationsuch as the host ID, Ethernet address, and TOD clockis stored. For more information, see the section "The OpenBoot Environment."
-
A, B. The two primary tasks of the OpenBoot firmware are to run the POST and to load the bootblock. For more information, see the section "The OpenBoot Environment."
-
B. OpenBoot runs POSTs to initialize the system hardware. It also loads the primary startup program, bootblk, from the default startup device. The bootblk program finds and executes the secondary startup program, ufsboot, and loads it into memory. From that point, the ufsboot program loads the operating system kernel. For more information, see the section "The OpenBoot Environment."
-
D. Devices called nodes are attached to a host computer through a hierarchy of interconnected buses on the device tree. A node that represents the host computer's main physical address bus forms the tree's root node. For more information, see the section "The OpenBoot Architecture."
-
A. A full device pathname is a series of node names separated by slashes (/). The root of the tree is the machine node, which is not named explicitly but is indicated by a leading slash. Each device pathname has this form:
driver-name@unit-address:device-arguments
For more information, see the section "PROM Device Tree (Full Device Pathnames)."
-
A. The OpenBoot command show-devs is used to obtain information about devices and to display device pathnames. For more information, see the section "PROM Device Tree (Full Device Pathnames)."
-
D. You use the devalias command as follows to create a temporary device alias named disk3:
devalias disk3 /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0
For more information, see the section "OpenBoot Device Aliases."
-
B. or D. You use the nvalias command from the OpenBoot PROM or the eeprom command from the Unix prompt to create a permanent alias in NVRAM that remains in effect even after a reboot. For more information, see the section "OpenBoot Device Aliases."
-
A. The NVRAM variable named boot-device contains the name of the default startup device. For more information, see the section "Booting a System."
-
C. You use one of the following commands to modify NVRAM parameters: setenv, set-default, or set-defaults. For more information, see the section "OpenBoot NVRAM."
-
B. To reset the NVRAM variables to their default settings, you hold down the Stop+N keys simultaneously while the machine is powering up. For more information, see the section "OpenBoot NVRAM."
-
B. The OpenBoot command security-mode restricts the set of operations that users are allowed to perform at the OpenBoot prompt. For more information, see the section "OpenBoot Security."
-
C. The OpenBoot command test-all tests all devices that have built-in self-test methods below the specified device tree node. For more information, see the section "OpenBoot Diagnostics."
-
D. You issue the OpenBoot boot command with the a option to be prompted for the name of the standalone program to load. For more information, see the section "The boot Command."
-
A. The bootblock resides in blocks 115 of the startup device. For more information, see the section "The boot Command."
-
A. The secondary startup program, ufsboot, loads the two-part operating system kernel. For more information, see the section "Booting a System."
-
D. You use the sysdef command to list all hardware devices, system devices, and loadable modules, as well as the values of selected kernel tunable parameters. For more information, see the section "The Kernel."
-
C. You interrupt a system that is not responding by pressing Stop+A. For more information, see the section "Stopping the System for Recovery Purposes."
-
A. auto-boot? controls whether the system automatically starts up after a system reset or when the power is turned on. The default for this variable is true. When the system is powered on, the system automatically starts up to the default run level. For more information, see the section "OpenBoot NVRAM."
-
C. eeprom auto-boot?=false is used to set the auto-boot? parameter. For more information, see the section "OpenBoot NVRAM."
-
C. At the OpenBoot prompt, you use the printenv command to display all OpenBoot parameter settings. For more information, see the section "OpenBoot NVRAM."
-
C. You use the probe-scsi-all command to check the target IDs on all the SCSI devices that are connected to all the SCSI controllers. For more information, see the section "OpenBoot Diagnostics."
-
A. When the kernel is loading, it reads the /etc/system file, where system configuration information is stored. This file modifies the kernel's parameters and treatment of loadable modules. For more information, see the section "The Kernel."
-
A. The boot process goes through the following four phases: Boot PROM phase, boot programs phase, kernel initialization phase, and init phase. For more information, see the section "Booting a System."
-
A. The kernel consists of a two-piece static core that is made up of genunix and unix. genunix is the platform-independent generic kernel file, and unix is the platform-specific kernel file. When the system boots, ufsboot combines these two files and many dynamically loadable modules into memory to form the running kernel. For more information, see the section "The Kernel."
-
B. Solaris 9 has eight run levels, but because run level 4 is currently not used, it has only seven usable run levels. For more information, see the section "System Run States."
-
B. Run level 1 is a single-user (system administrator) state in which all local file systems are available. All services except the most basic operating system services are shut down in an orderly manner. For more information, see the section "System Run States."
-
A. The first task for the kernel is to start the swapper process. The swapper process is the part of the kernel that schedules all other processes. The swapper has a process ID of 0 and is named sched. Its first job is to start up the init process. For more information, see the section "swapper."
-
A. You use the dmesg command to view system messages that were displayed during the boot process. For more information, see the section "Booting a System."
-
B. You issue the boot s command at the OpenBoot ok prompt to boot the system into single-user mode. For more information, see the section "Booting a System."
-
B. The boot a command performs an interactive boot. With this option, you are prompted to enter the name of the kernel, the default modules directory, the name of the system file, the root file system type, and the device name for the root device. For more information, see the section "Booting a System."
-
A. The /sbin/init command generates processes to set up the system based on the directions in /etc/inittab. The init process is the parent of all other processes. It examines the contents of the /etc/inittab file to determine the order for starting up other processes and what to do when one of these processes ends. For more information, see the section "System Run States."
-
A. The poweroff command is equivalent to the init 5 command, which takes the system into run state 5, the power-down state. For more information, see the section "Commands to Shut Down the System."
-
A. The bootblk program finds and executes the secondary boot program, called ufsboot, from the UFS and loads it into memory. For more information, see the section "Booting a System."
-
B. You use the init command to change run levels. For more information, see the section "System Run States."
-
A. In the /etc/inittab file, the respawn statement restarts a command if it dies. For more information, see the section "System Run States."
-
C. A corresponding directory named /etc/rc<n>.d contains scripts to perform various actions for that run level. For example, startup scripts for run level 3 are located in the /etc/rc3.d directory. For more information, see the section "rc Scripts."
-
B. To add a run control script for run level 3, you add the script to the /etc/init.d directory and link it, via a hard link, to the /etc/rc3.d directory. For more information, see the section "Adding Scripts to the Run Control Directories."
Suggested Readings and Resources
For more information on the OpenBoot environment and the boot process, refer to Inside Solaris 9 by Bill Calkins, 2002, New Riders.
For more information on the Solaris kernel and tuning the Solaris kernel parameters, refer to the following publications:
The Solaris Tunable Parameters Reference Manual, 2002, Sun Microsystems. This manual is available online at http://docs.sun.com.
Sun Performance and Tuning: Java and the Internet, by Adrian Cockroft, 1998, Prentice Hall.
Solaris Internals: Core Kernel Architecture, by Jim Mauro and Richard McDougall, 2000, Prentice Hall.
Resource Management, by Richard McDougall, Adrian Cockcroft, Evert Hoogendoorn, Enrique Vargas, Tom Bialaski, and Everet Hoogendoorn, 1999, Prentice Hall.