init Flashcards
\init
initialization
The version of init that has been used in Linux systems is based off of the System V init system that was originally used in UNIX systems and a downside to the classic init system
is that services are started up 1 after the other. This was meant to keep things simple, but the problem arose when a particular service or function was not yet ready which could hang the system, preventing other services from starting.
sysvinit
after a Linux kernel loads up and it brings in the initial RAM disk, it then seeks out an initialization system to hand over control of the computer.
init system
The first place that the kernel looks for is and once this program is located, the kernel starts it so at this point, the init program is in control.
/sbin/init
read the configuration settings in /etc/inittab to determine what runlevel the system should be operating in.
first step of init
Linux standards base version 4.1 - basically just a predefined configuration that the computer will operate within. Each runlevel starts and/or stops scripts for various services depending on how the system should be set up. The system can only operate in 1 runlevel at a time.
runlevel
is the halt or shutdown level and is when init run scripts that stop services and powers off the system.
Runlevel 0
single user mode level typically in this setup, the root user is the only user allowed to log into the system as this level is primarily used for maintenance task and repair functionality.
Runlevel 1
is for multiple users to log in but without any network interfaces brought up nor are there any remote file systems mounted.
Runlevel 2
is the same as runlevel 2 except that networking is also available.Historically, most Linux servers were set up to run at this level by default.
Runlevel 3
is typically not used but it is available should an administrator want to set up a custom runlevel environment.
Runlevel 4
is the same as runlevel 3 but with a graphical desktop running as well. Older Linux workstations with desktop environments were set up to run in level 5 by default.
Runlevel 5
is the reboot runlevel. This is where init stops services and restarts the system, going back through the complete computer boot up sequence once again.
runlevel 6
group of fields divided by a colon
inittab file
identifier for this line. In the case of this example, we have ID as shorthand for init default.
inittab first field
The next field indicates what runlevel applies to this line. In this case, only runlevel 3 is used in this line.
inittab second field
contains the action that this line corresponds to. There are predefined actions that init understands. In this line we have initdefault
which specifies that after the system boots, it will enter the runlevel as indicated on this line.
inittab third field
shows what process to execute with this line. As you can see here, this process field is empty. Since this line is where the init default action, there is no process to act on as this tells init what runlevel to start the system in.
inittab final field
The runlevel field on this line is empty though. We will explain that in a moment The action field specifies sysinit meaning that when the system boots up, anything in the process field, which in our case is the script located at etc/rc.d/rc.sysinit will be ran. Since this applies to when the computer first boots up, runlevels do not apply here as this as a startup script that applies to the computer as a whole. Hence the reason why the runlevel field on this line is empty.
sysinit short for SI
In this configuration, each runlevel begins with the letter L followed by the runlevel number this line corresponds to.
operating runlevel
The wait action will start the process specified; in this case the scripts associated with a particular runlevel, once the runlevel has been entered. Init will then wait until the process has been terminated. The default runlevel for this configuration is 3
runlevel itself.
First, the boot disk is found by the boot loader.
Then the kernel and the initial RAM disk are both loaded. Then some drivers and set up tools are pulled out of the RAM disk to get things started. Then the kernel then hands the control of the system over to init
CentOS 5 system
Init has read the etc/inittab file
performing task from the /etc/rc.d/rc.sysinit script. And now init enters runlevel 3 and starts up the scripts located in that directory. And now the system is ready for use.
are on etc/rc.d and on Debian-based systems, they’re located in etc/init.d.
Red Hat-based Linux distributions
acronym for run commands.
RC
The RC0 to RC6 directories
all pertain to particular runlevels.
For example, rc0.d is a directory for runlevel 0.
RC1.D is for runlevel 1 and so on.
This is the script that does some house cleaning before we actually enter our runlevel as defined in the inittab file.
rc.sysinit script
ran after the runlevel has completely loaded. This file is usually customized by the system administrator to start up extra services or tasks that do not have their own init scripts.
The rc.local script
contains all of the original script files for the services on a system.
etc/init.d directory
contains symbolic links back to these scripts, each named a certain way so that init knows to either stop or start the script specified.
The runlevel directories
the conductor of the runlevel orchestra. This script is executed when a runlevel is entered and fires off the scripts based on the runlevel that the system is changing into.
etc/init.d/rc script
indicate that these are services that are to be killed
symlinks with K
and the letter S indicating that these scripts are to be started.
symlinks with S
after the letters indicate the numerical order in which the scripts are to be killed and started.
symlink numbers