Contained Within
Find More Documentation
Featured Support Resources
| Download this book in PDF
Boot Files
3
- This chapter contains the following sections:
-
- Booting is the process of starting your system when it is first switched on or when it is restarted after a halt or shutdown. This chapter describes the files used at boot time. See Administration Supplement for Solaris Platforms for details about the boot procedure and instructions for booting.
Kernel Modules Directory (/kernel)
- The SunOS kernel consists of a small static core and many dynamically loadable kernel modules. Many kernel modules are loaded automatically at boot time. Others, such as device drivers, are loaded in from disk as needed by the kernel.
- The following directories are in /kernel:
-
pluto% ls -l /kernel
total 1760
drwxr-xr-x 2 root sys 1536 Feb 5 16:32 drv
drwxr-xr-x 2 root sys 512 Feb 5 16:27 exec
drwxr-xr-x 2 root sys 512 Feb 5 16:27 fs
drwxr-xr-x 2 root sys 512 Feb 5 16:29 misc
drwxr-xr-x 2 root sys 512 Feb 5 16:27 sched
drwxr-xr-x 2 root sys 512 Feb 5 16:31 strmod
drwxr-xr-x 2 root sys 512 Feb 5 16:28 sys
-rwxr-xr-x 1 root sys 881644 Jan 17 19:36 unix
pluto%
|
- Drivers
- Executable types
- File system drivers
- Miscellaneous modules
- Scheduling classes STREAMS drivers
- System calls
- Operating system kernel
Kernel Configuration File (/etc/system)
- The boot program contains a list of default kernel modules to be loaded. You can use the /etc/system configuration file, which is read at boot time, to override the list of default modules.
- Use the /etc/system file to specify:
-
- Which modules are automatically loaded
- Which modules are not automatically loaded
- Root and swap types and devices
- Overrides for default values of any kernel integer variables
- See an example the default /etc/system file in Chapter 5, "Examining and Changing System Information."
The System Initialization File (/etc/inittab)
- When you boot your system or change run levels with the init command, the init daemon starts processes by using the information read from the entries in /etc/inittab. This file defines system initialization states (also called run levels). See "Init States" on page 18 for a discussion of init states.
- Each entry in the /etc/inittab file has the following fields:
-
id:runlevel:action:process
-
Table 3-1 describes the fields in an inittab entry.
-
Table 3-1 inittab
| Field | Description |
| id | A unique identifier |
| runlevel | The run level |
| action | How the process is to be run |
| process | The name of the command to execute |
- The following example shows an annotated default inittab file:
-
Code Example 3-1 The Default inittab File
-
ap::sysinit:/sbin/autopush -f /etc/iu.ap
fs::sysinit:/sbin/bcheckrc >/dev/console 2>&1 \
</dev/console
is:3:initdefault:
p3:s1234:powerfail:/sbin/shutdown -y -i0 -g0 >/dev/console 2>&1 \
</dev/console
s0:0:wait:/sbin/rc0 off >/dev/console 2>&1 \
</dev/console
s1:1:wait:/sbin/shutdown -y -iS -g0 >/dev/console 2>&1 \
</dev/console
s2:23:wait:/sbin/rc2 >/dev/console 2>&1 \
</dev/console
s3:3:wait:/sbin/rc3 >/dev/console 2>&1 \
</dev/console
s5:5:wait:/sbin/rc5 ask >/dev/console 2>&1 \
</dev/console
s6:6:wait:/sbin/rc6 reboot >/dev/console 2>&1 \
</dev/console
of:0:wait:/sbin/uadmin 2 0 >/dev/console 2>&1 \
</dev/console
fw:5:wait:/sbin/uadmin 2 2 >/dev/console 2>&1 \
</dev/console
RB:6:wait:/sbin/sh -c 'echo "\nThe system is being restarted."'\
>/dev/console 2>&1
|
- STREAMS module initialization
- File system check
- Default run level
- Power-fail shutdown
- Init 0 run level
- Init 1 run level
- Init 2 run level
- Init 3 run level
- Init 5 run level
- Init 6 run level
- Off
- Firmware
- Reboot
-
Code Example 3-1 The Default inittab File (Continued)
-
rb:6:wait:/sbin/uadmin 2 1 >/dev/console 2>&1 \
</dev/console
sc:234:respawn:/usr/lib/saf/sac -t 300
co:234:respawn:/usr/lib/saf/ttymon -g -h -p "'uname -n' \
console login: " -T sun -d /dev/console -l console \
-m ldterm,ttcompat
|
- Reboot single-user
- Service access controller
- Console
- When the system is first booted, init starts all processes labeled sysinit in the inittab file. The initdefault entry in /etc/inittab identifies the default run level. In this example, the default is run level 3 (multiuser mode with network file sharing). The init daemon runs each process associated with this run level (each entry that has a 3 in its rstate field). Each process is run using the entry from the action field. The action field can have one of the following values:
-
-
powerfail - The system has received a powerfail signal
-
wait - Wait for the command to be completed
-
respawn - Restart the command
- In this example, the commands executed at run level 3 are:
-
-
/usr/sbin/shutdown This command shuts down the system. init runs the shutdown command only if the system has received a powerfail signal.
-
/sbin/rc2 This command sets up the time zone, then starts the standard system processes, bringing the system up into run level 2 (multiuser mode).
-
/sbin/rc3 This command starts NFS.
-
/usr/lib/saf/sac -t 30 This command starts the port monitors and net access for UUCP.
-
/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: "
-
-
-T terminal_type -d /dev/console -l console
ttymon monitors the console for login requests.
- The /usr/lib/saf/sac and /usr/lib/saf/ttymon processes are respawned (restarted) if they are terminated for any reason.
Run Control Files
- The SunOS operating system provides a detailed series of run control (rc) scripts to control init state changes. Each run level (also called an init state) has an associated rc script located in the /sbin directory.
- The following run control scripts are 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.
-
saturn% ls /etc/rc2.d
K20lp S21perf S72inetsvc S89bdconfig
K60nfs.server S30sysid.net S73nfs.client S90xtl
K65nfs.client S47asppp S74autofs S91gsconfig
K92volmgt S69inet S74syslog S91gtconfig
README S70uucp S75cron S91leoconfig
S01MOUNTFSYS S71rpc S80PRESERVE S92rtvc-config
S05RMTMPFILES S71sysid.sys S80lp S92volmgt
S18setuname S72autoinstall S88sendmail S99audit
S20sysetup
saturn%
|
- Run control scripts are also located in the /etc/init.d directory. These files are linked to corresponding run control scripts in the /etc/rc*.d directories.
- The /etc/rcn.d scripts are always run in ASCII sort order. The scripts have names of the form:
- [K,S][0-9][0-9][A-Z][0-99]
- Files beginning with K are run to terminate (kill) some system process. Files beginning with S are run to start up a system process.
- The actions of each run control level script are summarized as follows.
-
The /sbin/rc0 Script
-
- Stops system services and daemons
- Terminates all running processes
- Unmounts all file systems
-
The /sbin/rc1 Script
-
- Runs the /etc/rc1.d scripts
· Stops system services and daemons
· Terminates all running processes
· Unmounts all file systems
· Brings the system up in single-user mode
-
pluto% ls /etc/rc1.d
K00ANNOUNCE K55syslog K67rpc K80nfs.client
K42audit K57sendmail K68autofs S01MOUNTFSYS
K47asppp K65nfs.server K70cron
pluto%
|
-
The /sbin/rc2 Script See the Administration Supplement for Solaris Platforms for information about scripts that are platform-specific.
-
- Sets the TIMEZONE variable
- Runs the /etc/rc2.d scripts
· Mounts all 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
· Creates device entries in /dev for new disks (only if boot -r is run)
· Prints system configuration (the default is not to save a core file)
· Configures system accounting
· Configures default router
· Sets NIS domain
· Sets ifconfig netmask
· Starts inetd
-
- Starts named, if appropriate
- Starts rpcbind
- 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
- Starts statd, lockd
- Mounts all NFS entries
- Starts automount
- Starts cron
- Starts the LP daemons
- Starts the sendmail daemon
-
saturn% ls /etc/rc2.d
K20lp S21perf S72inetsvc S89bdconfig
K60nfs.server S30sysid.net S73nfs.client S90xtl
K65nfs.client S47asppp S74autofs S91gsconfig
K92volmgt S69inet S74syslog S91gtconfig
README S70uucp S75cron S91leoconfig
S01MOUNTFSYS S71rpc S80PRESERVE S92rtvc-config
S05RMTMPFILES S71sysid.sys S80lp S92volmgt
S18setuname S72autoinstall S88sendmail S99audit
S20sysetup
saturn%
|
-
The /sbin/rc3 Script
-
-
saturn% ls /etc/rc3.d
README S15nfs.server
saturn%
|
-
The /sbin/rc5 Script
-
- Runs the /etc/rc0.d scripts
· Kills the printer daemons
· Unmounts local file systems
· Kills the syslog daemon
· Unmounts remote file systems
· Stops NFS services
· Stops NIS services
· Stops RPC services
· Stops cron services
· Stops NFS client services
- Kills all active processes
- Initiates an interactive boot
-
saturn% ls /etc/rc0.d
K00ANNOUNCE K47asppp K66nfs.server K75nfs.client
K20lp K55syslog K69autofs K85rpc
K42audit K57sendmail K70cron
saturn%
|
-
The /sbin/rc6 Script
-
- Runs /etc/rc0.d/K*
- Kills all active processes
- Unmounts the file systems
- Runs the initdefault entries in /etc/inittab
-
The /sbin/rcS Script
-
- Runs the /etc/rcS.d scripts to bring the system up to single user mode
· Establishes a minimal network
· Mounts /usr, if necessary
· Sets the system name
· Checks the / and /usr file systems
· Checks and mounts the /usr/kvm file system, if necessary
· Mounts pseudo file systems (/proc and /dev/fd)
· For reconfiguration boots, rebuilds the device entries
· Checks and mounts other file systems to be mounted in single user mode
-
saturn% ls /etc/rcS.d
README S40standardmounts.sh S60devlinks
S30rootusr.sh S50drvconfig S70buildmnttab.sh
saturn%
|
Using the Run Control Scripts to Stop or Start Services
- One advantage of individual scripts for each run control state is that you can run scripts in the /etc/init.d directory individually to turn off an area of functionality for a system without changing its run control level. For example, you can turn off NFS server functionality by typing /etc/init.d/nfs.server stop and pressing Return. After you have changed the system configuration, you can restart the functionality by typing /etc/init.d/nfs.server start and pressing Return.
Adding Scripts to the Run Control Directories
- If you add a script, put the script in the /etc/init.d directory and create a link to the appropriate rc*.d directory. Assign appropriate numbers and names to the new scripts so that they will be run in the proper sequence.
- If you rename a file and do not want the renamed file to be run, use a dot (.) at the beginning of the new file name. Files that begin with a dot are not executed. If you copy a file, adding a suffix to it, both files will be run.
- For example, if you want to change the K00ANNOUNCE script and save the original script, type:
-
# cp K00ANNOUNCE .K00ANNOUNCE
#
|
- If you copy K00ANNOUNCE to K00ANNOUNCE.old, for example, both K00ANNOUNCE and K00ANNOUNCE.old are run when the system is shutdown.
Understanding the Boot Messages File
- During the start-up process, messages are displayed. These messages report the results of the boot procedure, including information about what hardware is found in the system, the amount of memory available, and any problems encountered during the boot process. The information in these messages is stored in the /var/adm/messages file.
· How to Look at the Boot Messages
- The most recent boot messages are stored in the /var/adm/messages file. To see these messages after you have booted the system:
-
* Type /usr/sbin/dmesg and press Return. The boot messages are displayed.
- or
-
* Type more /var/adm/messages and press Return.
- See the Administration Supplement for Solaris Platforms for an example of the /var/adm/messages file.
|
|