rhel boot process
TRANSCRIPT
-
8/10/2019 RHEL Boot Process
1/21
RHEL Boot Process
-
8/10/2019 RHEL Boot Process
2/21
The Boot Process
Below are the basic stages of the boot process for an x86 system:1 The system B!"# chec$s the system an% la&nches the 'rst stage bon the (BR of the primary har% %is$
) The 'rst stage boot loa%er loa%s itself into memory an% la&nches stage boot loa%er from the *boot* partition
+ The secon% stage boot loa%er loa%s the $ernel into memory, which
loa%s any necessary mo%&les an% mo&nts the root partition rea%-onl. The $ernel transfers control of the boot process to the *sbin*init pr
/ The *sbin*init program loa%s all ser0ices an% &ser-space tools, an%
partitions liste% in *etc*fstab
6 The &ser is presente% with a login screen for the freshly boote% Lin
-
8/10/2019 RHEL Boot Process
3/21
etaile% Loo$ at the Boot Proce
The beginning of the boot process 0aries %epen%ithe har%ware platform being &se% Howe0er, once$ernel is fo&n% an% loa%e% by the boot loa%er, theboot process is i%entical across all architect&res
-
8/10/2019 RHEL Boot Process
4/21
The B!"#
2hen an x86 comp&ter is boote%, the processor loo$s at the en% of system memory for t!np&t*"&tp&t #ystem or B!"# program an% r&ns it The B!"# controls not only the 'rst steprocess, b&t also pro0i%es the lowest le0el interface to peripheral %e0ices 3or this reasoninto rea%-only, permanent memory an% is always a0ailable for &se
"ther platforms &se %i4erent programs to perform low-le0el tas$s ro&ghly e5&i0alent to tB!"# on an x86 system 3or instance, !tani&m-base% comp&ters &se the Extensible 3irmwE3!7 #hell
"nce loa%e%, the B!"# tests the system, loo$s for an% chec$s peripherals, an% then locate
%e0ice with which to boot the system s&ally, it chec$s any %is$ette %ri0es an% 9-R"( for bootable me%ia, then, failing that, loo$s to the systems har% %ri0es !n most cases, th%ri0es searche% while booting is controlle% with a setting in the B!"#, an% it loo$s on the %e0ice on the primary !E b&s The B!"# then loa%s into memory whate0er program is re'rst sector of this %e0ice, calle% the (aster Boot Recor% or (BR The (BR is only /1) bytcontains machine co%e instr&ctions for booting the machine, calle% a boot loa%er, along wpartition table "nce the B!"# 'n%s an% loa%s the boot loa%er program into memory, it yithe boot process to it
-
8/10/2019 RHEL Boot Process
5/21
-
8/10/2019 RHEL Boot Process
6/21
"nce the secon% stage boot loa%er is in memory, it presents with a graphical screen showing the %i4erent operating syste$ernels it has been con'g&re% to boot "n this screen a &ser the arrow $eys to choose which operating system or $ernel thto boot an% press Enter !f no $ey is presse%, the boot loa%er %efa< selection after a con'g&rable perio% of time has pass
"nce the secon% stage boot loa%er has %etermine% which $erboot, it locates the correspon%ing $ernel binary in the *boot* %The $ernel binary is name% &sing the following format ?*boot*0mlin&;-@$ernel-0ersionA 'le where @$ernel-0ersionAcorrespon%s to the $ernel 0ersion speci'e% in the boot loa%ersettings7
-
8/10/2019 RHEL Boot Process
7/21
The boot loa%er then places one or more approprinitramfs images into memory ext, the $ernel%ecompresses these images from memory to *sysR=(-base% 0irt&al 'le system, 0ia cpio The initra&se% by the $ernel to loa% %ri0ers an% mo%&les ne
to boot the system This is partic&larly important har% %ri0es are present or if the systems &se the esystem
"nce the $ernel an% the initramfs images7 are lointo memory, the boot loa%er han%s control of the
process to the $ernel
-
8/10/2019 RHEL Boot Process
8/21
The Cernel
2hen the $ernel is loa%e%, it imme%iately initiali;es an% con'g&res the comp&ters con'g&res the 0ario&s har%ware attache% to the system, incl&%ing all processors, !*"s&bsystems, an% storage %e0ices !t then loo$s for the compresse% initramfs imagepre%etermine% location in memory, %ecompresses it %irectly to *sysroot*, an% loa%s %ri0ers ext, it initiali;es 0irt&al %e0ices relate% to the 'le system, s&ch as LD( or sbefore completing the initramfs processes an% freeing &p all the memory the %is$ imocc&pie%
The $ernel then creates a root %e0ice, mo&nts the root partition rea%-only, an% freememory
=t this point, the $ernel is loa%e% into memory an% operational Howe0er, since therapplications that allow meaningf&l inp&t to the system, not m&ch can be %one with
To set &p the &ser en0ironment, the $ernel exec&tes the *sbin*init program
-
8/10/2019 RHEL Boot Process
9/21
The *sbin*init Program
The *sbin*init program also calle% init7 coor%inates the rest of the process an% con'g&res the en0ironment for the &ser 2hen the initstarts, it becomes the parent or gran%parent of all of the processes&p a&tomatically on the system 3irst, it r&ns the *etc*rc%*rcsysinitwhich sets the en0ironment path, starts swap, chec$s the 'le systeexec&tes all other steps re5&ire% for system initiali;ation 3or examsystems &se a cloc$, so rcsysinit rea%s the *etc*syscon'g*cloc$ con
'le to initiali;e the har%ware cloc$ =nother example is if there areserial port processes which m&st be initiali;e%, rcsysinit exec&tes *etc*rcserial 'le The init comman% then r&ns the *etc*inittab script%escribes how the system sho&l% be set &p in each #ysD init r&nle0R&nle0els are a state, or mo%e, %e'ne% by the ser0ices liste% in the*etc*rc%*rc@xA%* %irectory, where @xA is the n&mber of the r&nle
-
8/10/2019 RHEL Boot Process
10/21
ext, the init comman% sets the so&rce f&nction library,*etc*rc%*init%*f&nctions, for the system, which con'g&res how toan% %etermine the P! of a program
The init program starts all of the bac$gro&n% processes by loo$inappropriate rc %irectory for the r&nle0el speci'e% as the %efa< i
*etc*inittab The rc %irectories are n&mbere% to correspon% to thethey represent 3or instance, *etc*rc%*rc/%* is the %irectory for r
2hen booting to r&nle0el /, the init program loo$s in the *etc*rc%%irectory to %etermine which processes to start an% stop
-
8/10/2019 RHEL Boot Process
11/21
=fter the init comman% has progresse% thro&gh the appropriate rc %irethe r&nle0el, the *etc*inittab script for$s an *sbin*mingetty process for console login prompt7 allocate% to the r&nle0el R&nle0els ) thro&gh /six 0irt&al consoles, while r&nle0el 1 single &ser mo%e7 has one, an% ran% 6 ha0e none The *sbin*mingetty process opens comm&nication patty %e0ices, sets their mo%es, prints the login prompt, accepts the &se&sername an% passwor%, an% initiates the login process
!n r&nle0el /, the *etc*inittab r&ns a script calle% *etc*F11*pref%m The script exec&tes the preferre% F %isplay manager? g%m, $%m, or x%m, on the contents of the *etc*syscon'g*%es$top 'le
"nce 'nishe%, the system operates on r&nle0el / an% %isplays a login
-
8/10/2019 RHEL Boot Process
12/21
R&nning =%%itional Programs atTime
The *etc*rc%*rclocal script is exec&te% by the init commantime or when changing r&nle0els =%%ing comman%s to the this script is an easy way to perform necessary tas$s li$e stspecial ser0ices or initiali;e %e0ices witho&t writing complexinitiali;ation scripts in the *etc*rc%*init%* %irectory an% crea
symbolic lin$s
The *etc*rcserial script is &se% if serial ports m&st be set&p time This script r&ns setserial comman%s to con'g&re the sserial ports
-
8/10/2019 RHEL Boot Process
13/21
#G#D r&n le0els
The #ysD init r&nle0el system pro0i%es a stan%ar% process for cowhich programs init la&nches or halts when initiali;ing a r&nle0elwas chosen beca&se it is easier to &se an% more exible than theB#-style init process
The con'g&ration 'les for #ysD init are locate% in the *etc*rc%* %ir2ithin this %irectory, are the rc, rclocal, rcsysinit, an%, optionallyrcserial scripts as well as the following %irectories:
init%* rc%* rc1%* rc)%* rc+%* rc.%* rc/%* rc6%*
The init%* %irectory contains the scripts &se% by the *sbin*init comwhen controlling ser0ices Each of the n&mbere% %irectories represix r&nle0els con'g&re% by %efa< &n%er Re% Hat Enterprise Lin&
-
8/10/2019 RHEL Boot Process
14/21
R LEDEL#
The i%ea behin% #ysD init r&nle0els re0ol0es aro&n% the i%ea that %i4systems can be &se% in %i4erent ways 3or example, a ser0er r&ns moeIciently witho&t the %rag on system reso&rces create% by the F 2in#ystem "r there may be times when a system a%ministrator may neeoperate the system at a lower r&nle0el to perform %iagnostic tas$s, li%is$ corr&ption in r&nle0el 1
The characteristics of a gi0en r&nle0el %etermine which ser0ices are hstarte% by init 3or instance, r&nle0el 1 single &ser mo%e7 halts any nser0ices, while r&nle0el + starts these ser0ices By assigning speci'c sbe halte% or starte% on a gi0en r&nle0el, init can 5&ic$ly change the mmachine witho&t the &ser man&ally stopping an% starting ser0ices
-
8/10/2019 RHEL Boot Process
15/21
-
8/10/2019 RHEL Boot Process
16/21
!n general, &sers operate Re% Hat Enterprise Lin&x at r&nle0r&nle0el / ? both f&ll m<i-&ser mo%es sers sometimes cr&nle0els ) an% . to meet speci'c nee%s, since they are not
The %efa< r&nle0el for the system is liste% in *etc*inittab Tthe %efa< r&nle0el for a system, loo$ for the line similar to
following near the top of *etc*inittab:
id:5:initdefault:
The %efa< r&nle0el liste% in this example is '0e, as the n&after the 'rst colon in%icates To change it, e%it *etc*inittab
-
8/10/2019 RHEL Boot Process
17/21
R LEDEL tilities
"ne of the best ways to con'g&re r&nle0els is to &se an initscript &tilittools are %esigne% to simplify the tas$ of maintaining 'les in the #ysD %irectory hierarchy an% relie0es system a%ministrators from ha0ing to manip&late the n&mero&s symbolic lin$s in the s&b%irectories of *etc*rc
Re% Hat Enterprise Lin&x pro0i%es three s&ch &tilities:
*sbin*ch$con'g ? The *sbin*ch$con'g &tility is a simple comman% line maintaining the *etc*rc%*init%* %irectory hierarchy
*&sr*sbin*ntsys0 ? The nc&rses-base% *sbin*ntsys0 &tility pro0i%es an itext-base% interface, which some 'n% easier to &se than ch$con'g
#er0ices 9on'g&ration Tool ? The graphical #er0ices 9on'g&ration Toocon'g-ser0ices7 program is a exible &tility for con'g&ring r&nle0els
-
8/10/2019 RHEL Boot Process
18/21
-
8/10/2019 RHEL Boot Process
19/21
-
8/10/2019 RHEL Boot Process
20/21
-
8/10/2019 RHEL Boot Process
21/21