Skip to main content
Engineering LibreTexts

07-A.4: Boot Process

  • Page ID
    32939
  • The Boot Process

    The Linux startup process is the multi-stage initialization process performed during booting a Linux installation. It is in many ways similar to the BSD and other Unix-style boot processes, from which it derives.

    Booting a Linux installation involves multiple stages and software components, including firmware initialization, execution of a boot loader, loading and startup of a Linux kernel image, and execution of various startup scripts and daemons.

    1. The BIOS performs startup tasks specific to the actual hardware platform. The hardware is enumerated and the hardware which is necessary for boot is initialized. Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
    2. The MBR / GPT loads and executes the boot code from the configured boot device. The MBR / GPT loads and executes the GRUB boot loader.
    3. The boot loader (GRUB2) often presents the user with a menu of possible boot options and has a default option, which is selected after some time passes. Once the selection is made, the boot loader loads the kernel into memory, supplies it with some parameters and gives it control.
    4. The kernel, if compressed, will decompress itself. It then sets up system functions such as essential hardware and memory paging, and calls start_kernel() which performs the majority of system setup (interrupts, the rest of memory management, device and driver initialization, etc.). It then starts up, separately, the idle process, scheduler, and the init process, which is executed in user space.
    5. The init either consists of scripts that are executed by the shell (sysv, bsd, runit) or configuration files that are executed by the binary components (systemd, upstart). Init has specific levels (sysv, bsd) or targets (systemd), each of which consists of specific set of services (daemons). These provide various non-operating system services and structures and form the user environment. A typical server environment starts a web server, database services, and networking.
    6. The typical desktop environment begins with a daemon, called the display manager, that starts a graphic environment which consists of a graphical server that provides a basic underlying graphical stack and a login manager that provides the ability to enter credentials and select a session. After the user has entered the correct credentials, the session manager starts a session. A session is a set of programs such as UI elements (panels, desktops, applets, etc.) which, together, can form a complete desktop environment.

    What is a Kernel Panic

    A kernel panic is a safety measure taken by an operating system's kernel upon detecting an internal fatal error, in which it either is unable to safely recover or cannot have the system continue to run without having a much higher risk of major data loss. The term is largely specific to Unix and Unix-like systems.

    A panic may occur as a result of a hardware failure or a software bug in the operating system. In many cases, the operating system is capable of continued operation after an error has occurred. However, the system is in an unstable state and rather than risking security breaches and data corruption, the operating system stops to prevent further damage and facilitate diagnosis of the error and, in usual cases, restart.

    After recompiling a kernel binary image from source code, a kernel panic while booting the resulting kernel is a common problem if the kernel was not correctly configured, compiled or installed. Add-on hardware or malfunctioning RAM could also be sources of fatal kernel errors during start up, due to incompatibility with the OS or a missing device driver. A kernel may also go into panic() if it is unable to locate a root file system. During the final stages of kernel userspace initialization, a panic is typically triggered if the spawning of init fails. A panic might also be triggered if the init process terminates, as the system would then be unusable.

    Adapted from:
    "Linux startup process" by Multiple ContributorsWikipedia is licensed under CC BY-SA 3.0
    "Kernel panic" by Multiple ContributorsWikipedia is licensed under CC BY-SA 3.0

    • Was this article helpful?