linux boot process interview questions

Understanding the Linux Boot Process – CompTIA Linux+, LPIC-1

DevOps / Sys Admin Q & A #17 : Linux startup process site search: Linux Boot Process

If we want to be good at troubleshooting, its important that we understand how linux systems work.

The starting point, of course, is to know the startup process. The BIOS

The first step of the boot process is the BIOS (Basic Input Output System).

The BIOS initializes hardware, including detecting hard drives, USB disks, CD-ROMs, network cards, and any other hardware.

The BIOS will then step through each boot device based on the boot device order it is configured to follow until it finds one it can successfully boot from.

In the case of a Linux server, that usually means reading the MBR (master boot record: the first 512 bytes on a hard drive) and loading and executing the boot code inside the MBR to start the boot process.

Picture credit: Basics of the Linux Boot Process

GRUB and Linux Boot Loaders

After the BIOS initializes the hardware and finds the first device to boot, the boot loader takes over.

The following list shows the boot loader depending on the device from a boot starts:

  • GRUB : boot from a hard drive
  • syslinux : boot from a USB
  • isolinux : boot from a CD-ROM
  • pxelinux : boot from a network
  • The Kernel

    Once we select a particular kernel in GRUB, GRUB will load the Linux kernel into RAM and execute it.

    Usually GRUB will also load an initrd (initial RAM disk) along with the kernel.

    The initrd (initial RAM disk) has some crucial configuration files, kernel modules, and programs that the kernel needs in order to find and mount the real root file system.

    The final step is to execute the /sbin/init program, which takes over the rest of the boot process. /sbin/init

    The /sbin/init program is the parent process of every program running on the system.

    This process always has a PID of 1 and is responsible for starting the rest of the processes that make up a running Linux system.

    Here is the list of how we initialize a NIX OS: Linux-Init-System.png

  • System V init such as runlevels and /etc/rc?.d directories – the init process reads a configuration file called /etc/inittab to discover its default runlevel. It then enters that runlevel and starts processes that have been configured to run at that runlevel.
    1. Debian 6 and earlier
    2. Ubuntu 9.04 and earlier
    3. CentOS 5 and earlier
  • Upstart – Upstart was designed not only to address some of the shortcomings of the System V init process, but also to provide a more robust system for managing services. One main feature of Upstart is that it is event-driven. Upstart constantly monitors the system for certain events to occur, and when they do, Upstart can be configured to take action based on those events. Upstart scripts reside in /etc/init.
    1. Ubuntu 9.10 to Ubuntu 14.10, including Ubuntu 14.04
    2. CentOS 6
  • systemd is the init system for the most recent distributions:
    1. Debian 7 and Debian 8
    2. Ubuntu 15.04 –
    3. CentOS 7 –
  • Startup services

    How to list services that run on startup?


    To list all Upstart services and run initctl show-config on them, this one-liner may be helpful:

    System V

    For init scripts:

    For runlevel symlinks:

    SystemD (How To Use Systemctl to Manage Systemd Services and Units)

    To list all services:

  • cat /etc/*-release
  • cat /etc/issue
  • cat /proc/version
  • lsb_release -a
  • uname -a
  • /proc file system

    /proc is very unique in that it is not a real filesystem. Its sometimes referred to as a process information pseudo-file system. It doesnt contain real files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc).

    For this reason it can be regarded as a control and information center for the kernel. In fact, quite a lot of system utilities are simply calls to files in this directory.

    For example, lsmod is the same as cat /proc/modules while lspci is a synonym for cat /proc/pci.

    The most weird thing about files in this directory is the fact that all of them have a file size of 0, with the exception of “kcore” and “self”.

    The directory listing looks similar to the following:

    We may wonder how we can see details of a process that has a file size of 0. It makes more sense if we think of it as a window into the kernel. The file doesnt actually contain any data; it just acts as a pointer to where the actual process information resides.

    Check Linux Filesystem Hierarchy

    DevOps / Sys Admin Q & A

    Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization

    Sponsor Open Source development activities and free contents for everyone.

    Linux Interview Questions and Answers 2022 (UPDATED)

    Linux is a type of open-source OS. OS stands for Operating System. Let’s have a detailed explanation of Linux interview questions and answers. The operating system defines the particular software which helps in the direct management of hardware and the resources of the system, it has its position between the hardware and applications.

    It makes a connection between the complete software and the physical resource responsible for performing the work.

    OS can be seen as a car engine that does not need any support to run, but it becomes meaningful when associated with an operating car. It acts as the core factor which binds all the other elements, and without its help, no work can be done.

    BIOS -> MBR -> Grub -> Kernel -> Init (it process, /etc/inittab -> starts /etc/rc.sysinit and /etc/rcX.d ).

    Interview questions on booting process. 1.) Explain booting process ? 2) How do you recover grub ? 3) How to crack grub password ? 4) I want to run one prog which is not part of kernel default file; where i can edit it? 5) Default location of grub file and contents of it.


    What are the steps of the boot process in Linux?

    The boot process is usually initialized when a user presses the power-on button – if the PC was already shut down – or reboots the system using either the GUI or on the command line. When the Linux system powers up, the BIOS (Basic Input Output System) kicks in and performs a Power On Self Test (POST).

    What is the use of boot in Linux?

    In Linux, there are 6 distinct stages in the typical booting process.
    1. BIOS. BIOS stands for Basic Input/Output System. …
    2. MBR. MBR stands for Master Boot Record, and is responsible for loading and executing the GRUB boot loader. …
    3. GRUB. …
    4. Kernel. …
    5. Init. …
    6. Runlevel programs.

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *