SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Linux Booting Procedure
Rishabh Jain
Associative Engineer
C-DAC Bangalore
2
How Linux boot?
3
How computer startup?
 Booting is a process that starts
operating systems when the user
turns on a computer system
 A boot sequence is the set of
operations the computer performs
when it is switched on that load an
operating system
4
Booting sequence
1. Turn on
2. CPU jump to address of BIOS (0xFFFF0)
3. BIOS runs POST (Power-On Self Test)
4. Find boot able devices
5. Loads and execute boot sector form MBR
6. Load OS
5
BIOS (Basic Input/Output System)
 BIOS refers to the software code run by a computer
when first powered on
 The primary function of BIOS is code program
embedded on a chip that recognizes and controls
various devices that make up the computer.
 Activate on board Hardware(Sound Card,Ethernet Card)
 Then call MBR
BIOS on board
BIOS on screen
6
MBR (Master Boot Record)
 OS is booted from a hard disk, where the
Master Boot Record (MBR) contains the
primary boot loader
 The MBR is a 512-byte sector, located in
the first sector on the disk (sector 1 of
cylinder 0, head 0)
 After the MBR is loaded into RAM, the
BIOS yields control to it.
 Contain Boot Loader and Partition
Information
7
MBR (Master Boot Record)
8
MBR (Master Boot Record)
 The first 446 bytes are the primary boot
loader, which contains both executable
code and error message text
 The next sixty-four bytes are the partition
table, which contains a record for each of
four partitions
 The MBR ends with two bytes that are
defined as the magic number (0xAA55).
The magic number serves as a validation
check of the MBR
9
Boot loader
 Boot loader could be more aptly called the
kernel loader. The task at this stage is to
load the Linux kernel
 Optional, initial RAM disk
 GRUB,GRUB2 and LILO are the most
popular Linux boot loader.
10
Other boot loader (Several OS)
 bootman
 GRUB
 LILO
 NTLDR
 XOSL
 BootX
 loadlin
 Gujin
 Boot Camp
 Syslinux
 GAG
11
Commonly used Boot Loader
Boot Loader
GRUB
Legacy
LILO
GRUB 2
Advantage of GRUB2
over GRUB Legacy

New Configration file
structure

Dynamic module Loading

Theme

Graphical boot menu
Support

Internationalization
include support for non-
ASCII
12
Configration of GRUB and GRUB2
Vi /boot/menu.list
Grub-update
Grub-install
GRUB GRUB2

Vim
/etc/grub2*/grub.cfg

Grub-mkconfig -o
/boot/grub2/grub.cfg
13
Example GRUB config file
14
Changing of GRUB2 file.
15
GRUB and initrd
1. The BIOS finds a bootable device (hard disk) and
transfers control to the master boot record
2. The MBR contains GRUB
3. GRUB can access the Hard Drive
4. It launch the initrd and Kernel.
5. Initrd is initial RAM disk.
6. Initrd is mini sql of file system.
7. Mainly maintain the room file system.
8. Initrd is problem solver of Kitchen Sink.
9. Passes control on to the kernel which mount into Hard
Drive.
Kernel
17
Kernel image
 The kernel is the central part in most computer
operating systems because of its task, which is
the management of the system's resources and
the communication between hardware and
software components
 Kernel is always store on memory until computer
is turn off
 Kernel image is not an executable kernel, but a
compress kernel image
 zImage size less than 512 KB
 bzImage size greater than 512 KB
18
Task of kernel
 Process management
 Memory management
 Device management
 System call
19
Init process
 The first thing the kernel does is to
execute Init program
 The init process have the process ID 1.
 Init is the root/parent of all processes
executing on Linux
 Based on the appropriate run-level,
scripts are executed to start various
processes to run the system and make it
functional
20
Init Process
We can find
the PID of
any process
using
command ps
-ax.
Here it show
that init
process with
pid 1.
21
Type of Init system.
Init system
Systemd Upstart
SystemV
Traditional
Method
Fedora 15
Ubutu<15.0
Fedora9-14
Red hat Linux 6
22
Traditional Init (SystemV)
 First file reader by in init process in inttab.
 Second file /etc/fstab which mount partition
accordingly
 /etc/init.fd lauches all the services and scripts
according to runlevel
 Shutdown work pretty much in reverse fashion
23
Inittab file
 The inittab file describes which processes
are started at bootup and during normal
operation
 /etc/init.d/boot
 /etc/init.d/rc
 The computer will be booted to the
runlevel as defined by the initdefault
directive in the /etc/inittab file
 id:5:initdefault:
24
Runlevels
 A runlevel is a software
configuration of the system which
allows only a selected group of
processes to exist
 The processes spawned by init for
each of these runlevels are defined
in the /etc/inittab file
 Init can be in one of eight runlevels:
0-6
25
Runlevels
Runlev
el
Scripts
Directory
State
0 /etc/rc.d/rc0.d/ shutdown/halt system
1 /etc/rc.d/rc1.d/ Single user mode
2 /etc/rc.d/rc2.d/ Multiuser with no network services exported
3 /etc/rc.d/rc3.d/ Default text/console only start. Full multiuser
4 /etc/rc.d/rc4.d/
Reserved for local use. Also X-windows (Slackware/
BSD)
5 /etc/rc.d/rc5.d/ XDM X-windows GUI mode (Redhat/System V)
6 /etc/rc.d/rc6.d/ Reboot
s or S Single user/Maintenance mode (Slackware)
M Multiuser mode (Slackware)
26
Runlevel more Information
Run Level have two flags.
k=kill
s=start
Shutdown all symlinks have k link except
halt.
27
This shutdown Runlevel rc6.d
28
Disadvantage of SystemV
Major drawback of SysV is that this work serially
Taking more memory
The need to replace init with something more
perfect was felt from a long time and several
alternatives were developed from time-to-time,
some of which became distribution’s native init
replacement, some of which are:
Upstart – A init replacement daemon implemented in
Ubuntu GNU/Linux and designed to start process
asynchronously.
29
Systemd
Systemd is new and efficent way for
booting process
It boot the system in parallel way.
The process which have no dependency
can be parallelized by the Systemd.
Systemd handles boot and service
managment process using target
First Target executed is default.target like
in systemv inittab is called
Default.target is symlink, it means that
like short cut in windows
30
Systemd(continue)
According to runlevel which is set
in default.target is called
You can change runlevel to boot
by using
ln -sf
/usr/lib/systemd/system/multi-
user.target
/etc/systemd/system/default.target
31
Systemd
Systemd call default and default can call any of target like
graphical.target.wants
These are some folder and symlink of systemd
Sysinit start important system service like system mounting,
swaping space and device.
32
Process in default init.d
33
Alternative ways to start process.
In CentOS there is facility called
start up.
Just add your process and
application in that menu.
Reboot the system and you
application automatically get
started.
34
Pratical way to adding your
process into as start-up process.
Go to cd /etc/init.d or /etc/rc.local.
You can add your script there
Then add symoblic link in
cd /etc/rc.d/rc[1....6].d in the
runlevel.
When system get started it will run
all the symbolic links and call the
scripts kept in rc.d Directory.
As mention earlier you can also do
it by adding your process in start-up
35
Importance of BASH and other
shell scripting.
As you can see from the diagram
above, the shell is not part of the
kernel, but it does communicate
directly with the kernel. It is the
"shell around the kernel."
36
Shell
We cannot remove shell services
like bash.
Our application use the shell
service to communicate with kernel.
So we cannot stop shell service
because our service also get
stopped due to this.
37
How to Disable the Terminal.
We can not Remove shell but we
can disable terminal, so that no
one can access it.
We can disable terminal and panel
in two ways.

Through command line.

Through GUI remove and disable.
38
Different way for disabling the
terminal.
The terminal we use in GNOME
environment is GNOME terminal.
We can get location GNOME
ls ~/.gconf/apps, and delete the
terminal configration.
There is more simpler way for
doing this ie using GUI, just go to
remove and add menu and search
for GNOME terminal, uncheck it
39
Linux files structure
41
Linux files structure
http://www.secguru.com/files/linux_file_structure
42
FSSTND : (Filesystem standard)
 All directories are grouped under the root
entry "/"
 root - The home directory for the root
user
 home - Contains the user's home
directories along with directories for
services
 ftp
 HTTP
 samba
43
FSSTND : (Filesystem standard)
 bin - Commands needed during booting
up that might be needed by normal users
 sbin - Like bin but commands are not
intended for normal users. Commands run
by LINUX.
 proc - This filesystem is not on a disk. It
is a virtual filesystem that exists in the
kernels imagination which is memory
 1 - A directory with info about process number
1. Each process has a directory below proc.
44
FSSTND : (Filesystem standard)
 usr - Contains all commands, libraries, man pages,
games and static files for normal operation.
 bin - Almost all user commands. some commands are in /bin
or /usr/local/bin.
 sbin - System admin commands not needed on the root
filesystem. e.g., most server programs.
 include - Header files for the C programming language.
Should be below /user/lib for consistency.
 lib - Unchanging data files for programs and subsystems
 local - The place for locally installed software and other files.
 man - Manual pages
 info - Info documents
 doc - Documentation
 tmp
 X11R6 - The X windows system files. There is a directory
similar to usr below this directory.
 X386 - Like X11R6 but for X11 release 5
45
FSSTND : (Filesystem standard)
 boot - Files used by the bootstrap loader, LILO.
Kernel images are often kept here.
 lib - Shared libraries needed by the programs on
the root filesystem
 modules - Loadable kernel modules, especially
those needed to boot the system after disasters.
 dev - Device files
 etc - Configuration files specific to the machine.
 skel - When a home directory is created it is
initialized with files from this directory
 sysconfig - Files that configure the linux system
for devices.
46
FSSTND : (Filesystem standard)
 var - Contains files that change for mail, news,
printers log files, man pages, temp files
 file
 lib - Files that change while the system is running normally
 local - Variable data for programs installed in /usr/local.
 lock - Lock files. Used by a program to indicate it is using a
particular device or file
 log - Log files from programs such as login and syslog which
logs all logins and logouts.
 run - Files that contain information about the system that is
valid until the system is next booted
 spool - Directories for mail, printer spools, news and other
spooled work.
 tmp - Temporary files that are large or need to exist for
longer than they should in /tmp.
 catman - A cache for man pages that are formatted on
demand
47
FSSTND : (Filesystem standard)
 mnt - Mount points for temporary
mounts by the system
administrator.
 tmp - Temporary files. Programs
running after bootup should use
/var/tmp
48
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot processHari Shankar
 
Linux internal
Linux internalLinux internal
Linux internalmcganesh
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and outputSanidhya Chugh
 
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBshimosawa
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Toursamrat das
 
Step for installing linux server
Step for installing linux serverStep for installing linux server
Step for installing linux serversyed mehdi raza
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsQUONTRASOLUTIONS
 
An Insight into the Linux Booting Process
An Insight into the Linux Booting ProcessAn Insight into the Linux Booting Process
An Insight into the Linux Booting ProcessHardeep Bhurji
 

Was ist angesagt? (20)

Processes
ProcessesProcesses
Processes
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
Linux Booting Steps
Linux Booting StepsLinux Booting Steps
Linux Booting Steps
 
Linux internal
Linux internalLinux internal
Linux internal
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and output
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Linux File System
Linux File SystemLinux File System
Linux File System
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Tour
 
Step for installing linux server
Step for installing linux serverStep for installing linux server
Step for installing linux server
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
An Insight into the Linux Booting Process
An Insight into the Linux Booting ProcessAn Insight into the Linux Booting Process
An Insight into the Linux Booting Process
 

Ähnlich wie Linux Booting Procedure Explained in Detail

Ähnlich wie Linux Booting Procedure Explained in Detail (20)

Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
 
Linux startup
Linux startupLinux startup
Linux startup
 
Bootloader and bootloading
Bootloader and bootloadingBootloader and bootloading
Bootloader and bootloading
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
Linux boot process – explained
Linux boot process – explainedLinux boot process – explained
Linux boot process – explained
 
Linux admin course
Linux admin courseLinux admin course
Linux admin course
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut ii
 
Ch04 system administration
Ch04 system administration Ch04 system administration
Ch04 system administration
 
Ch04
Ch04Ch04
Ch04
 
Linux basics
Linux basics Linux basics
Linux basics
 
Linux basics
Linux basics Linux basics
Linux basics
 
Introduction to Operating Systems.pptx
Introduction to Operating Systems.pptxIntroduction to Operating Systems.pptx
Introduction to Operating Systems.pptx
 
1.2 boot the system v2
1.2 boot the system v21.2 boot the system v2
1.2 boot the system v2
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
Unix Administration 2
Unix Administration 2Unix Administration 2
Unix Administration 2
 
Order of boot process in Linux
Order of boot process in LinuxOrder of boot process in Linux
Order of boot process in Linux
 
Know thyubuntu
Know thyubuntuKnow thyubuntu
Know thyubuntu
 

Kürzlich hochgeladen

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Linux Booting Procedure Explained in Detail

  • 1. Linux Booting Procedure Rishabh Jain Associative Engineer C-DAC Bangalore
  • 3. 3 How computer startup?  Booting is a process that starts operating systems when the user turns on a computer system  A boot sequence is the set of operations the computer performs when it is switched on that load an operating system
  • 4. 4 Booting sequence 1. Turn on 2. CPU jump to address of BIOS (0xFFFF0) 3. BIOS runs POST (Power-On Self Test) 4. Find boot able devices 5. Loads and execute boot sector form MBR 6. Load OS
  • 5. 5 BIOS (Basic Input/Output System)  BIOS refers to the software code run by a computer when first powered on  The primary function of BIOS is code program embedded on a chip that recognizes and controls various devices that make up the computer.  Activate on board Hardware(Sound Card,Ethernet Card)  Then call MBR BIOS on board BIOS on screen
  • 6. 6 MBR (Master Boot Record)  OS is booted from a hard disk, where the Master Boot Record (MBR) contains the primary boot loader  The MBR is a 512-byte sector, located in the first sector on the disk (sector 1 of cylinder 0, head 0)  After the MBR is loaded into RAM, the BIOS yields control to it.  Contain Boot Loader and Partition Information
  • 8. 8 MBR (Master Boot Record)  The first 446 bytes are the primary boot loader, which contains both executable code and error message text  The next sixty-four bytes are the partition table, which contains a record for each of four partitions  The MBR ends with two bytes that are defined as the magic number (0xAA55). The magic number serves as a validation check of the MBR
  • 9. 9 Boot loader  Boot loader could be more aptly called the kernel loader. The task at this stage is to load the Linux kernel  Optional, initial RAM disk  GRUB,GRUB2 and LILO are the most popular Linux boot loader.
  • 10. 10 Other boot loader (Several OS)  bootman  GRUB  LILO  NTLDR  XOSL  BootX  loadlin  Gujin  Boot Camp  Syslinux  GAG
  • 11. 11 Commonly used Boot Loader Boot Loader GRUB Legacy LILO GRUB 2 Advantage of GRUB2 over GRUB Legacy  New Configration file structure  Dynamic module Loading  Theme  Graphical boot menu Support  Internationalization include support for non- ASCII
  • 12. 12 Configration of GRUB and GRUB2 Vi /boot/menu.list Grub-update Grub-install GRUB GRUB2  Vim /etc/grub2*/grub.cfg  Grub-mkconfig -o /boot/grub2/grub.cfg
  • 15. 15 GRUB and initrd 1. The BIOS finds a bootable device (hard disk) and transfers control to the master boot record 2. The MBR contains GRUB 3. GRUB can access the Hard Drive 4. It launch the initrd and Kernel. 5. Initrd is initial RAM disk. 6. Initrd is mini sql of file system. 7. Mainly maintain the room file system. 8. Initrd is problem solver of Kitchen Sink. 9. Passes control on to the kernel which mount into Hard Drive.
  • 17. 17 Kernel image  The kernel is the central part in most computer operating systems because of its task, which is the management of the system's resources and the communication between hardware and software components  Kernel is always store on memory until computer is turn off  Kernel image is not an executable kernel, but a compress kernel image  zImage size less than 512 KB  bzImage size greater than 512 KB
  • 18. 18 Task of kernel  Process management  Memory management  Device management  System call
  • 19. 19 Init process  The first thing the kernel does is to execute Init program  The init process have the process ID 1.  Init is the root/parent of all processes executing on Linux  Based on the appropriate run-level, scripts are executed to start various processes to run the system and make it functional
  • 20. 20 Init Process We can find the PID of any process using command ps -ax. Here it show that init process with pid 1.
  • 21. 21 Type of Init system. Init system Systemd Upstart SystemV Traditional Method Fedora 15 Ubutu<15.0 Fedora9-14 Red hat Linux 6
  • 22. 22 Traditional Init (SystemV)  First file reader by in init process in inttab.  Second file /etc/fstab which mount partition accordingly  /etc/init.fd lauches all the services and scripts according to runlevel  Shutdown work pretty much in reverse fashion
  • 23. 23 Inittab file  The inittab file describes which processes are started at bootup and during normal operation  /etc/init.d/boot  /etc/init.d/rc  The computer will be booted to the runlevel as defined by the initdefault directive in the /etc/inittab file  id:5:initdefault:
  • 24. 24 Runlevels  A runlevel is a software configuration of the system which allows only a selected group of processes to exist  The processes spawned by init for each of these runlevels are defined in the /etc/inittab file  Init can be in one of eight runlevels: 0-6
  • 25. 25 Runlevels Runlev el Scripts Directory State 0 /etc/rc.d/rc0.d/ shutdown/halt system 1 /etc/rc.d/rc1.d/ Single user mode 2 /etc/rc.d/rc2.d/ Multiuser with no network services exported 3 /etc/rc.d/rc3.d/ Default text/console only start. Full multiuser 4 /etc/rc.d/rc4.d/ Reserved for local use. Also X-windows (Slackware/ BSD) 5 /etc/rc.d/rc5.d/ XDM X-windows GUI mode (Redhat/System V) 6 /etc/rc.d/rc6.d/ Reboot s or S Single user/Maintenance mode (Slackware) M Multiuser mode (Slackware)
  • 26. 26 Runlevel more Information Run Level have two flags. k=kill s=start Shutdown all symlinks have k link except halt.
  • 28. 28 Disadvantage of SystemV Major drawback of SysV is that this work serially Taking more memory The need to replace init with something more perfect was felt from a long time and several alternatives were developed from time-to-time, some of which became distribution’s native init replacement, some of which are: Upstart – A init replacement daemon implemented in Ubuntu GNU/Linux and designed to start process asynchronously.
  • 29. 29 Systemd Systemd is new and efficent way for booting process It boot the system in parallel way. The process which have no dependency can be parallelized by the Systemd. Systemd handles boot and service managment process using target First Target executed is default.target like in systemv inittab is called Default.target is symlink, it means that like short cut in windows
  • 30. 30 Systemd(continue) According to runlevel which is set in default.target is called You can change runlevel to boot by using ln -sf /usr/lib/systemd/system/multi- user.target /etc/systemd/system/default.target
  • 31. 31 Systemd Systemd call default and default can call any of target like graphical.target.wants These are some folder and symlink of systemd Sysinit start important system service like system mounting, swaping space and device.
  • 33. 33 Alternative ways to start process. In CentOS there is facility called start up. Just add your process and application in that menu. Reboot the system and you application automatically get started.
  • 34. 34 Pratical way to adding your process into as start-up process. Go to cd /etc/init.d or /etc/rc.local. You can add your script there Then add symoblic link in cd /etc/rc.d/rc[1....6].d in the runlevel. When system get started it will run all the symbolic links and call the scripts kept in rc.d Directory. As mention earlier you can also do it by adding your process in start-up
  • 35. 35 Importance of BASH and other shell scripting. As you can see from the diagram above, the shell is not part of the kernel, but it does communicate directly with the kernel. It is the "shell around the kernel."
  • 36. 36 Shell We cannot remove shell services like bash. Our application use the shell service to communicate with kernel. So we cannot stop shell service because our service also get stopped due to this.
  • 37. 37 How to Disable the Terminal. We can not Remove shell but we can disable terminal, so that no one can access it. We can disable terminal and panel in two ways.  Through command line.  Through GUI remove and disable.
  • 38. 38 Different way for disabling the terminal. The terminal we use in GNOME environment is GNOME terminal. We can get location GNOME ls ~/.gconf/apps, and delete the terminal configration. There is more simpler way for doing this ie using GUI, just go to remove and add menu and search for GNOME terminal, uncheck it
  • 39. 39
  • 42. 42 FSSTND : (Filesystem standard)  All directories are grouped under the root entry "/"  root - The home directory for the root user  home - Contains the user's home directories along with directories for services  ftp  HTTP  samba
  • 43. 43 FSSTND : (Filesystem standard)  bin - Commands needed during booting up that might be needed by normal users  sbin - Like bin but commands are not intended for normal users. Commands run by LINUX.  proc - This filesystem is not on a disk. It is a virtual filesystem that exists in the kernels imagination which is memory  1 - A directory with info about process number 1. Each process has a directory below proc.
  • 44. 44 FSSTND : (Filesystem standard)  usr - Contains all commands, libraries, man pages, games and static files for normal operation.  bin - Almost all user commands. some commands are in /bin or /usr/local/bin.  sbin - System admin commands not needed on the root filesystem. e.g., most server programs.  include - Header files for the C programming language. Should be below /user/lib for consistency.  lib - Unchanging data files for programs and subsystems  local - The place for locally installed software and other files.  man - Manual pages  info - Info documents  doc - Documentation  tmp  X11R6 - The X windows system files. There is a directory similar to usr below this directory.  X386 - Like X11R6 but for X11 release 5
  • 45. 45 FSSTND : (Filesystem standard)  boot - Files used by the bootstrap loader, LILO. Kernel images are often kept here.  lib - Shared libraries needed by the programs on the root filesystem  modules - Loadable kernel modules, especially those needed to boot the system after disasters.  dev - Device files  etc - Configuration files specific to the machine.  skel - When a home directory is created it is initialized with files from this directory  sysconfig - Files that configure the linux system for devices.
  • 46. 46 FSSTND : (Filesystem standard)  var - Contains files that change for mail, news, printers log files, man pages, temp files  file  lib - Files that change while the system is running normally  local - Variable data for programs installed in /usr/local.  lock - Lock files. Used by a program to indicate it is using a particular device or file  log - Log files from programs such as login and syslog which logs all logins and logouts.  run - Files that contain information about the system that is valid until the system is next booted  spool - Directories for mail, printer spools, news and other spooled work.  tmp - Temporary files that are large or need to exist for longer than they should in /tmp.  catman - A cache for man pages that are formatted on demand
  • 47. 47 FSSTND : (Filesystem standard)  mnt - Mount points for temporary mounts by the system administrator.  tmp - Temporary files. Programs running after bootup should use /var/tmp