Saturday, December 19, 2020

From GRUB 2 to Login Process

Here is the basic overview of the boot process after the GRUB 2 bootloader finds the kernel.  The messages associated with the kernel provide a step-by-step view of the process.

The loading of Linux depends on a temporary filesystem, known as the initial RAM disk.
Once the boot process is complete, control is given to systemd, known as the first process.

In here we will describe the contents of systemd in detail, through the configuration of units and targets.

Note:
Most of Linux distros have replaced Upstart and SysVinit with the new systemd service manager.

Kernels and the Initial RAM Disk

After you select a kernel from the GRUB 2 configuration menu, Linux hands over boot responsibilities to the kernel with the help of the initial RAM disk, also known by its filename in the /boot directory, initramfs.
During the boot process, Linux loads that initramfs into your RAM.  Linux then loads hardware drivers and starts the first process, systemd.
Next, systemd activates all the system units for the initrd.target and mounts the root filesystem under /sysroot
Finally systemd restarts itself in the new root directory and activates all units for the default target.

To learn more, after logging in, you can review these messages in the /var/log/dmesg file or by running the dmesg command.


The First Process, Targets, and Units
Kernel continues the boot process by calling the 1st process, systemd.  In RHEL 7, the legacy init process is configured with a symbolic link to systemd.
Units are the basic building blocks of systemd.  The most common are service units, which have a .service extension and activate a system service.
The following command will show a list of all service units:
    # systemctl list-units --type=service --all

The example command below shows sshd services:
    # systemctl list-units --type=service --all | egrep -i sshd






No comments:

Post a Comment