The System Boot Process - 01-Solaris 8 - Student Guide - SA238 (SCSA pt1) - 2
The System Boot Process - 01-Solaris 8 - Student Guide - SA238 (SCSA pt1) - 2
Objectives
Upon completion of this module, you should be able to:
● Identify the directories that contain the kernel and its loadable
modules
● List the directories that hold the run control scripts used to stop
and start system processes and services
13-1
Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services June 2000, Revision A
13
Additional Resources
Additional resources – The following reference can provide additional
details on the topics discussed in this module:
Run levels are sometimes referred to as init states because the init
process is used to transition between run levels. You can use the init
command to manually initiate run-level transitions.
The Solaris Operating Environment has eight run levels, which are
described in the following table.
Run
Function
Level
● init phase
kernel starts
/etc/init
init phase
The boot PROM firmware runs the power on self test (POST) to
verify the system’s hardware and memory.
● boot loads the bootblk from its location on the boot device into
memory.
When ufsboot loads these two files into memory, they are
combined to form the running kernel.
The kernel uses ufsboot to read the files. When it has loaded
enough modules to mount the root file system it unmaps the
ufsboot program and continues on.
The SunOS kernel consists of a small, static core (genunix and unix)
and many dynamically loadable kernel modules.
kernel
genunix
The /kernel/drv directory contains all of the device drivers used for
system boot.
Note – The sparcv9 is the type of CPU that supports 64-bit processing.
● moddir:
Sets the search path for default loadable kernel modules. You can
list together multiple directories to search, delimited either by
blank spaces or colons. If the module is not found in the first
directory, it tries the second directory, and so on.
Sets the root file system type to the listed value. The default is
rootfs:ufs
Sets the root device. The default is the physical pathname of the
device where the boot program resides. The physical pathname is
platform and configuration dependent. For example:
rootdev:/sbus@1,f8000000/esp@0,800000/sd@3,0:a
● exclude:
● forceload:
● set:
Before editing the /etc/system file, you should make a backup copy.
If you enter incorrect values in this file, the system might not be able to
boot.
Once the init phase completes successfully, the system login prompt
is displayed.
When you boot a system, or changes run levels with the init or
shutdown command, the init daemon starts processes by reading
information from the /etc/inittab file.
The inittab file defines three important items for the init process:
● What actions to take when the system enters a new run level.
Each line entry in the /etc/inittab file has the following four
fields:
id:rstate:action:process
respawn If the process dies, init will restart it. If the process
does not exist, init starts it and continues reading
the inittab file. If the process does exist, no action
required, and init continues reading the inittab
file.
/sbin/rcS
Executes commands with a
sysinit entry in the action field
/sbin/rc2
/usr/lib/saf/ttymon
System Login
2. Execute any process entries that have sysinit in the action field
so that any special initialization can take place before users login.
3. Execute any process entries that have 3 in the rstate field, which
matches the default run level, 3.
sbin
The rc scripts rc0, rc5 and rc6 files are hard linked. For example:
# cd /sbin
# ls -i rc*
47154 rc0 47156 rc2 47154 rc5 47158 rcS
47155 rc1 47157 rc3 47154 rc6
SunOS provides the same series of rc scripts in the /etc directory for
backward compatibility.
These scripts are symbolic link files to the rc scripts in the /sbin
directory.
# cd /etc
# ls -l rc?
/etc
K#script
S#script
S#script S#script
S#script
K#script K#script K#script
# ls /etc/rc2.d
The /etc/rc#.d scripts are always run in the sort order shown by the
ls command. These files have names in the form of:
[KS][0-9][0-9]*
/etc
init.d
The benefit of having individual scripts for each run level is that you
can run scripts in the /etc/init.d directory individually by root.
You can turn off a process or start a process without changing the
system’s run level.
For example, to stop and restart the lp print services, run the
following scripts with a stop or start command:
# /etc/init.d/lp stop
# /etc/init.d/lp start
The following table summarizes the tasks that are performed by each
of the /sbin rc scripts.
rc Script Function
You could then create another script to terminate this service and shut
down the database server before the network services are stopped.
To add run control scripts to start and stop a service, create the script
in the /etc/init.d directory and create links in the appropriate
/etc/rc#.d directory for the run level the service is to be started and
stopped.
See the README file in each /etc/rc#.d directory for more information
on run control scripts.
3. Use the ls command to verify that the script has links in the
appropriate directories.
# ls /etc/init.d /etc/rc#.d /etc/rc#.d
init 6 init 5
Multiuser mode
init 0
shutdown
exit
Single-User mode
halt
reboot
boot-s
boot
PROM Monitor (ok)
power off
power on
Power Off
power on
● /usr/sbin/halt
● /usr/sbin/poweroff
● /usr/sbin/reboot
Command Format
To shut down the system and turn off its power automatically:
# shutdown -i5
Preparation
Refer to the lecture notes as necessary to perform the tasks listed.
Task Summary
● In /etc/init.d, copy the lp script to a file called banner.
Change the content of banner according to the instructions in step
3 of the tasks. Make banner executable and test that it works with
the start and stop arguments. In /etc/rc2.d, create a hard
link to /etc/init.d/banner called S22banner. In
/etc/rcS.d, create a hard link to /etc/init.d/banner called
K99banner.
● Reboot the system and verify that S22banner runs. Shut down the
system to run level S and verify that K99banner runs. Change
back to run level 3. Make a backup copy of /etc/system. Check if
any instances of the st driver are loaded. Modify /etc/system to
forceload the st driver. Reboot the system and verify that st driver
instances are loaded.
● Edit /etc/system to exclude the main disk driver for you system
(either dad or sd). Shut down the system to run level 0 and attempt
to boot it. Make note of what happens. Boot the system using the -
a option to the boot command. Use your backup of /etc/system
as required. Replace /etc/system with your backup when fin-
ished and reboot the system.
3. Make the banner script executable and verify that it runs with
both the start and stop arguments.
# chmod a+x banner
# ./banner start
# ./banner stop
______
______
10. Make a backup copy of /etc/system and name the back file
system.orig.
# cp system system.orig
11. If your system uses a SCSI tape device, perform the following:
# init 6
12. Edit /etc/system so it excludes the main disk driver for your
system.
13. Shut down the system to run level 0, and then attempt to boot it
again.
# shutdown -y -i0 -g0
(shutdown messages)
ok boot
What happened?
_______________________________________________
14. Use the boot -a command to boot the system and supply the
name of your backup file called etc/system.orig. Enter
carriage returns to accept the default values for all other boot
parameters. Example:
ok boot -a
Enter filename [kernel/sparcv9/unix]: <Return>
Enter default directory for modules [/platform...]:
<Return>
Name of system file [etc/system]: etc/system.orig
root filesystem type [ufs]: <Return>
Enter physical name of root device [/...]: <Return>
Exercise Summary
Discussion – Take a few minutes to discuss what experiences, issues,
or discoveries you had during the lab exercises.
● Experiences
● Interpretations
● Conclusions
● Applications
Task Solutions
6. Reboot the system and watch for the output of the script you just
installed. Does the startup message from S22banner display?
Yes.
Yes.
11. If your system uses a SCSI tape device, perform the following:
12. Shut down the system to run level 0, and then attempt to boot it
again.
What happened?
The system will be unable to boot. Excluding this driver prevents you
from using the boot disk so long as you use the same /etc/system
file. You must boot using the -a option to be able to supply an alternate
file for /etc/system.
Before continuing on to the next module, check that you are able to
accomplish or answer the following:
❑ Identify the directories that contain the kernel and its loadable
modules
❑ List the directories that hold the run control scripts used to stop
and start system processes and services.