############################################
LINUX BOOT PROCESS
############################################
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>
-: INTRODUCTION :-
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
iiiiiiiiiiii
The "LINUX BOOT PROCESS" have three parts.
==================
|
|--> PART 1 :----> 1. When we press "POWER-ON" button.
| |
| |--> 2. BIOS loads BL(LILO) in BS of MBR
| |
| |--> 3. Kernal takes control from BIOS.
|
| BL = Boot Loader.
| BS = Boot Sector.
| MBR = Master Boot Loader.
| BIOS = Basic Input Output System.
| LILO = Linux Loader.
|
|--> PART 2 :----> 1. Kernal ( "init" ) starts all
process.
| |
| |--> 2. Examine "/etc/inittab".
|
|
|
|--> PART 3 :----> 1. We see all "mingetty"
|
|--> 2. Finally we get "login" prompt.
=================================================================
==============
PART 1
=================================================================
==============
When we pressed
"POWER-ON" button.
""""|"""
|
|
|--> ROM (Read Only Memory) is HARD-WARE.
|
|--> Softwares in "ROM" are called as "FIRMWARE".
|
|--> Earlier BIOS is stored in ROM
|
|--> So it is called as "FIRMWARE",
|
|--> BIOS is EXE (i.e. Executable file ),
| EXE's can transfer control in between them.
|
|--> BIOS is loaded from ROM into RAM, this is called
"BOOT-STRAP".
====|=====
|
|
| NOTE:- 1. Technically it means Address of
BIOS
| is transfer to RAM
| 2. PC (program counter) of CPU
points
| to that address.
|
|--> Purpose of BIOS is to load OS in RAM.
|
|
|-->"POST" is checks or performed by BIOS (Power
On Self Test)
=|==
|
|--> It is also called "Hardware
Inventry".
| """""""""""""""""
|
|--> Checks----> 1. Hardware conected to
your machine
| |
| |
| |--> 2. Where OS (Operting
System)is stored.
|
|
|
|
|--> CMOS:-(Complementry Metal Oxide
Semiconductor)
| "|"""
| |
| |--> 1. CMOS is chip on board so it
is hardware
| |
| |
| |--> 2. It contains software on it,
| | so we can make changes.
| |
| |
| | ||
=======================================||
| | ||
||
| | || -:Process to make
changes:- ||
| | ||
======================= ||
| | ||
||
| | || 1. When we start
computer, ||
| | ||
||
| | || 2. Press 'del' or 'F10'
KEY ||
| | ||
||
| | || 3. Now go into CMOS-
SETUP ||
| | ||
||
| | || 4. Now set current
bootable device. ||
| | ||
||
| | || 5. Means ADDRESS of OS
is known ||
| | || for BOOTing.
||
| | ||
||
| | || 6. BOOTing is done from,
||
| | || that selected
"BOOTABLE" device.||
| | ||
=========================================
| |
| |
| |--> NOTE:=> CMOS know all bootable
devices and | it's
sequence.
|
|
| => If two or more
harddisks are
| connected, then from
"CMOS" only we
| know which is current
bootable device
|
|
|
|
|--> Master Boot Record
==================
=> 1. First 512 Bytes (1/2KB) of harddisk is called Master Boot
Record.
=> 2. On harddisk Higher Memory starts after 640MB,
640MB memory is known as "Actual Memory".
=============
=> 3. Master Boot Record is further devides into three parts
==================
|
|--> BS (Boot Sector) -------------> 446 bytes
|
|--> PT (Partition Table) ---------> 64 byte
|
|--> Magic No. --------------------> 2 byte
M B R
<------------------------------
512Bytes--------------------------------->
446 BYTES : 64 BYTES : 2 BYTES
: : :
:
BOOT SECTOR : PARTITION TABLE : MAGIC NO
:
----------------- : -------------------- :
--------------------------- :
BOOT LODER FOR WINDOWS KERNAL$ .
.
: :
:
1.ntldr :CHS : hda1 A [active] : [fdisk/mbr]
:
: : ok [first
slice] :
: : windowskernal-
KRNAL386.EXE :
: :
[io.sys,msdos.sys,command.com]:
.................................................................
.............
BOOT LODER FOR LINUX KERNAL$ :
: : hda2 /boot :
:
: hda3 extended : ok
: : hda4 /home :
: : hda5 swap :
:
: hda6 / :
:
2. LILO:/etc/lilo.conf : hda7 /var :
:
[digitised] : hda8 /tmp :
:
: hda9 /usr :
: : :
:
.................................................................
.............
==> "BIOS"
""|""""
|
|---> Loads content of MBR into RAM,
|
| this is called "First Stage of Boot Loading."
| ===========================
|
|---> Executes the "Boot-Loading" with the help of BL
|
|
|---> Control is transfer from BIOS to BL.
NOTE ==> When Windows or any OS loads first time it goes to
MBR.
==> To install Windows only, we need "Active Partition",
This is main disadvantage of Window OS.
==> When windows Booting first time,
==> Windows installer load, small binary in BS of MBR.
==> This binary is windows "Boot-Loader" (i.e. ntlder or
ntloader )
==> At the time of installation, windows kernal was store
into hard disk with it's CHS no.
==> when windows booting first time.
^^^^|^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|--> CHS number is store in BS of MBR with
"ntldr:CHS"
|
|
|--> Name of [*-active] partition of window stored
in
|
| Partitin Table ( 64 bytes ) of MBR.
|
|
|
|--> If BS and PT of MBR is wirtten properly
|
| then only "OK" is written in Magic No of MBR.
|
|
|
|--> BIOS first check "OK" on "MAGIC NO" of MBR,
|
| If "OK" is present then BIOS load that OS and
vice versa.
|
|
|
|--> Then BIOS executes BL (ntlder:CHS) of windows.
|
|
|
|--> Control transfers from BIOS to ntlder:CHS .
|
|
|
|--> With the help of CHS number, "ntlder" find
Kernal of windows
[ KRNL386.EXE ] and install windows OS.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
LINUX BOOT PROCESS
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
1. Starts from "POWER-ON" till we get "LINUX PROMPT"
[user_name@localhost current_directory]#
\ | /
\ | /
\ | /
[root@samarth root]#
# LILO: /etc/lilo.conf hda7 /boot
( digitized form ) hda8 /home
hda9 /swap
hda10 /
hda11 /tmp
hda12 /var
hda13 /usr
@--> At the end of installation of linux, "LINUX-INSTALLER"
(annaconda)
stores small exe "LILO /etc/lilo.conf" in BS of MBR.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
WORKING PROCESS OF LINUX INSTALLER
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
--> When we make any changes in "/etc/lilo.conf" file,
we must have to type command " lilo -v <--| " after saving
file.
--> Then "/sbin/lilo" check for error in "/etc/lilo.cong"
config file,
line by line (i.e. interpreted).
NOTE:- INTERPRETER-----------> checks file line by line for
error
:- COMPILER -----------> Read whole program and check
for error
--> Then /sbin/lilo converts "/etc/lilo.conf" into 0 and 1
i.e. (digitized form), because "shell-script" can not
understand by machine.
--> Finally "/sbin/lilo" put it into "BS" of "MBR" in digitzed
form
so it comes in small size.
--> After that it recreates "/boot/map" file,
therefor "/sbin/lilo" is called "Map Installer".
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
@ When we start Linux Installation all the steps upto loading
of exe's
[i.e. Kernal of Linux ] get in RAM and get executed in RAM
are same.
@ If Linux Installer "anaconda" see, any other OS Kernal is
already present
in BS of MBR, then "anaconda" loads Linux's Kernal next to or
below to
that previousely present OS's Kernal. ( e.g. Windows Kernal)
@ Then we reboot system.
@ Now in "Boot Sector" BS of "Master Boot Loader" MBR contains
two "Boot Loader" BL.
1) ntldr:CHS
2) LILO:/etc/lilo.conf -------> in digitized form
@ LILO sends interupt to BIOS.
@ So BIOS can see only LILO "Boot Loader", in the BS of MBR.
@ BIOS transfers control to LILO "Boot Loader" BL.
@ Then LILO starts executing "/etc/lilo.conf" config file for
LILO
prompt
=|=====
|
|---> Prompt go and searches for lable (i.e. OS ) and then
shows lables
| on screen.
|
|
|---> Default lable always come first or on top, then comes
others.
timeout
=|=====
|
|---> timeout=50 [ timeout is 50 decisecond i.e. 5 seconds ]
|
|
|---> Because of timeout prompt will wait for choosing any OS
upto 5 seconds. | After timeout over LILO will choose
default OS by itself.
|
|
|---> If we moove highlighten area by pressing UP-ARROW or
DOWN-ARROW key but | yet not choose any OS on prompt then
timeout will disable. It wouldn't | start default OS after
5 seconds and will wait for choice from user.
|
|
|---> We can comment on "timeout" in /etc/lilo.conf then LILO
won't start any default OS by it's own. It will work only
when we choose any OS from prompt.
message
=|=====
|
|
|---> LILO reads "message" from /etc/lilo.conf config file.
| Here message=/boot/message
|
|
?| ---> First LILO shows SPLASH SCREEN from /boot/message which
is jpg file.
|
|
?|---> File contain Red-Hat logo and some information about on
etc.
default
=|======
|
|
|---> LILO reads "default" OS from "/etc/lilo.conf"
|
|
|---> starts that default OS after timeout over.
|
|
|---> default=DOS [ i.e. DOS Operating System is choosen as
default.]
|
|
|---> We shouldn't comment to this line.
boot
=|===
|
|
?|---> LILO reads "boot" from /etc/lilo.config. It tells BL Boot
Loader where | OS Operating System is located
|
|
|---> boot=/dev/hda [i.e. OS is stores on primary master ]
Finding for LINUX KERNAL
===|====================
|
|
|--> Boot Loader doesn't know the location of Linux Kernal
vmlinuz-2.4.20-8.
|
|
|--> BL go into the PT "Partition Table" of the MBR.
|
|
|--> In the PT of MBR all the Linux Partitions are stored
|
| which are created while installation.
|
|
|--> BL get all linux partition record from this.
|
|
|--> Yet BL LILO don't get location of Linux Kernal vmlinz-
2.4.20-8.
|
|
|--> So BL transfers all controll to /boot/boot.b
|
| for finding Linux Kernal location and to load it in RAM.
|
|
|--> /boot/boot.b calls boot/map and gives all control to it.
|
|
|
|--> /boot/map finds location and size of Linux Kernal
vmlinuz-2.4.20-8
|
|
|
|--> Now /boot/boot.b get control back from /boot/map
| as well as it get location of Linux Kernal also.
|
|
|
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>
| ::
::
| :: to install /boot/boot.b into RAM is
called ::
| :: SECOND STAGE OF BOOTLOADING
::
| :: ===========================
::
| :: because Linux Kernal is Booting from
/boot/boot.b ::
| ::
::
|
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>
|
|
|
|--> Then control is again transfered from /boot/boot.b to
BL LILO.
|
|
|
|--> Then LILO BL loads linux Kernal vmlinuz-2.4.20-8 into
RAM.
|
|
|
|--> In RAM it uncompressed and untar, it gives 1000 of exe
(i.e.binary).
|
| "init" is one of them.
|
|
|--> Now BL transfers control to init and then BL dies from
RAM.
|
|
|
|--> init is called Linux Kernal, because init starts all
processes.
|
|
|
|--> PID of init is 1.
|
|
|
|--> Every process is directly or indirectly starts by init,
|
| So "init" is a parent of all process i.e. PPID.
|
|
|--> When init starts in RAM, not any process runs in RAM,
so PPID of init is always 0.
!!!!!!!!!!!!!!!!! TYPES OF LILO !!!!!!!!!!!!!!!!!
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>
|| <>
||
|| LILO <> Boot Loader
||
||
_________________________________<>______________________________
__________||
|| <>
||
|| /etc/lilo.conf <> Config file to
costumize LILO ||
||
_________________________________<>______________________________
__________||
|| <>
||
|| /sbin/lilo <> Map Installer
||
||
_________________________________<>______________________________
__________||
--> When Linux Installed first time that Linux Installer
"anaconda",
creates backup of MBR in /boot/boot.0300 file.
---> /boot/boot.0300 STOCK MBR backup -----> IDE
---> /boot/boot.0800 STOCK MBR backup -----> SCSI
=================================================================
==============
NOTE:- We passed parameter to Kernal through lable. There are
more than 400 parameters in linux which we can
pass to Kernal with lable.
=================================================================
==============
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
BOOT PROCESS - PART II
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
oooooooooooooooooooooooooooooooooooooooooooooo
inittab
oooooooooooooooooooooooooooooooooooooooooooooo
@ When init binary executing in RAM, it examine
"/etc/inittab" file.
@ "/etc/inittab" is said to be configuration file of "init"
binary.
@ Now we see "inittab" file, so we can understand,
how init binary started other processes.
@ Now "inittab" file examines, in which runlevel system is
started.
@ There are mainly seven runlevels are present in Linux, as
follows...
Runlevel 0 ------------>HALT
Runlevel 1 ------------>Single User
OR
Maintance Mode
OR
Safe Mode
Runlevel 2 ------------>Multiuser Mode (without NFS)
Runlevel 3 ------------>Multiuser Mode (with NFS)
Runlevel 4 ------------>Unused
Runlevel 5 ------------>X11 (GUI)
Runlevel 6 ------------>Reboot
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 0 ------------>HALT
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
--> If system starts with 0 runlevel,
then system starts and we get Linux prompt, but suddenly
system "halted".
--> When init binary executes, in that default runlevel is
runlevel 0.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxx
NOTE:- When init binary executes & come to runlevel stage, then
init examines
which runlevel is present in inittab file. and according
to that, system
starts in that preticular runlevel. Whatever changes are
made in inittab
file, that changes are overwritten in init binary.
We can't change defaults of any binary, but if we want
to change
default, so firstly we have to compile that source code of
that binary,
so it befcome EXE.
compilation
Binary file --------------------------> exe file
#id:3:initdefault:#
==> In above example instead of 'id' we can't put any other
name,
because that name is not present in init binay.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxx
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 1 ------------>Single User
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
It is also called
----------------> Single User Mode
----------------> Maintance Mode
----------------> Safe Mode
--> From command line we can go into Single User Mode
by giving command init 1.
"[root@localhost root]# init 1 <--|"
===================================
--> In Single User Mode all NET-WORKING SERVICES will be OFF.
==================== ===
--> This is more Secure Mode.
===========
--> We can not use any Virtual Consoles, in this mode.
================
--> To recover defaults of the system we always use Maintance
Mode.
================
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 2 ------------>Multiuser Mode (without NFS)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
==> From command line we can go into Single User Mode
by giving command init 2.
"[root@localhost root]# init 2 <--|"
===================================
--> In this mode we can use all Virtual Consoles. ( default 6
mingetty )
================
These mingetties can be starts from "Alt+F1.........Alt+F6".
--> In this mode Netwroking Sevices are not allowed.
================== ===========
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 3 ------------> Full Multiuser Mode (with NFS)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
==> From command line we can go into Single User Mode by
giving command init 3.
[root@localhost root]# init 3 <--|
--> We normally use this runlevel.
--> In this mode we can use all Virtual Consoles. ( default 6
mingetty )
================
--> These mingetties can be starts from "Alt+F1.........Alt+F6".
--> In this mode Netwroking Sevices are allowed.
================== =======
--> Runlevel 3 is command line or text mode of RHS.
============ =========
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 4 ------------>Unused
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
==> We never use this Runlevel.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 5 ------------>X11 (GUI)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
==> From command line we can go into Single User Mode
by giving command init 5.
[root@localhost root]# init 5 <--|
--> This is also Full Multiuser Mode.
====================
--> In this mode Netwroking Sevices are allowed.
==================
--> Runlevel 5 is GUI means Graphical User Interface mode of RHS.
=== ========================
--> We get login prompt on GUI screen.
===================
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
Runlevel 6 ------------>Reboot
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::
==> From command line we can go into Single User Mode
by giving command init 1.
[root@localhost root]# init 6 <--|
--> If we set this runlevel then RHS will start but immediately
rebooted.
===============================END
RUNLEVELS===================================
==> All sub-shells executed under "bash" ( bash converts shell-
scripts
into 0's & 1's) are named by their name.
==> According to "id:3:initdefault:" in /etc/inittab file,
============
runlevel is set and rc.sysint is executed
==> "rc.sysinit" is a shell-script and all shell-scripts are run
in
sub-shell of bash.
==> /etc/rc.d/rc.sysinit file is executed in sub-shell of
/etc/inittab.
==> "inittab" (i.e. /etc/inittab ) runs rc.sysinit (i.e.
/etc/rc.d/rc.sysinit )
==> Control is transfer from "inittab" to "rc.sysinit"
untill it is not executed completly.
==> rc.sysinit runs or executed at the time of booting only
(i.e. when system starts).
rc.sysinit
===|======
|
|--> "rc.sysinit" starts all system daemons.
|
|
|--> First it checks hostname of RHS from `bin/hostname`
|
| & store that in HOSTNAME variable.
|
|
|--> By this we get "hostname" and "domainname" of RHS
|
|
|
|--> It first checks Networking ( i.e. network card )
|
| by /etc/sysconfig/network in same enviornment of
rc.sysinit.
|
|
|--> In this it checks for exisance of netwrok card.
|
|
|
|--> If "network-card" exist then it creates two variables
|
| NETWORKING -------------->yes
|
| HOSTNAME
-------------->localhost.localhostdomain
|
|--> If hostname is not set then RHS consider
|
| hostname ---------------------> localhost
|
| domainname---------------------> localdomain
|
|--> If networking is not set then also it sets two variables.
NETWORKING -------------->no
HOSTNAME -------------->localhost
"/etc/sysconfig/functions"
===|=====================
|
|
|--> When /etc/rc.d/rc.sysinit executes properly
|
| control transfers back to the /etc/inittab
|
|
|--> "inittab" now executes "functions" shellscripts
|
| in it's same enviornment.
|
|
|--> "functions" is a shell-script having path
/etc/init.d/functions.
|
|
| symlink
| /etc/init./function ------------------------>
/etc/rc.d/init.d/function
|
|
|-->function sets ------> umask for root
| |
| |
| |---> PATH for all other's
| |
| |
| |---> 17 FUNCTIONS
| |
| |
| |-----> 1. action()
| |
| |-----> 2. chekpid()
| |
| |-----> 3. confirm()
| |
| |-----> 4. daemon()
| |
| |-----> 5. echo-failure()
| |
| |-----> 6. echo-passed()
| |
| |-----> 7. echo-warning()
| |
| |-----> 8. echo-sucess()
| |
| |-----> 9. failure()
| |
| |-----> 10. passed()
| |
| |-----> 11. warning()
| |
| |-----> 12. sucess()
| |
| |-----> 13. killproc()
| |
| |-----> 14. pidofproc()
| |
| |-----> 15. pidfileofproc()
| |
| |-----> 16. status()
| |
| |-----> 17. strstr()
|
|
|--> Then displays "Welcome to Red Hat" from "/etc/redhat-
release" file.
|
|
|--> c.sysinit runs dmesg binary, this binary reads
information from
/var/log/dmesg and displays on screen.
inittab
===|===
|
|
|--> After completely executing "rc.sysinit" control
|
| transfers back to "inittab", Which is parent of
rc.sysinit.
|
|
|--> Now rc.d file is executed according runlevel selected.
|
|
|
|--> /etc/rc.d/rc [0-6] this starts application daemons for
selected runlevel
|
|
|
|--> If we comment this line then application daemon can't
start.
#Run gettys in standard runlevels
================================
/ 1:2345:respawn:/sbin/mingetty tty1 \
| |
| 2:2345:respawn:/sbin/mingetty tty2 |
| |
/ 3:2345:respawn:/sbin/mingetty tty3 \
Virtual < > Terminal
No.
Consoles \ 4:2345:respawn:/sbin/mingetty tty4 /
| |
| 5:2345:respawn:/sbin/mingetty tty5 |
| |
\ 6:2345:respawn:/sbin/mingetty tty6 /
\____ ______/
\/
Binary for starting
respective terminal
--> Here "inittab" shell script start 6 mingetty defaultly
which we can access with 'Alt+F1' to 'Alt+F6'
Alt+F1 ---------> tty1
Alt+F2 ---------> tty2
Alt+F3 ---------> tty3
Alt+F4 ---------> tty4
Alt+F5 ---------> tty5
Alt+F6 ---------> tty6
--> Out of these only "one mingetty" tty1 is running (wake-up)
for user
defaulty & other are sleeping in RAM with seprate driver
consoles.
--> We can extend or increase the number of "VIRTUAL-CONSOLE
for our system
by increasing/adding the mingetties in "inittab" shell
script as follows.
/ 7:2345:respawn:/sbin/mingetty tty7 \
Alt+F7
| |
| 8:2345:respawn:/sbin/mingetty tty8 |
Alt+F8
| |
/ 9:2345:respawn:/sbin/mingetty tty9 \
Alt+F9
Virtual < > Terminal
Consoles \ 10:2345:respawn:/sbin/mingetty tty10 / No.
Alt+F10
| |
| 11:2345:respawn:/sbin/mingetty tty11 |
Alt+F11
| |
\ 12:2345:respawn:/sbin/mingetty tty12 /
Alt+F12
# Run xdm in runlevel 5
======================
x:5:respawn:/etc/X11/prefdm -nodaemon
--> Then "inittab" checks runlevel if starting runlevel is 5
(i.e. GUI with NFS, Multiuser) then runs the shell script
"/etc/X11/prefdm" i.e. it eximine prefdm means
your display manager type.
--> There are three display managers as
1. xdm 2. kdm 3. gdm
--> Whatever display manager present their (i.e. resulted by
prefdm ) is applied as soon as we go in runlevel 5 by executing
binary "which display manager type".
==========================
--> Here "/etc/inittab" (i.e. config file of init ) ends.
============
--> First stated mingetty runs the shell script "/etc/issue".
==========
--> This shell script contents the messages which are displayed
while booting our system, exactly when we get first
mingetty i.e. tty1.
--> The contents of this shell-script are displayed at the
startup screen same as they stored in "/etc/issue"
file.
--> Then "/etc/issue" shell script executes "/bin/login" shell
script.
--> Due to this shell script we get login prompt on our terminal
as
login:
--> As soon as we enter login name this shell script starts
"/usr/bin/passwd" this is also shell script.
--> This file checks for entered password for corrosponding
login. It just "authenticates" password by
examine the first field of this file &
"authorization" of login via shell script "/usr/bin/shadow".
/usr/bin/passwd ----------------------> authentication
/usr/bin/shadow -----------------------> authorization
--> Then First "mingetty" puts "/bin/login" (i.e. login daemon )
into "sleep" state untill """"""""""
|
|---> working with that
login.
|
|---> logout from that
login.
--> "mingetty" calls"/bin/login"
"""""""" """"|""""""
|
|---> It is an "application daemon".
|
|
|---> Prints the last login details
for login user after the messages
of the day.
--> Then mingetty goes into "zambie state".
1. Run ----> Running in RAM
2. Wait ----> Waiting for completing some process,
then Run.
3. Sleep ----> In the RAM but not Running.
4. Zambie ----> waiting to kill by init process
5. End ----> Remove from RAM
-->Then "/bin/login" loads "/bin/bash" shell script.
========== =========
--> "/bin/bash"
|
|---> Moniters the current terminal as a child
process
|
? |--> converts "words" into 0 & 1 which can't known
by kernal
|
|--> convert "Kernal information" into "human
readabale" form.
==================
===============
--> After loading "/bin/bash" the script "/bin/login" sleeps.
~~~~~~~~~ ~~~~~~~~~~
|
|---> Untill we press 'Alt+F2' or
'Alt+F3' etc.
--> After pressing it "/bin/login" wakes up.
==========
|
|---> Call mingetty with respective
terminal
|
|---> Continue the same procedure.
-->Then "/bin/bash" executes "/etc/profile" shell script,
~~~~~~~~~ ~~~~|~~~~~~~
|
|--> Sets all "Enviornment
variables" for
that user.
e.g. PATH, USER, HOSTNAME,
HISTSIZE=1000
-->Then "/etc/profile" executes "/etc/inputrc" shell-script.
============ ============
|
|---> Sets keyboard
mapping,
|
|---> We can see in 'stty
-a' command.
==> Following command enlist all short-cut keys.
||
=================================================================
=||
||
||
|| [root@samarth root]# stty -a <--|
||
||
||
||
=================================================================
=||
==> We can Start or Stop perticular Service by following
command.
||
=================================================================
=||
||
||
|| [root@samarth root]# stty -echo <--|
||
||
||
||
=================================================================
=||
--> "stty -echo <--|"
==========
|
|--> This command will hide all keyboard strikes,
|
|--> Nobody can "visualize" what we are typing.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xx
II
II
II ==> NOTE:- "/etc/profile" runs total 20 shell
scripts. II
II ============
II
II
II
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xx
--> Then "/etc/profile.d" executes "/etc/termcop" shell
script
============== ============
| |
| |--> Set the terminal
settings
| |
| |--> Set internally
in /etc/profile.d
| |
| |--> Ends with .sh.
|
|
|
=================================
Total 13 shell scripts presents
which ends with .sh.
===================================
|
|
|
|---> 1. colours.sh => initalize colours alias for all
users, i.e. same | ========== as
"/etc/DIR_COLOR" config file.
| """"""""""""""
| [ colors=/etc/DIR_COLORS ]
| """""""""""""""
|
|---> 2. glib2.sh => It caused GLIB 2 applications to
convert filenames | ======== from local
encoding to "UTF-8".
| """""
|
|---> 3. gnome-ssh-askpass.sh
| ====================
|
|---> 4. krb5.sh
| =======
|
|---> 5. lam.sh
| ======
|
|---> 6. lang.sh => Set i18n stuff i.e. set supported
language in | ======= original file.
|
|
| LANG="en-US.UTF-8"
| """"
|
| SUPPORTED="ar_IN.UTF-8:ar_IN:ar:
| """"""""" en_IN.UTF-8:en_IN:en:
| hi_IN.UTF-8:hi_IN:hi:
| mr_IN.UTF-8:mr_IN:mr:
| ta_IN.UTF-8:ta_IN:ta:
| te_IN.UTF-8:te_IN:te"
|
|
|
| SYSFONT="latarcyrheb-sun16"
| """""""
|--->7. less.sh => It initialize script (sh) main file
is
| =======
| "/usr/bin/lesspipe.sh".
| """"""""""""""""""""
|
|
|
|--->8. mc.sh => contains alias mc='/usr/bin/mc/mc-
wrapper.sh'
| =====
"""""""""""""""""""""""""
|
|
|
|--->9. prm.sh => Contains variables PVM_ROOT, PVM_RSH
| ======
|
|
|--->10. qt.sh => "/usr/lib/qt-3.1"-----> QT
initalization script
| ===== """"""""""""""" |
| |----> Contains many
directories
| |
| |----> In which ".so"
& ".o" files.
| ^^^^
^^^
|
|
|
I~~~~~~~~~~~~~~~~~~~~~~~~~I
|--->11. vim.sh => alias vi='vim' I vim------> vi
improve I
| ====== I
========== I
|
I_________________________I
|
|
|--->12. which-2.sh => Initialization script for "bash" &
"sh"
| ==========
| which ='/usr/bin/which'
| """"""""""""""
|
|
|--->13. xpvm.sh => XPVM-ROOT = "/usr/share/pvm3/XPVM"
======= """"""""""""""""""""
---> "/etc/profile" calls "/etc/bashrc" shell script
""""""""""""" """""""""""
|
|
|-------------> Transfers control to "/etc/bashrc" &
ends itself
(i.e. "/etc/profile.d/*.sh" ends )
---> "/etc/bashrc"
"""""""""""
|
|-------> Sets global alias spcified in
"/etc/profile.d/colors.sh"
|
|
|-------> Given for all network users and shell
functions.
|
|
|-------> Contains umask -----> 022 (root)
|
| umask -----> 002 (user)
|
|
|-------> Executes users personal ".bash-profile".
# --> Then /etc/.bashrc executes users personal .bash-profile.
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
QQQQQQQQQQ
Q
Q
Q
Q
Q [ NOTE:- If ".bashlogin" file presents in your login then
Q
Q """"""""""
Q
Q |
Q
Q |
Q
Q |---> it don't executes -----> 1.
"/etc/motd" Q
Q |
""""""""" Q
Q |---> 2.
"/etc/profile" Q
Q
"""""""""""" Q
Q
Q
Q
Q
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
QQQQQQQQQQ
--> It reads /etc/bashrc i.e. ~/.bashrc
also has users specific enviornment
& startup as PATH, USERNAME, BSH-ENV.
--> Ends ".bash_profile".
"""""""""""""
--> Then "/etc/bashrc" executes ".bash_history"
""""""""""" """""""""""""
---> ".bash_history"
""""|""""""""
|
|---> Contains all commands which are
| recently entered on your terminal.
| """""""
|
|---> The number of commands is equal to "HISSIZE".
| """""""
|
|---> Commands are FIFO i.e. first in first out.
|
|
|---> Contents of ".bash_history" can be viewed by
"history binary".
| """""""""""""
""""""""""""""
|
|---> ".bash_history" Ends.
---> Control transfers from ".bash_history" to "/etc/bashrc"
again.
""""""""""""" """""""""""
---> When perticular user logout
===========================
|
|
|----> "/etc/bashrc" executes ".bash_logout"
shell script.
|
|
|----> ".bash_logout" contains 'clear' command.
i.e. all screen clears on 'logout'.