#Linux Boot Process Explained!

A Thread 👇 PC: https://images.wallpapersden.com/
Every Linux Admin or DevOps Engineer should know what happens when a Linux system boots. It's a very popular Interview Question as well.
Every time you power on your Linux PC, it goes through a series of stages before finally displaying a login screen that prompts for your username or password.

There are 3 high level stages of a typical Linux boot process.
Stages -

1. BIOS Stage
2. Boot Loader Stage
3. Kernel Stage PC: https://www.golinuxcloud.com/
BIOS POST -

Once power is initially applied to the pc it runs the POST (Power On Self Test) that is a component of the BIOS (Basic I/O System).

POST is the part of BIOS whose task is to confirm that the pc hardware functioned properly. PC: https://www.lifewire.com/PC: https://www.golinuxcloud.com/
Bootloader Stage-

Once d POST is complete & d coast is clear, d BIOS probes d MBR (Master Boot Record) for d bootloader & disk partitioning info.
MBR is a 512-byte code dat is located on d 1st sector of d harddrive which is usually /dev/sda or hda depending on ur hard drive arch
There are 3 main types of bootloaders in Linux: LILO, GRUB, and GRUB2. The GRUB2 bootloader is the latest and primary bootloader in modern Linux distributions and informs our decision to leave out the other two which have become antiquated with the passage of time.
GRUB2 stands for GRand Unified Bootloader version 2. Once the BIOS locates the grub2 bootloader, it executes and loads it onto the main memory (RAM).

The grub2 menu allows you to do a couple of things. It allows you to select the Linux kernel version that you’d want to use. PC: https://www.tecmint.com/
GRUB parameterand their Meaning -

root->
use 3rd partition on the primary disk by setting it as (hd0,3)” in GRUB 2

kernel ->
use kernel located at “/vmlinuz” with kernel parameter: “root=/dev/hda3 ro“

initrd ->
use initrd/initramfs image located at “/initrd.img“
Kernel Stage -

Kernel is d core of any Linux system. It interfaces the PC’s hardware with d underlying processes. The kernel controls all d processes on your Linux system.

Kernels are present in /boot directory in a self-extracting, compressed format to save space. PC: https://www.golinuxcloud.com/
It is placed there along with an initial RAM disk image, and device maps of the hard drives.

After the selected kernel is loaded into memory it first extracts itself from the compressed version then loads systemd, and turns control over to it.
Starting Systemd -

The kernel finally loads Systemd, which is the replacement of the old SysV init. Systemd is the mother of all Linux processes and manages among other things mounting of file systems, starting and stopping services to mention just a few.
Systemd uses the /etc/systemd/system/default.target file to determine the state or target that the Linux system should boot into.

For a desktop workstation (with a GUI) the default target value is 5 which is the equivalent of run level 5 for the old SystemV init.
For a server, d default target is multi-user.target which corresponds to runlevel3 in SysV init

Here’s a breakdown of d systemd targets:
poweroff.target (runlevel 0): Poweroff /Shutdown d system
rescue.target (runlevel 1): launches a rescue shell session
multi-user.target (runlevel 2,3,4): Configures d system to a non-graphical (console) multi-user system.
graphical.target (runlevel 5): Set d system to use a graphical multi-user interface with nw services.
reboot.target (runlevel 6): reboots the system.
To check the current target on your system, run the command:

$ systemctl get-default
First, systemd mounts the filesystems as outlined by /etc/fstab, together with any swap files or partitions. At now, it will access the configuration files set in /etc, together with its own.

Systemd handles boot and services management processes using “targets”.
The very first target executed by systemd is /etc/systemd/system/default.target, to work out the state or target, into which it should boot the host. The default.target file is just a symbolic link to the actual target file.
Ref - TecMint/learnitguide/learningdevops/golinuxcloud
Retweet the thread if you liked it. Follow me for more such content.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Rakesh Jain

Rakesh Jain Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @devops_tech

29 Oct
Everything you need to know about Virtualization, VMs , Containers, Pods, Clusters ..

A Mega Thread 👇 PC: production-cci-com.imgix.net
What is Virtualization?

Virtualization is the act of dividing shared computational resources: CPU, RAM, Disk, and Networking into isolated resources that are unaware of the original shared scope. PC: cloud4y
What is a virtual machine?

A VM is a virtual env that functions as a virtual computer system with its own CPU, memory, nw interface, & storage, created on a physical hw system (located off- or on-prem).

It uses sw instead of a physical computer to run programs & deploy apps. PC: nakivo
Read 26 tweets
27 Oct
Traceroute: A computer Network Diagnostic Tool 🛠️

How does it work! 🤔

Ping works fine but not traceroute! 🤨

What are the stars in traceroute output! *⃣*⃣*⃣

#Linux #Networking

A Thread 👇 PC: n-able.com
What is traceroute ?

traceroute tracks the route packets take across an IP network on their way to a given host.

It assists you in troubleshooting nw connectivity issues from your Destination to a Remote destination by using echo packets (ICMP) to visually trace the route.
The syntax -

The cmd traceroute <x> (x here being an IP or hostname) is d most basic version & it will begin to send packets to d designated target. This result will allow u to trace d path of d packets sent from ur machine to each of d systems b/n u & ur desired destination.
Read 22 tweets
25 Oct
Cyber Security Basics!

#infosec

A Mega Thread 👇 PC: cyberoregon
What is Cyber Security?

Cybersecurity is a way of protecting the network, computers, and other electronic gadgets from cybercriminals. The Malicious attackers might delete, modify or leak confidential information posing a huge threat to a business or an individual. PC: abacustechnologies
What is Cyber Crime?

Here are some examples of Cyber Crime:

1. Identity Theft

2. Online Predators

3. BEC ("Business Email Compromise")

4. Ransomware

4. Stealing of sensitive intellectual property
Read 33 tweets
22 Oct
What is Kubernetes and How it works!

A Short Thread 👇👇 Image
Use case ->

You have created an application and want to share it with the world. Image
Docker comes into the picture to package the application. Image
Read 10 tweets
18 Oct
Securing Linux Servers!

Everything about Iptables - The Linux Firewall.

#infosec

A Mega Thread 👇
Iptables is a command-line firewall utility for Linux. It monitors traffic from & to ur server using tables.
These tables contain sets of rules, called chains, that will filter incoming & outgoing data packets. PC: linuxkamarada
When someone tries to establish connection to and from your system iptables immediately looks for a rule in its list to match it and If it doesn’t find a matching one, it resorts to the default action (either DROP or Accept).
Read 45 tweets
13 Oct
Copying files and directories remotely.

Keeping Linux files and directories in sync.

Everything about "rsync"

A Thread 👇
What Is Rsync?

Rsync, or Remote Sync, is a fast, versatile and free command-line tool that lets you transfer and sync files and directories to local and remote destinations in an efficient and secure way. .
Why use Rsync?

When copying or moving large no. of files using tools like cp and mv may leave ur data in inconsistent state with part of it still in the original location and part of it in the target destination in case of any interruptions.
Read 29 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Thank you for your support!

Follow Us on Twitter!

:(