Skip to main content

Linux boot process

 


Every system administrator needs to understand the boot process on the OS in order to troubleshoot effectively.


>BIOS- basic input output setting(firmware interface)

POST: power on self test


>MBR is loaded: master boot record


Information saved in the first sector of the hard disk that indicates where GRUB2 is located so it can be loaded in the computer RAM.


>GRUB2 is loaded: grand unified boot loader v2. loads the linux kernel: /boot/grub2/grub.cfg


> Kernel is loaded: core of the OS.

 loads the required drivers from the initrd.img, starts the first OS process.


> systemd process is started: System daemon (PID=1)

It then starts all the required processes. It reads /etc/systemd/system/default.target to bring the system to run-level. Total 7 run levels we have. 


*************************************


How to reboot/shutdown:


power off the system:


# systemctl poweroff = stops all the running services, unmount all the filesystems. and then power off the system.


# systemctl reboot = stops all the running services, unmounts all the filesystems, and then reboots the system.


or we can use the shorter versions of these commands:


#shutdown: poweroff the server

#reboot: reboot the system.

#poweroff: poweroff the system.


**************************************



Selecting the Systemd Target:


>systemd is the first linux process which decides at which run level the operating system needs to be in. 


These run levels are now referred to as targets.

following are the most important targets:


>graphical target: system supports multiple users, graphical and text based logins

>multi-user target :system supports multiple user text based logins only 

>rescue target: sulogin prompt, bash system initialization completed .

>emergency target :sulogin prompt initramfs pivot complete and system root mounted on /read only



To check the current target or run level

#systemctl get-default



To check the current run level

#who-r



A target can be the part of another target eg the graphical target includes multi- user target, which in turn depends on basic taget and others


we can view these dependencies with the following command .

#systemctl  list-dependencies  graphical.target | grep target



you can display the new run levels/target by issuing the following command:

#ls  -l  /lib/systemd/system/runlevel*



how to change the run level /target ?

#systemctl set-default graphical.target


*************************************


How to recover the root password?

steps given below:


• Restart your computer.


• Edit the grub


•change password


•reboot


***********************************


Repair Filesystem Corruption


Filesystem corruption can occur when you either make mistakes in /etc configuration files. 

or filesystem become corrupted at the disk level.


In either of the above cases the systemd will not be able to boot the system in the defined

target and bring the system in the emergency mode.


*****************************************


The following are the problems related to filesystem and its results:


>Corrupt filesystem: systemd attempts to repair the filesystem. If the problem is too sever for the automatic fix, the system drops the user to an emergency shell.


> Non consistent device or UUID referrenced in /etc/fstab: systemd waits for set amount of time, waiting for the device to become available. If the device does not become available, the system drops the user to an emergency shell after the time out


> Non existent mount point in /etc/fstab :system drops the user to an emergency shell.


>Incorrect mount options specified in /etc/fstab: system drops the user to an emergency shell.


*************************************


In any case administrators can use the emergency target to diagnose and fix the issue. because no file systems are mounted before the emergency shell is displayed.


When using the emergency shell to fix the filesystem issues, do not forget to run systemctl daemon-reload after editing /etc/fstab. Without this reload. systemd may continue using the old version.


Comments

Popular posts from this blog

Post build configurations on Redhat VM

  ************************************* Post build configuration on Linux VM: ************************************* Set the hostname. hostnamectl set-hostname <Servername> ***************************************** Network configuration : Make sure VM gets the ipv4 ip address either from DHCP or assign the static ip address to it.   Question : How to assign the static ip address to the linux machine using the nmcli ?  Answer: fire the below commands: nmcli device nmcli connection modify enpos3 ipv4.addresses 10.253.1.34/24 nmcli connection modify enpos3 ipv4.gateway 10.253.1.1 nmcli connection modify enpos3 ipv4.method manual nmcli connection modify enpos3 ipv4.dns 8.8.8.8 nmli connection down enpos3 nmcli connection up enpos3 ip address show enpos3 nmcli connection show ************************†****************** Register to RHΝ. Register to redhat network if the linux vm is redhat vm. subscription-manager register --org <org>  --activationkey <activat...

AWS cloud practitioner notes

 AWS Certified cloud practitioner: What is cloud computing? cloud computing is the on demand delivery of the compute power, database storage, applications and other IT resources through a cloud services platform with pay-as-you-go pricing. you can provision exactly the right type and size of the computing resources you need. you can access many resources as you need almost instantly like servers, storage,databases and application services as well. Amazon web services owns and maintains the network connected hardware required for these application services, while you provision and use what you need via a web application. ***************************************** Deployment models of Cloud: Private Cloud: Cloud service used by a single organisation, not exposed to the public. complete control. security of the sensitive applications meeting specific business needs. ********************** Public Cloud: Cloud resources owned and operated by the third party. cloud service provider delive...