Thursday, November 12, 2009

Sun INIT States

Sun init States

Solaris init states refer to the level of services provided by the system. The exact services and processes run at each init level are determined by the scripts in the /etc/rc#.d directories. The default service levels for each init state are listed below:

* 0: The system is at the PROM monitor (ok>) or security monitor (>) prompt. It is safe to shut down the system when it is at this init state.
* 1, s or S: This state is known as "single-user" or "system administrator" mode. Root is the only user on the system, and only basic kernel functions are enabled. A limited number of filesystems (usually only root and /usr) are mounted. This init state is often used for sensitive functions (such as kernel libc patches) or while troubleshooting a problem that is keeping the system from booting into multiuser mode.
* 2: Multiple users can log in. Most system services (except for NFS server and printer resource sharing) are enabled.
* 3: Normal operating state. NFS and printer sharing is enabled, where appropriate.
* 4: Usually undefined.
* 5: Associated with the boot -a command. The system is taken to init 0 and an interactive boot is started.
* 6: Reboot. This state takes the system to init state 0 and then to the default init state (usually 3, but can be redefined in the /etc/inittab file).

The init states are defined in the /etc/inittab file, which usually points at the scripts in /sbin/rcrun-level. These scripts in turn examine the contents of the /etc/rcrun-level directories. The scripts in these directories whose names begin with the letter K are run in "stop" mode first in alphabetical order. Then the scripts whose names begin with the letter S are run in "start" mode in alphabetical order.

To get to a desired run level n, each of the rc (run control) scripts from 1 to n is run. To get to run level 0, the K scripts are run in each rc#.d directory between the current run level and 0 in reverse numerical order.

In the default configuration, the rc scripts accomplish the following tasks:

* /sbin/rc0
o Stop system services/daemons.
o Terminate running processes.
o Unmount all file systems.
* /sbin/rc1
o Stop system services/daemons.
o Terminate running processes.
o Unmount all file systems.
o Bring up the system in single-user mode.
* /sbin/rc2
o Set the TIMEZONE variable.
o Stop the print and NFS services.
o Stop the vold daemon.
o Mount local filesystems, enable disk quotas (as appropriate).
o Remove temporary files.
o Create new device entries if this is the result of a boot -r.
o Save a core file if enabled.
o Configure system accounting, (as appropriate).
o Set the default router.
o Set the NIS domain.
o Set up the network interfaces appropriately.
o Start inetd.
o Start named, if appopriate.
o Start rpcbind.
o Start kerbd (the Kerberos client daemon) if appropriate.
o Start ypbind or rpc.nisd as appropriate.
o Start keyserv.
o Start statd and lockd.
o Mount NFS filesystems from /etc/vfstab.
o Start the automounter.
o Start cron.
o Start lp daemons, as appropriate.
o Start sendmail.
* /sbin/rc3
o Clean up sharetab.
o Start nfsd and mountd.
o Start rarpd and rpc.bootparamd, as appropriate.
* /sbin/rc4 is usually not defined. It can be used in a non-default configuration to achieve a tailored run level.
* /sbin/rc5
o Kill print daemons.
o Unmount local file systems.
o Kill syslogd.
o Unmount NFS file systems.
o Stop NFS services.
o Stop NIS services.
o Stop RPC services.
o Stop cron services.
o Stop statd and lockd (NFS client services).
o Kill active processes.
o Initiate an interactive boot.
* /sbin/rc6
o Stop system services/daemons.
o Terminate running processes.
o Unmount all file systems.
o Boots to the initdefault level from the /etc/inittab
* /sbin/rcS: This run level differs from 1 in the following particulars:
o Minimal network is established.
o System name is set.
o root, /usr and /usr/kvm filesystems are checked and mounted (if necessary).
o Pseudo file systems proc and /dev/ are started.
o Rebuilds device entries (for reconfiguration reboots only).

Readers who read this page, also read:

Bookmark and Share My Zimbio