The Linux Boot Process, in Short

I need to be able to explain the Linux boot process at work, so I’m going to outline it here.  After the BIOS checks your hardware and lists bootable devices in the system, here’s what’s loaded:

  1. Boot Loader: Presents you with a list of operating systems or kernel configurations to load.  (Example: Master Boot Record + GRUB)
  2. Kernel: The selected kernel, if compressed, decompresses itself.  start_kernel() is called, which sets up interrupts, memory management, and device drivers.  Then the idle process and scheduler are started.
  3. Init: Establishes and operates the user environment.  A series of scripts or config files are executed by systemd or upstart.  User space services are started.  For example, networking, a web server, and database services are started in this phase.
linuxbootprocess
Linux Boot Process (Image Credit: developer.ibm.com)

That’s the core of it.  A few notes:

  • You may not actually need a boot loader if you have a UEFI system where the Linux kernel payload can be executed directly.
  • After init is complete, if you prefer to run in graphical mode, a display and login manager are started, and the session manager starts a session after you login.
  • On shutdown, init is called to terminate user space services.  It then makes a system call to the kernel to shut the system down.

If you want to learn more about how Linux boots, I recommend Yogesh Babar’s book Hands-on Booting, which goes into the process in depth, along with troubleshooting  steps for when it fails to boot.  You can also check out the Wikipedia entries linked above.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s