Press the power button on your system, and after few moments you see the Linux login prompt.
Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login prompt appears?
The following are the 6 high level stages of a typical Linux boot process.

1. BIOS
- BIOS stands for Basic Input/Output System
- Performs some system integrity checks
- Searches, loads, and executes the boot loader program.
- It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.
- Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
- So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR
- MBR stands for Master Boot Record.
- It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
- MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.
- It contains information about GRUB (or LILO in old systems).
- So, in simple terms MBR loads and executes the GRUB boot loader.
3. GRUB
- GRUB stands for Grand Unified Bootloader.
- If you have multiple kernel images installed on your system, you can choose which one to be executed.
- GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
- GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
- Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5PAE)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/
initrd /boot/initrd-2.6.18-194.el5PAE.img
4. Kernel
- Mounts the root file system as specified in the “root=” in grub.conf
- Kernel executes the /sbin/init program
- Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
- initrd stands for Initial RAM Disk.
- initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
5. Init
- Looks at the /etc/inittab file to decide the Linux run level.
- Following are the available run levels
- 0 – halt
- 1 – Single user mode
- 2 – Multiuser, without NFS
- 3 – Full multiuser mode
- 4 – unused
- 5 – X11
- 6 – reboot
- Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
- Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
- If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.
- Typically you would set the default run level to either 3 or 5.
6. Runlevel programs
- When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.
- Depending on your default init level setting, the system will execute the programs from one of the following directories.
- Run level 0 – /etc/rc.d/rc0.d/
- Run level 1 – /etc/rc.d/rc1.d/
- Run level 2 – /etc/rc.d/rc2.d/
- Run level 3 – /etc/rc.d/rc3.d/
- Run level 4 – /etc/rc.d/rc4.d/
- Run level 5 – /etc/rc.d/rc5.d/
- Run level 6 – /etc/rc.d/rc6.d/
- Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
- Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.
- Programs starts with S are used during startup. S for startup.
- Programs starts with K are used during shutdown. K for kill.
- There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.
- For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.
There you have it. That is what happens during the Linux boot process.
Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.Get the Linux Sysadmin Course Now!
If you enjoyed this article, you might also like..
|
|
|
|






My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 97 comments… read them below or add one }
Excellent……!!! 2011 seems to be rocking for TGS viewers….
@Ramesh: This is offtopic discussion. Could you write a article on ack. Thanks
you are rock,,, lol
nice,
Great article
You could also write few words about grub2 – configuration files for grub doesn’t work in grub2. (Tested in ubuntu)
very very nice,
tanx
Hello Ramesh,
It would have been better if if you could have explained more on each topic. Probably each high level boot process would need a separate page.
This doc is good for begineers.
Thanks,
Ajeya Krishna K R
Good Graphics
Great Tutorial
Keep it up
nice piece of information
thanks lot
Amazingggggggg good job Guys carry on
Thank u…
very well explained !!!!!!!!
Thanx alot…..
plz explain GRUB in detail…….How to use GRUB command prompt at system startup ??
These are very helpful. Keep ‘em coming please!
Excellent !!! TGS Rocks…
thanks alot, just in time to futher clarify things lol..As always, TGS rocks!!!
I learn to much with your blog. Thank you.
Regards,
Júlio.
I know the terms GRUB, KERNEL,INIT, MBR. But i do not know how they work together. Thanks to Ramesh Natarajan, for his blog and useful posts.
Thank you RAMESH. this was so good…
The file that most would want is. The menu.list that is in the /boot/grub/ directory on my debian system. I often edit this file for a manual kernel update,time out,boot image change.
Short and Sweet
Really nice document for quick reference to Linux boot process!!!
Great article, thank you
Good one. Thanks.
plz explain about how to configure zimbra mail server and how to migrate sendmail to zimbra
An excelent article, I see another great article here.
This is very helpful I was looking for similar one..thanks
Great article Ramesh! But is not completely valid for Ubuntu, which use upstart. Nothing on /etc/inittab, for eg.
Good doc.
Thanks
Love this site, your explanations are excellent, and I like how you define terms and acronyms. Sometimes a man page can make my head spin – your site is the antidote to that – thanks!!
the best explanation ever …
thanks TGS
How many times did i ask myself how to find out order of linuxs’ start ?
when this time i saw your blog via TSG, i see thoroughly.
thanks a million
Best Regards
Robin Guo
Awesome !! For beginners helped a lot..
Excellent, in detail and simple. Thanks very much
Actaully i have failed in my first interview for not answering the above question,but after reading the above answer.i ensure i will get success.its really gud explanation,especially beginners lyk me.Thanks a lot
great article! very useful! thanks a lot.
really…….my total confuse remove after read this article.Thank you………….
Are you sure that “Depending on your default init level setting, the system will execute the programs from one of the following directories.” ?
For example my system is running on level 3 but executes VERITAS init scripts from rc2.d during the boot as well.
Very Nice.
Excellent !!!!!!!!!!!!!!!!!!!!!
Enough detail and simple .
Thanks very much
Best regard,
rajesh
good work fine to know how linux boot and the basic’s of the init run level’s only by ubuntu you have init s (single user) and init u (re run init) as extra
wow, your explaination is simple yet full with information
very helpful ! <3
greate usefull
I am flabbergasted.. I have made automation on these parts on S and K .,.. It was too Easy to understand this.. The person who post this.. is really a cool techie.. U rock man..
That was very useful information.
Thanks.
Excellent. keep it up..
Nice. Very useful
short and sweet and precise explanation
very good material and easy to understand …great work
Thanks dude, that was so helpful..
it’s very nice material…..i like it……..superb ………
HI this is very very useful information as interview point of view as well as for study how Linux boots. Great info Thank you very much Ramesh
Great and brief doc for Linux boot process. I truly liked it!!!
Thanx
Superb article with detailed information.
It is very nice article
how to create kickstart server in rhel 6.0
Excellent stuff from TGS!!!
gr8 article , got a lot of other info while reading this awesome stuff, thx alot
Great…very well explained…
Very nice, very neatly explained.
Keep on the work going
Nice Stuff !!
Thanks a lot !!
really…….my total confuse remove after read this article.Thank you………….
Good One, will be helpfull for new leaners!!!
excellent
Its very Good article and helpful for linux beginers
Excellent …
You can bypass the first three stage using kexec program for fast boot. This saves time when you have to reboot a lot for tuning system or handling init script.
Debian provides it as kexec-tools package.
Find the kernel options:
$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.4.0-10.dmz.1-liquorix-amd64 root=UUID=07cf8c3a-d5a5-4b41-833f-16a9afebf70c ro quiet
Add a kernel image:
vmlinuz is the kernel image file I uses. If the kernel image uses initrd file, add –initrd option. Without it kernel will panic next boot.
$ sudo kexec -l /vmlinuz –append=”root=UUID=07cf8c3a-d5a5-4b41-833f-16a9afebf70c
ro quiet” –initrd=/initrd.img
Or
In my Linux box, boot partition is /dev/sda1
$ sudo kexec -l /vmlinux –append=”root=/dev/sda1 ro quiet” –initrd=/initrd.img
Start warm boot:
$ sudo kexec -e
Linux will boot up without going through BIOS, MBR, and Grub.
thanks
Excellent.., and thank you a lot..,
Excellent and simple explanation and a great deal for beginners !! Thank you.
very nice
Hi its excellent. Thanks.
thanks friend…….
what is 1st stage boot loader and what is 2nd stage boot loader ? kindly clear this point also.
I am working on Linux since decade. Some times I am unable explain the basic stuff like this. Thanks for explaining Ramesh Natarajan. Today onwards, I am the member of your fan club.
Thanks for this excellent article………….
Hello,
Description is good and very easy to understand, thanks for this.
If possible please explain in detail about each and every config file or script, how is jumping from on script/config-file to another
Anyways I am happy for this post.
Thank you once more….
Excellent material. So simple to understand it. Doing a great job!!!!!
The Article is good And explained Simple …
tnx 4 this
Thanks for this excellent article……
its a superb article……….and simple and superb explanation.
This is really nice article. Appreciate your excellent work.
sir now i am using windows7 and linux in one computer.i dont want to use linux that have 250gb harddisk then how to boot(delete) a linux and how to plaace 250gb in windows7? Pls hlp me.
Thanks Mr.Linux natarajan
it was simply good.
thanks dude
good keep itup
Very Good Explanation.
Thank you very much .
Hey,you explained all,excellent.Thanks
Thanks Friend
thnkss ..very useful fo me..;)
Great Man…..
its really useful.
Oh yes .. this is what i am seeking for .. something simple and effective ..
i don’t know why most people who talk about boot process and FHS love to make it
very difficult…
but you my friend .. u r brilliant .. this really easy and useful explanation ..
thanks as enormous as the sky
good explanation & easy to understand!!!
excellent, very well explained
Good article ….