SysV Init Overview
SysV init (System V initialization) is one of the traditional init systems used to manage the startup and shutdown of a Unix-like operating system. It relies on configuration files, scripts, and utilities to control the boot process, system services, and runlevels. Three key components in SysV init systems are the /etc/inittab
file, the init
command, and the telinit
command.
/etc/inittab
The /etc/inittab
file is the primary configuration file for the SysV init system. It defines the default runlevel, system initialization scripts, and how the system should handle certain key sequences.
Structure of /etc/inittab
/etc/inittab
The file consists of lines with the following format:
id: A unique identifier for the entry.
runlevels: The runlevels for which the entry is valid (e.g.,
12345
).action: Specifies what action to take (e.g.,
respawn
,wait
,once
).process: The command or script to execute.
Example /etc/inittab
/etc/inittab
init Command
The init
command is the parent of all processes on the system. It is the first process started by the kernel during the boot process and remains running until the system is shut down. The init process reads the /etc/inittab
file to determine the default runlevel and other startup instructions.
Common init
Usage
init
UsageChange Runlevel: The
init
command can be used to change the current runlevel.
telinit Command
The telinit
command is a symbolic link to the init
command and is used to communicate with the init process to change runlevels or instruct it to perform other actions.
Common telinit
Usage
telinit
UsageChange Runlevel: The
telinit
command can be used similarly toinit
to change the runlevel.Re-examine /etc/inittab: Instruct init to re-read the
/etc/inittab
file.
Runlevels
Runlevels are predefined states that define what system services are running. Traditional SysV runlevels include:
0: Halt the system.
1: Single-user mode.
2-5: Multi-user modes (distribution-specific).
6: Reboot the system.
Different distributions may have specific uses for each runlevel, but typically:
Runlevel 3: Multi-user mode with text login.
Runlevel 5: Multi-user mode with graphical login (GUI).
Conclusion
Understanding /etc/inittab
, init
, and telinit
is essential for managing systems using SysV init. These components work together to define how a system starts, which services are running, and how the system responds to changes in runlevels. While many modern distributions have moved to systemd
, knowing SysV init remains valuable for working with older or certain enterprise systems.
Last updated