13.6 Init: Process Control Initialization

Once the kernel has finished booting, it passes control to the user process init(8), which is located at /sbin/init, or the program path specified in the init_path variable in loader.

13.6.1 Automatic Reboot Sequence

The automatic reboot sequence makes sure that the file systems available on the system are consistent. If they are not, and fsck(8) cannot fix the inconsistencies of a UFS file system, init(8) drops the system into single-user mode so that the system administrator can resolve the problem directly.

13.6.2 Single-User Mode

This mode can be reached through the automatic reboot sequence, the user booting with -s, or by setting the boot_single variable in loader.

It can also be reached by calling shutdown(8) from multi-user mode without including -r or -h.

If the system console is set to insecure in /etc/ttys, the system will prompt for the root password before initiating single-user mode.

Example 13-3. An Insecure Console in /etc/ttys

# name  getty                           type    status          comments
#
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none                            unknown off insecure

Note: An insecure console means that physical security to the console is considered to be insecure, so only someone who knows the root password may use single-user mode. Thus, to add this measure of security, choose insecure, instead of the default of secure.

13.6.3 Multi-User Mode

If init(8) finds the file systems to be in order, or once the user has finished their commands in single-user mode, the system enters multi-user mode, in which it starts the resource configuration of the system.

13.6.3.1 Resource Configuration (rc)

The resource configuration system reads in configuration defaults from /etc/defaults/rc.conf, and system-specific details from /etc/rc.conf, and then proceeds to mount the system file systems listed in /etc/fstab. It starts up networking services, miscellaneous system daemons, then the startup scripts of locally installed packages.

To learn more about the resource configuration system, refer to rc(8) and examine the scripts themselves.