Linux Booting Process steps – RHEL/CentOS 7
It is very important to know about Linux booting process of RHEL/CentOS 7 to troubleshoot the booting problem and understanding the Linux OS functionality. In this article, I’m going to explain about the Linux Operating system Booting process and its functionality. If you know the booting process of Linux it is easy to understand the operating system run level problems.
Systemd (/etc/systemd/) is the replacement of init (/sbin/init) process, The systemd system, and service manager is responsible for controlling how services are started, stopped and otherwise managed on Red Hat Enterprise Linux 7 systems. Although the systemd process replaces the init process (quite literally, /sbin/init is now a symbolic link to /usr/lib/systemd/systemd) for starting services at boot time and changing run levels in Linux 7, the systemd provides much more control than the init process and still it is supporting existing init scripts also.
Above stages are involved in Linux 7 booting process when the system start up.
BIOS – Basic Input/Output System is a firmware interface that controls not only booting process and also provides all the control of low-level interface to attached peripheral devices. When you power on your system, it will read all the devices settings and executes the POST (Power ON Self-Test) process to recognize the Hardware devices to test and initialize the system Hardware components. After successful POST process, it will load the MBR (Master Boot Record) for the further boot process.
2. MBR (Master Boot Record):
Master boot Record placed in the first sector of the Linux boot Hard Drive and this information pre-loads into ROM (Read Only Memory) by BIOS.
The MBR is only 512 bytes in size and it contains the machine code instructions for booting the Operating System, it’s called a boot loader, along with the partition table. Once the BIOS finds and loads the bootloader(GRUB2) program into (ROM) memory or Hard drive, it takes the control of the boot process to it. simply MBR (Master Boot Record) loads and executes the GRUB2 bootloader.
3. GRUB2 (Grand Unified Bootloader version2) Bootloader:
GRUB2 is the default bootloader program in all latest version of like Red Hat/CentOS 7 and also Ubuntu from version 9.10. It has been replaced by GRUB bootloader also known as GRUB legacy.
GRUB2 configuration file located in /boot/grub2/grub.cfg and It is automatically generated by grub2-mkconfig using templates from /etc/grub.d and settings from /etc/default/grub. Do not recommend to edit the GRUB2 configuration file.
The boot loader (GRUB2 for RHEL 7) starts the RHEL 7 kernel and initial RAM disk(initrd). GRUB 2 is installed in the boot sector of your server’s hard drive and is configured to load a Linux kernel and the initramfs and the initrd is an initial root file system that will mount prior to the real root file system on Linux system.
Linux Kernel is the central core of the OS and it is the first program loaded on the system starts up. While system starting kernel loads all the necessary Kernel Modules and Drives from initrd.img to load system first process systemd in Linux 7.
below command will help you find the systemd process id(PID)
|[[email protected] grub2]# ps -ef | grep systemd|
Systemd process is the first process ID (PID 1) to run on Linux 7 systems, it initializes the system and launches all the services that were once started by the traditional init(/etc/init.d) process. Systemd process reads the configuration file of /etc/systemd/system/default.target, then its load the OS in targeted runlevel.target.
This tells systemd to start everything in the /usr/lib/systemd/system/basic.target before starting the other multi-user services.
systemd uses ‘targets’ instead of runlevels. By default, there are two main targets:
multi-user.target: analogous to runlevel 3
graphical.target: analogous to runlevel 5
To view current default target, run:
|[[email protected] ~]# systemctl get-default|
To set a default target, run: ex: systemctl set-default TARGET.target
|[[email protected] ~]# systemctl set-default graphical.target|
Target List in Red Hat Linux 7.
runlevel0.target -> poweroff.target
runlevel1.target -> rescue.target
runlevel2.target -> multi-user.target
runlevel3.target -> multi-user.target
runlevel4.target -> multi-user.target
runlevel5.target -> graphical.target
runlevel6.target -> reboot.target
Conclusion: This is all about Linux Booting Process in Red Hat 7 and we have lot articles are available outside, but I made this guide to know about the latest changes happens in the Linux Booting Process. I hope it will helpful to understand Linux Booting Process in the latest version of Linux 7.
Recommended Read: How to configure hostname in Redhat /CentOS 7 Linux