%------------------------------------------------------------------------
\chapter{\cmd{init} (DRAFT)}
\label{ch:init}
%------------------------------------------------------------------------

	\noindent
	This chapter describes the \cmd{init} process, which is
	the first user level process started by the kernel.  \cmd{init}
	has many important duties, such as starting \cmd{getty} (so that
	users can log in), administering run levels, and taking care
	of orphaned processes.  This chapter explains how \cmd{init}
	is configured and how you can make use of the different run
	levels.
	
	\index{init|see{/sbin/init}}
	\index{daemons!init|see{/sbin/init}}
	\index{/sbin/init}
	
\section{\cmd{init} comes first}

	- init is the first process
	- init has many duties:
	
		- it runs the bootup scripts (/etc/rc.d/* or /etc/rc?.d/*)
		- it keeps track of the current run level, and starts and
		  stops services when the run level is changed
		- it starts gettys so that people can log in; and then
		  restarts the getty after they log out
		- adopts orphan processes (important to understand, so
		  that you can interpret process listings if you must,
		  but not anything you need to do anything about)
		  
\section{Run levels}

	- what is a run level?
	- typical sysvinit's run levels
		- 0 = halt
		- 1 = single user
		- 2-5 = multi user (services depend on local config)
			- example:
			- 2 = networking enable, text console
			- 3-5 = 2 + xdm
		- 6 = reboot
		- you seldom need more
	- changing run level: telinit
	- configuring run levels: /etc/rc?.d
		
\section{Configuring \cmd{init}: the \fn{/etc/inittab} file}

	- init config file: /etc/inittab
	- general syntax
	- starting gettys
	- special actions
		- c-a-d
		- power failure (requires UPS support)
		- single user mode
		- bootup
		- setting the default run level

\section{Booting in single user mode}

	- kernel argument: single (emergency?)
	- system maintenance, emergency repair
	- security: password can be required (sulogin)
	
