Sun Microsystems System Administration Guide, Volume 1 (2000) - page 4

 

  Index      Manuals     Sun Microsystems System Administration Guide, Volume 1 (2000)

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     2      3      4      5     ..

 

 

 

Sun Microsystems System Administration Guide, Volume 1 (2000) - page 4

 

 

CHAPTER
7
Shutting Down and Booting a System
(Overview)
This chapter provides guidelines for shutting down and booting a system. The
Solaris software environment is designed to run continuously so that electronic mail
and network resources are available to users. Occasionally, it is necessary to shut
down or reboot a system because of a system configuration change, a scheduled
maintenance event, or a power outage.
This is a list of overview information in this chapter.
“What’s New in Shutting Down and Booting a System?” on page 101
“Where to Find Shutting Down and Booting Tasks” on page 102
“Shutting Down and Booting Terminology” on page 103
“Guidelines for Shutting Down a System” on page 103
“Guidelines for Booting a System” on page 104
“Performing a Reconfiguration Boot” on page 104
“When to Shut Down a System” on page 105
“When to Boot a System” on page 106
What’s New in Shutting Down and
Booting a System?
This section describes new features related to shutting down and booting a system in
this Solaris release.
101
Booting a System Over the Network With DHCP
Dynamic Host Configuration Protocol (DHCP) functionality has been added to boot
a system over the network in this Solaris release. The previous network boot
technology based on RARP/bootparams is still available.
A DHCP server must have been installed and configured in your network before you
can use DHCP booting. For information on setting up a DHCP server, see
“Configuring DHCP Service” in System Administration Guide, Volume 3.
For information on booting a SPARC based system over the network, see “SPARC:
How to Boot a System Over the Network” on page 142. For information on booting
an IA based system over the network, see “IA: How to Boot a System Over the
Network” on page 156.
IA: Booting From CD-ROM Without the Solaris
Boot Diskette
You can boot the Solaris 8 (Intel Platform Edition) directly from the locally attached
CD-ROM without the Solaris boot diskette on IA based systems that support this
feature.
The Solaris boot diskette is still available for the systems that do not support this
feature.
See Solaris
8
(Intel Platform Edition) Installation Guide for information on booting
IA based systems with or without the boot diskette.
Where to Find Shutting Down and
Booting Tasks
Use these references to find step-by-step instructions for shutting down and booting
a system.
For Information On ...
See ...
Shutting down a SPARC based or IA based
Chapter 9
system
Booting a SPARC based system
Chapter 10
102
For Information On ...
See ...
Booting an IA based system
Chapter 11
Managing a SPARC based system with the
Using Power Management
power management software
Shutting Down and Booting
Terminology
This section describes the terminology used in shutting down and booting a system.
Run levels and init states - A run level is a letter or digit representing a system
state in which a particular set of system services are available. The system is
always running in one of a set of well-defined run levels. Run levels are also
referred to as init states because the init process is used to perform transitions
between run levels. System administrators use the init(1M) command to initiate
a run-level transition. This book refers to init states as run levels.
Boot types - A boot type describes how a system is booted. Different boot types
include:
Interactive boot - You are prompted to provide information about how the
system is booted, such as the kernel and device path name.
Reconfiguration boot - The system is reconfigured to support newly added
hardware or new pseudo devices.
Recovery boot - The system is hung or an invalid entry is prohibiting the
system from booting successfully or from allowing users to log in.
Guidelines for Shutting Down a System
Keep the following in mind when shutting down a system:
Use the init and shutdown commands to shut down a system. Both commands
perform a clean system shutdown, which means all system processes and services
are terminated normally.
Use the shutdown command to shut down a server, because logged-in users and
systems mounting resources from the server are notified before the server is shut
Shutting Down and Booting a System (Overview)
103
down. Additional notification of system shutdowns via electronic mail is also
recommended so that users can be prepared for system downtime.
You need superuser privileges to use the shutdown or init command to shut
down a system.
Both shutdown and init commands take a run level as an argument. The three
most common run levels are:
Run level 3 - Means that all system resources are available and users can log
in. By default, booting a system brings it to run level 3, which is used for
normal day-to-day operations. Also known as multiuser level with NFS
resources shared.
Run level 6 - Stops the operating system and reboots to the state defined by
the initdefault entry in the /etc/inittab file.
Run level 0 - Means the operating system is shut down and it is safe to turn off
power. Bringing a system to run level 0 is needed whenever the system is
moved or hardware is added or removed.
Run levels are fully described in Chapter 8.
Guidelines for Booting a System
Keep the following in mind when booting a system:
After a system is shut down, it is booted by using the boot command at the
PROM level on a SPARC based system or by using the boot command at the
Primary Boot Subsystem Menu on an Intel system.
A system can be rebooted by turning the power off and then back on. This is not a
clean shutdown because system services and processes are terminated abruptly.
However, turning a system’s power off and back is an alternative for emergency
situations.
SPARC based and IA based systems use different hardware components for
booting. These differences are described in Chapter 12.
Performing a Reconfiguration Boot
Perform a reconfiguration boot when adding new hardware to the system. See the
table below to determine which reconfiguration procedure to use.
104
TABLE 7-1
Reconfiguration Procedures
If You Are Reconfiguring The System To ... See ...
Add a secondary disk
Chapter 30 or Chapter 31
Add some other peripheral device
“How to Add a Peripheral Device” on page
290
When to Shut Down a System
The following table provides a list of system administration tasks and the type of
shut down needed to initiate the task.
TABLE 7-2
Shutting Down a System
If You Are ...
Change To This Run Level ... See ...
Turning off system power due to
Run level 0, where it is safe to
Chapter 9
anticipated power outage
turn off power
Changing kernel parameters in the
Run level 6 (reboot the system)
Chapter 9
/etc/system file
Performing file system
Run level S (single-user mode)
Chapter 9
maintenance, such as backing up or
restoring system data
Repairing a system configuration
See “When to Boot a System” N/A
file such as /etc/system
on page 106
Adding or removing hardware
Reconfiguration boot (plus
Chapter 24
from the system
turning off power when
adding or removing hardware)
Repairing an important system file
See “When to Boot a System” N/A
which is causing system boot
on page 106
failure
Shutting Down and Booting a System (Overview)
105
TABLE 7-2
Shutting Down a System
(continued)
If You Are ...
Change To This Run Level ... See ...
Booting the kernel debugger (kadb)
Run level 0, if possible
Chapter 9
to track down a system problem
Recovering from a hung system
See “When to Boot a System” N/A
and you want to force a crash
on page 106
dump
See Chapter 9 for examples of shutting down a server or standalone system.
When to Boot a System
The table below provides a list of system administration tasks and the corresponding
boot type used to complete the task.
TABLE 7-3
Booting a System
If You Are Rebooting
See SPARC
See IA
the System After ...
Use This Boot Type ...
Procedure ...
Procedure ...
Turning off system power
Turn system power back
Chapter 9
Chapter 9
due to anticipated power
on
outage
Changing kernel
Reboot the system to run
“SPARC: How
“IA: How to
parameters in the /etc/
level 3 (multiuser mode
to Boot a System
Boot a System
system file
with NFS resources
to Run Level 3
to Run Level 3
shared)
(Multiuser
(Multiuser
State)” on page
State)” on page
138
151
Performing file system
Use Control-d from run
“SPARC: How
“IA: How to
maintenance, such as
level S to bring the
to Boot a System
Boot a System
performing a backup or
system back to run level 3
to Run Level S
to Run Level S
restoring system data
(Single-User
(Single-User
State)” on page
State)” on page
139
152
106
TABLE 7-3
Booting a System
(continued)
If You Are Rebooting
See SPARC
See IA
the System After ...
Use This Boot Type ...
Procedure ...
Procedure ...
Repairing a system
Interactive boot
“SPARC: How
“IA: How to
configuration file such as
to Boot a System
Boot a System
/etc/system
Interactively”
Interactively”
on page 140
on page 154
Adding or removing
Reconfiguration boot
“SPARC: How
Chapter 31
hardware from the
(plus turning on system
to Connect a
system
power after adding or
Secondary Disk
removing hardware)
and Boot” on
page 365
Booting the kernel
Booting kabd
“SPARC: How
“IA: How to
debugger (kadb) to track
to Boot the
Boot a System
down a system problem
System With the
with the Kernel
Kernel
Debugger
Debugger
(kadb)” on page
(kadb)” on page
160
147
Repairing an important
Recovery boot
“IA: How to
“IA: How to
system file which is
Boot a System
Boot a System
causing system boot
for Recovery
for Recovery
failure
Purposes” on
Purposes” on
page 157
page 157
Recovering from a hung
Recovery boot
See example on
See example on
system and you want to
“IA: How to
“IA: How to
force a crash dump
Force a Crash
Force a Crash
Dump and
Dump and
Reboot the
Reboot the
System” on
System” on
page 161
page 161
See Chapter 10 or Chapter 11 for examples of booting a system.
Shutting Down and Booting a System (Overview)
107
108
CHAPTER
8
Run Levels and Boot Files (Tasks)
This chapter provides guidelines for shutting down and booting a system and
information about run levels and boot files.
This is a list of the step-by-step instructions in this chapter.
“How to Determine a System’s Run Level” on page 110
“How to Use a Run Control Script to Stop or Start a Service” on page 116
“How to Add a Run Control Script” on page 117
“How to Disable a Run Control Script” on page 118
This is a list of overview information in this chapter.
“Run Levels” on page 109
“The /etc/inittab File” on page 111
“Run Control Scripts” on page 115
“Run Control Script Summaries” on page 119
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.
109
TABLE 8-1
Solaris Run Levels
Run
Level
Init State
Type
Use This Level ...
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 all file
systems mounted and accessible.
1
Administrative state
Single-user
To access all available file systems
with user logins allowed.
2
Multiuser state
Multiuser
For normal operations. Multiple
users can access the system and
the entire file system. All
daemons are running except for
the NFS server daemons.
3
Multiuser state with
Multiuser
For normal operations with NFS
NFS resources shared
resource-sharing available.
4
Alternative multiuser
This level is currently unavailable.
state
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 turn 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 state (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 to determine a
system’s run level.
$ who -r
Use the who -r command to determine a system’s current run level for any level
except run level 0.
110
Example—Determining a System’s Run Level
$ who -r
run-level 3
Sep
1 14:45
3
0
S
$
run level 3
Identifies the current run level.
Identifies the date of last run level change.
Sep 1 14:45
Is the current run level.
3
0
Identifies the number of times at this run level since the
last reboot.
S
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 be taken 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.
Run Levels and Boot Files (Tasks)
111
TABLE 8-2
Fields in the inittab File
Field
Description
A unique identifier for the entry.
id
rstate
A list of run levels to which this entry applies.
How the process specified in the process field is to be run. Possible
action
values include: initdefault, sysinit, boot, bootwait, wait,
and respawn.
The command to execute.
process
Example—Default inittab File
The following example shows an annotated default inittab file:
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
(continued)
112
(Continuation)
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 mode
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
What Happens When the System Is Brought to
Run Level 3
1. The init process is started and reads the /etc/default/init file to set any
environment variables. By default, only the TIMEZONE variable is set.
2. Then init reads the inittab file to do the following:
a. Identify the initdefault entry, which defines the default run level (3).
b. Execute any process entries that have sysinit in the action field so that any
special initializations can take place before users login.
c. Execute any process entries that have 3 in the rstate field, which matches
the default run level, 3.
See init(1M) for a detailed description of how the init process uses the
inittab file.
The following table describes the key words used for run level 3’s action field.
Run Levels and Boot Files (Tasks)
113
TABLE 8-3
Run Level 3 Action Key Word Descriptions
Key Word
Starts the Specified Process ...
powerfail
Only when the system receives a power fail signal.
wait
And waits for its termination.
If it does not exist. If the process already exists, continue
respawn
scanning the inittab file.
The following table describes the processes (or commands) executed at run level 3.
TABLE 8-4
Run Level 3 Command Descriptions
Command or Script Name
Description
/usr/sbin/shutdown
Shuts down the system. The init process runs the
shutdown command only if the system has received
a powerfail signal.
/sbin/rcS
Mounts and checks root (/), /usr, /var, and /var/
adm file systems.
Starts the standard system processes, bringing the
/sbin/rc2
system up into run level 2 (multiuser mode).
/sbin/rc3
Starts NFS resource sharing for run level 3.
/usr/lib/saf/sac -t 30
Starts the port monitors and network access for
UUCP. This process is restarted if it fails.
/usr/lib/saf/ttymon -g -h -p
Starts the ttymon process that monitors the console
"‘uname -n‘ console login: "
for login requests. This process is restarted if it fails.
-T terminal_type -d /dev/
The terminal_type on a SPARC based system is sun
console -l console
The terminal_type on an IA based system is AT386
114
Run Control Scripts
The Solaris software environment provides a detailed series of run control (rc)
scripts to control run level changes. Each run level has an associated rc script
located in the /sbin directory:
rc0
rc1
rc2
rc3
rc5
rc6
rcS
For each rc script in the /sbin directory, there is a corresponding directory named
/etc/rcn.d that contains scripts to perform various actions for that run level. For
example, /etc/rc2.d contains files used to start and stop processes for run level 2.
# ls /etc/rc2.d
K07dmi
S70uucp
S75cron
S91afbinit
K07snmpdx
S71ldap.client
S75flashprom
S91ifbinit
K28nfs.server
S71rpc
S75savecore
S92volmgt
README
S71sysid.sys
S76nscd
S93cacheos.finish
S01MOUNTFSYS
S72autoinstall
S80PRESERVE
S94ncalogd
S05RMTMPFILES
S72inetsvc
S80lp
S95IIim
S20sysetup
S72slpd
S80spc
S95amiserv
S21perf
S73cachefs.daemon
S85power
S95ocfserv
S30sysid.net
S73nfs.client
S88sendmail
S99audit
S40llc2
S74autofs
S88utmpd
S99dtlogin
S47asppp
S74syslog
S89bdconfig
S69inet
S74xntpd
S90wbem
The /etc/rcn.d scripts are always run in ASCII sort order. The scripts have names
of the form:
[KS][0-9][0-9]*
Files beginning with K are run to terminate (kill) a system process. Files beginning
with S are run to start a system process.
Run control scripts are also located in the /etc/init.d directory. These files are
linked to corresponding run control scripts in the /etc/rcn.d directories.
The actions of each run control script are summarized in Table 8-5.
Run Levels and Boot Files (Tasks)
115
Using a Run Control Script to Stop or Start
Services
One advantage of having individual scripts for each run level is that you can run
scripts in the /etc/init.d directory individually to turn off functionality without
changing a system’s run level.
How to Use a Run Control Script to Stop or Start
a Service
1. Become superuser.
2. Turn off functionality.
# /etc/init.d/filename stop
3. Restart functionality.
# /etc/init.d/filename start
4. Use the pgrep command to verify whether the service has been stopped or
started.
# pgrep -f service
Example—Using a Run Control Script to Stop or Start a
Service
Turn off NFS server functionality by typing:
# /etc/init.d/nfs.server stop
# pgrep -f nfs
#
Restart the NFS services by typing:
# /etc/init.d/nfs.server start
# pgrep -f nfs
141
143
245
116
(Continuation)
247
# pgrep -f nfs -d, | xargs ps -fp
daemon
141
1 40
Jul 31 ?
0:00 /usr/lib/nfs/statd
root
143
1 80
Jul 31 ?
0:01 /usr/lib/nfs/lockd
root
245
1 34
Jul 31 ?
0:00 /usr/lib/nfs/nfsd -a 16
root
247
1 80
Jul 31 ?
0:02 /usr/lib/nfs/mountd
Adding a Run Control Script
If you want to add a run control script to start and stop a service, copy the script
into the /etc/init.d directory and create links in the rcn.d directory you want
the service to start and stop.
See the README file in each /etc/rcn.d directory for more information on naming
run control scripts. The procedure below describes how to add a run control script.
How to Add a Run Control Script
1. Become superuser.
2. Add the script to the /etc/init.d directory.
# cp filename /etc/init.d
# chmod 0744 /etc/init.d/filename
# chown root:sys /etc/init.d/filename
3. Create links to the appropriate rcn.d directory.
# cd /etc/init.d
# ln filename /etc/rc2.d/Snnfilename
# ln filename /etc/rcn.d/Knnfilename
4. Use the ls command to verify that the script has links in the specified
directories.
# ls /etc/init.d/ /etc/rc2.d/ /etc/rcn.d/
Run Levels and Boot Files (Tasks)
117
Example—Adding a Run Control Script
# cp xyz /etc/init.d
# cd /etc/init.d
# ln xyz /etc/rc2.d/S100xyz
# ln xyz /etc/rc0.d/K100xyz
# ls /etc/init.d /etc/rc2.d /etc/rc0.d
Disabling a Run Control Script
Disable a run control script by renaming it with a dot (.) at the beginning of the new
file name. Files that begin with a dot are not executed. If you copy a file by adding a
suffix to it, both files will be run.
How to Disable a Run Control Script
1. Become superuser.
2. Rename the script by adding an underscore (_) to the beginning of the new file.
# cd /etc/rcn.d
# mv filename _filename
3. Verify the script has been renamed.
# ls
# _filename
Example—Disabling a Run Control Script
The following example changes the S100datainit script name but saves the
original script.
118
# cd /etc/rc2.d
# mv S100datainit _S100datainit
Run Control Script Summaries
TABLE 8-5
The /sbin/rc0 Script
Script Name
Description
/sbin/rc0
Performs the following tasks:
Stops system services and daemons
Terminates all running processes
Unmounts all file systems
TABLE 8-6
The /sbin/rc1 Script
Script Name
Description
/sbin/rc1
Runs the /etc/rc1.d scripts to perform the following tasks:
Stops system services and daemons
Terminates all running processes
Unmounts all file systems
Brings the system up in single-user mode
Run Levels and Boot Files (Tasks)
119
TABLE 8-7
The /sbin/rc2 Script
Script Name
Description
/sbin/rc2
Runs the /etc/rc2.d scripts to perform the following tasks:
Mounts all local file systems
Enables disk quotas if at least one file system was mounted with
the quota option
Saves editor temporary files in /usr/preserve
Removes any files in the /tmp directory
Configures system accounting
Configures default router
Sets NIS domain and ifconfig netmask
Reboots the system from the installation media or a boot server if
either /.PREINSTALL or /AUTOINSTALL exists
Starts inetd and rpcbind and named, if appropriate
Starts Kerberos client-side daemon, kerbd
Starts NIS daemons (ypbind) and NIS+ daemons (rpc.nisd),
depending on whether the system is configured for NIS or NIS+,
and whether the system is a client or a server
Starts keyserv, statd, lockd, xntpd, and utmpd
Mounts all NFS entries
Starts nscd (name service cache daemon)
Starts automount, cron, LP print service, sendmail, utmpd, and
vold daemons
Note - Many of the system services and applications that are started at run level 2
depend on what software is installed on the system.
TABLE 8-8
The /sbin/rc3 Script
Script Name
Description
/sbin/rc3
Runs the /etc/rc3.d scripts to perform the following tasks:
Cleans up sharetab
Starts nfsd
Starts mountd
If the system is a boot server, starts rarpd, rpc.bootparamd, and
rpld
Starts snmpdx (Solstice Enterprise AgentsTM process).
120
TABLE 8-9
The /sbin/rc5 and /sbin/rc6 Scripts
Script Name
Description
/sbin/rc5 and /
Runs the /etc/rc0.d/K* scripts to perform the following tasks:
sbin/rc6
Kills all active processes
Unmounts the file systems
TABLE 8-10
The /sbin/rcS Script
Script Name
Description
/sbin/rcS
Runs the /etc/rcS.d scripts to bring the system up to run level S.
The following tasks are performed from these scripts:
Establishes a minimal network
Mounts /usr, if necessary
Sets the system name
Checks the root (/) and /usr file systems
Mounts pseudo file systems (/proc and /dev/fd)
Rebuilds the device entries for reconfiguration boots
Checks and mounts other file systems to be mounted in single-user
mode
Run Levels and Boot Files (Tasks)
121
122
CHAPTER
9
Shutting Down a System (Tasks)
This chapter describes the procedures for shutting down systems. This is a list of the
step-by-step instructions in this chapter.
“How to Determine Who Is Logged in to a System” on page 126
“How to Shut Down a Server” on page 126
“How to Shut Down a Standalone System” on page 130
“How to Turn Off Power to All Devices” on page 132
This is a list of the overview information in this chapter.
“When to Shut Down the System” on page 123
“How to Shut Down a System” on page 124
“When to Turn Off Power to Devices” on page 125
“Notifying Users of System Down Time” on page 125
For overview information about the available run levels, see Chapter 8.
When to Shut Down the System
Solaris software is designed to be left running continuously so that the electronic
mail and network software can work correctly. However, some system administration
tasks and emergency situations require that the system is shut down to a level where
it is safe to remove power or brought to an intermediate level, where not all system
services are available, such as:
Adding or removing hardware
Preparing for an expected power outage
123
Performing file system maintenance, such as a backup
See Chapter 7 for a complete list of system administration tasks requiring a system
shutdown.
For information on using your system’s power management features, see Using
Power Management.
How to Shut Down a System
Using the init and shutdown commands are the primary ways to shut down a
system. Both commands perform a clean shutdown of the system, which means all file
system changes are written to the disk, and all system services, processes, and the
operating system are terminated normally.
Using a system’s stop key sequence or turning a system off and then on are not clean
shutdowns because system services are terminated abruptly. However, is it
sometimes necessary to use these actions in emergency situations. See Chapter 10 or
Chapter 11 for instructions on system recovery techniques.
The following table describes the various shutdown commands and provides
recommendations for using them.
TABLE 9-1
Shutdown Commands
Command
Description
This Command Is ...
shutdown
An executable shell script that
Recommended for servers running at
calls the init program to shut
run level 3 because users are notified of
down the system. The system is
the impending shut down as are the
brought to run level S by
systems that are mounting resources
default.
from the server being shut down.
An executable that kills all
Recommended for standalone systems
init
active process and syncs the
when other users will not be affected. It
disks before changing run levels.
provides a faster system shutdown
because users are not notified of the
impending shutdown.
124
TABLE 9-1
Shutdown Commands
(continued)
Command
Description
This Command Is ...
reboot
An executable that syncs the
Not recommended; use the init
disks and passes booting
command instead.
instructions to the uadmin
system call, which, in turn,
stops the processor.
halt
An executable that syncs the
Not recommended because it doesn’t
disks and stops the processor.
execute the /etc/rc0 script, which
stops all processes, syncs the disks, and
unmounts any remaining file systems.
Note - The /usr/sbin/shutdown command, not the /usr/ucb/shutdown
command, is used in this chapter and throughout this book.
When to Turn Off Power to Devices
Turning off power to all system devices is necessary when you need to:
Replace or add hardware
Move the system from one location to another
Prepare for an expected power outage or natural disaster like an approaching
electrical storm
System devices to power down include the CPU, the monitor, and external devices
such as disks, tapes, and printers.
The steps for turning off power to all devices are performed in addition to shutting
down the system.
Notifying Users of System Down Time
When the shutdown command is initiated, a warning followed by a final shutdown
message is broadcast to all users currently logged onto the system and all systems
that are mounting resources from the affected system.
This is why the shutdown command is recommended over the init command
when used on a server. When using either command, you might want to give users
more notice by sending a mail message about any scheduled system shutdown.
Shutting Down a System (Tasks)
125
Use the who(1) command to determine which users on the system need to be
notified. This command is also useful for determining a system’s current run level,
which is described on “How to Determine a System’s Run Level” on page 110.
How to Determine Who Is Logged in to a System
1. Log into the system to be shut down.
2. Display logged-in users with the who command.
$ who
Example—Determining Who Is Logged in to a System
The following example displays the output of the who command.
$ who
holly1
console
May
7 07:30
2
kryten
pts/0
May
7 07:35
(starbug)4
lister
pts/1
May
7 07:403 (bluemidget)
1. Identifies the user name of the logged-in user.
2. Identifies the terminal line of the logged-in user.
3. Identifies the date and time the user logged in.
4.
(Optional) Identifies the host name if a user is logged in from a remote system.
How to Shut Down a Server
1. Become superuser.
2. Find out if users are logged into the system.
# who
A list of all logged-in users is displayed. You might want to send mail or
broadcast a message to let users know that the system is being shut down.
3. Shut down the system by using the shutdown(1M) command.
# shutdown -iinit-state -ggrace-period
-y
126
Brings the system to an init state different from
iinit-state
the default of S. The choices are 0, 1, 2, 5, and 6.
Indicates a time (in seconds) before the system is
ggrace-period
shut down. The default is 60 seconds.
Continues to shut down the system without
y
intervention; otherwise, you are prompted to
continue the shutdown process after 60 seconds.
4. If you are asked for confirmation, type y.
Do you want to continue? (y or n): y
If you used the shutdown -y command, you will not be prompted to continue.
5. Type the superuser password, if prompted.
Type Ctrl-d to proceed with normal startup,
(or give root password for system maintenance): xxx
6. After you have finished the system administration tasks, press Control-d to
return to the default run system level.
7. Use the following table to verify the system is at the run level specified in the
shutdown command.
If the System Was
The SPARC Based System The IA Based System
Brought To ...
Prompt Should Be ...
Prompt Should Be ...
Run level S (single-user
#
#
state)
Run level 0 (power-down
ok or >
type any key to
state)
continue
Run level 3 (multiuser
hostname console login: hostname console login:
state with remote
resources shared)
Shutting Down a System (Tasks)
127
SPARC: Example—Bringing a System to Run Level S (Server)
In the following example, the shutdown is used to bring a SPARC based system to
run level S (single-user state) in 3 minutes.
# who
root
console
Jul 14 13:53
# shutdown -g180 -y
Shutdown started.
Wed Jul 14 13:55:55 MDT 1999
Broadcast Message from root (console) on earth Wed Jul 14 13:55:56...
The system earth will be shut down in 3 minutes
Broadcast Message from root (console) on earth Wed Jul 14 13:58:28...
The system earth will be shut down in 30 seconds
INIT: New run level: S
The system is coming down for administration. Please wait.
Unmounting remote filesystems: /vol nfs done.
Jul 14 13:59:15 earth /usr/sbin/vold[376]: problem unmounting /vol;
Print services stopped.
Jul 14 13:59:16 earth syslogd: going down on signal 15
Killing user processes: done.
INIT: SINGLE USER MODE
Type control-d to proceed with normal startup,
(or give root password for system maintenance): xxx
Entering System Maintenance Mode ...
#
SPARC: Example—Bringing a System to Run Level 0 (Server)
In the following example, the shutdown command is used to bring a SPARC based
system to run level 0 in 5 minutes without requiring additional confirmation.
# who
root
console
Jul 14 14:01
rimmer
pts/0
Jul 14 14:03
(starbug)
pmorph
pts/1
Jul 14 14:04
(bluemidget)
# shutdown -i0 -g300 -y
Shutdown started.
Wed Jul 14 14:05:03 MDT 1999
Broadcast Message from root (console) on earth Wed Jul 14 14:05:03...
The system earth will be shut down in 5 minutes
(continued)
128
(Continuation)
Changing to init state 0 - please wait
#
INIT: New run level: 0
The system is coming down. Please wait.
System services are now being stopped.
The system is down.
syncing file systems... done
Program terminated
Type help for more information
ok
See “How to Turn Off Power to All Devices” on page 132 if you are bringing the
system to run level 0 to turn off power to all devices.
SPARC: Example—Rebooting a System to Run Level 3 (Server)
In the following example, the shutdown command is used to reboot a SPARC based
system to run level 3 in two minutes without requiring additional confirmation.
# who
root
console
Jul 14 14:14
rimmer
pts/0
Jul 14 14:15
(starbug)
pmorph
pts/1
Jul 14 14:15
(bluemidget)
# shutdown -i6 -g120 -y
Shutdown started.
Wed Jul 14 14:16:08 MDT 1999
Broadcast Message from root (console) on earth Wed Jul 14 14:16:08...
The system earth will be shut down in 2 minutes
Changing to init state 6 - please wait
#
INIT: New run level: 6
The system is coming down. Please wait.
The system is down.
syncing file systems... done
rebooting
(continued)
Shutting Down a System (Tasks)
129
(Continuation)
earth console login:
Where to Go From Here
Regardless of the reason for shutting down the system, you’ll probably want to return
to run level 3 where all file resources are available and users can log in. See Chapter
10 or Chapter 11 for instructions on bringing a system back to a multiuser state.
How to Shut Down a Standalone System
1. Become superuser.
2. Shut down the system by using the init(1M) command.
# init run-level
Identifies the new run level.
run-level
3. Use the following table to verify the system is at the run level specified in the
init command.
If the System Was Brought
The SPARC Based System The IA Based System
To ...
Prompt Should Be ...
Prompt Should Be ...
#
#
Run level S (single-user state)
#
#
Run level 2 (multiuser state)
Run level 0 (power-down
ok or >
type any key to
state)
continue
Run level 3 (multiuser state
hostname console
hostname console
with remote resources shared)
login:
login:
130
IA: Example—Bringing a System to Run Level 0 (Standalone)
In the following example, the init command is used to bring an IA based
standalone system to the level where it is safe to turn off power.
# init 0
#
INIT: New run level: 0
The system is coming down. Please wait.
The system is down.
syncing file systems... [11] [10] [3] done
Type any key to continue
See “How to Turn Off Power to All Devices” on page 132 if you are bringing the
system to run level 0 to turn off power to all devices.
SPARC: Example—Bringing a System to Run Level S
(Standalone)
In the following example, the init is used to bring a SPARC based standalone
system to run level S (single-user state).
# init s
#
INIT: New run level: S
The system is coming down for administration. Please wait.
Unmounting remote filesystems: /vol nfs done.
Print services stopped.
syslogd: going down on signal 15
Killing user processes: done.
INIT: SINGLE USER MODE
Type Ctrl-d to proceed with normal startup,
(or give root password for system maintenance): xxx
Entering System Maintenance Mode
#
Where to Go From Here
Regardless of the reason for shutting down the system, you’ll probably want to return
to run level 3 where all file resources are available and users can log in. See Chapter
10 or Chapter 11 for instructions on bringing a system back to a multiuser state.
Shutting Down a System (Tasks)
131
How to Turn Off Power to All Devices
1. Use the following table to determine which procedure to use for shutting down
the system.
If You Are Shutting Down a Standalone
If You Are Shutting Down a Server ...
System ...
See “How to Shut Down a Server” on page See “How to Shut Down a Standalone
126.
System” on page 130.
2. Turn off power to all devices after the system is shutdown. If necessary, also
unplug the power cables.
3. After power can be restored, use the following steps to turn on the system and
devices.
a. Plug in the power cables.
b. Turn on the monitor.
c. Turn on disk drives, tape drives, and printers.
d. Turn on the CPU.
The system is brought to run level 3 after the CPU is turned on.
132
CHAPTER
10
SPARC: Booting a System (Tasks)
This chapter describes procedures for using the OpenBootTM PROM monitor and
procedures for booting a SPARC based system to different run levels.
This is a list of the step-by-step instructions in this chapter.
“SPARC: How to Switch to the ok Prompt” on page 134
“SPARC: How to Find the PROM Release for a System” on page 134
“SPARC: How to Change the Default Boot Device” on page 134
“SPARC: How to Reset the System” on page 137
“SPARC: How to Boot a System to Run Level 3 (Multiuser State)” on page 138
“SPARC: How to Boot a System to Run Level S (Single-User State)” on page 139
“SPARC: How to Boot a System Interactively” on page 140
“SPARC: How to Boot a System Over the Network” on page 142
“SPARC: How to Boot a System for Recovery Purposes” on page 143
“SPARC: How to Stop the System for Recovery Purposes” on page 145
“SPARC: How to Force a Crash Dump and Reboot the System” on page 146
“SPARC: How to Boot the System With the Kernel Debugger (kadb)” on page 147
For overview information about the boot process, see Chapter 12. For information on
troubleshooting booting problems, see “What to Do If Rebooting Fails” in System
Administration Guide, Volume
2.
For step-by-step instructions on booting an IA based system, see Chapter 11.
133

 

 

 

 

 

 

 

Content      ..     2      3      4      5     ..