Translation(s): English - 简体中文

Prerequisites: To get the most from this article, understand these concepts and terms before reading: basic Core Utilities, configuration files, kernel, files, directories, symlinks


These sections were copied here from the Debian Reference originally written by: Copyright © 2001–2005 by Osamu Aoki <>. Copyright (Chapter 2) © 1996–2001 by Software in the Public Interest.

This document may be used under the terms of the GNU General Public License version 2 or higher.

System Initialization

The computer system undergoes several phases of initialization from the power-on event until it offers the fully functional operating system (OS) to the user.

Here is a rough sequence of events for the default installation of Debian with the Linux kernel on the typical PC platform.

  1. Execution of the BIOS code.
  2. Execution of the boot loader code (alternatively called initial program loader, IPL).
  3. Execution of /init program under the Linux kernel with the expanded initramfs image in memory as the temporary root file system.
  4. Execution of /sbin/init under the Linux kernel while switching the root file system to the hard disk.

Of course, these can be configured differently. For example, if you compiled your own kernel, you may be skipping the step with the initramfs image. So please do not assume this is the case for your system until you check it yourself.

Let me provide a general overview of this system initialization process. For simplicity, I'll limit discussion to the typical i386 PC platform.


When the power-on event happens, the computer hardware initializes itself and executes BIOS code residing on the read only memory (ROM) from the particular memory location.

Basically this BIOS code performs the basic initialization of the hardware (POST: power on self test) and hands the system control to the next step which you provide. The BIOS code is usually provided with the hardware.

The BIOS startup screen usually indicates what key(s) to press to enter the BIOS setup screen to configure the BIOS behavior. Popular keys used are F1, F2, F10, Esc, Ins, and Del. If your BIOS startup screen is hidden by a nice graphics screen, you may press some keys such as ESC to disable this. These keys are highly dependent on the hardware.

The hardware location and the priority of the code started by the BIOS can be selected from the BIOS setup screen. Typically, the first few sectors of the first found selected device (hard disk, floppy disk, CD-ROM, ...) are loaded to the memory and this initial code is executed. This initial code can be:

Some modern BIOS may also offer more capability such as the PXE network boot loader which loads initial code via network.

Typically, the system is booted from the specified partition of the primary hard disk partition. The first 2 sectors of the hard disk contain the master boot record (MBR). The disk partition information including the boot selection is recorded at the end of this MBR. The first boot loader code executed from the BIOS for the hard disk occupies the rest of this MBR.

Boot loader

The default install of the Debian system places first stage GRUB boot loader code into the MBR for the PC platform. There are many boot loaders and configuration options available.


The preferred boot loader code which is smart enough to understand disk partitions and file systems such as vfat, ext3, ... during the boot process. The loading of the intrd image is supported.

Here initrd is used as a generic term from the boot loader perspective indicating both traditional initrd RAM disk image and new initramfs RAM disk image used for the 2.6 kernel.

For GRUB, the menu configuration file is located at /boot/grub/menu.lst.

/init on the initramfs RAM disk image

The current default Debian system uses the 2.6 series Linux kernel with the initramfs RAM disk image which is a gzipped cpio archive when booted initially. The /init program is executed in this initramfs as a shell script program which initializes the kernel in the user space and hands control over to /sbin/init on the hard disk while switching to the root file system.

This is a preparatory part of boot process. It's an optional process and offers flexibility to the boot process such as adding kernel modules before the main boot process or mounting the root file system as an encrypted one. The commands used in this environment is a stripped down Unix system provided by the busybox etc. Please note that some commands, such as mount, use slightly different syntax.

You can interrupt this part of the boot process to gain root shell by providing break=init etc. to the kernel boot parameter. See /init source for more.

/sbin/init on the hard disk (Init Scripts)

This is the main part of the boot process. The runlevel at the start of this process is "N" (none).

The /sbin/init program initializes the system following the description in the /etc/inittab configuration file. Debian normally uses the traditional sysvinit scheme with the sysv-rc package. See man 8 init, man 5 inittab, and /usr/share/doc/sysv-rc/README.runlevels.gz for the exact explanation.

Following is a simplified overview of this boot process.

  1. The Debian system goes into runlevel S to initialize the system under the single-user mode to complete hardware initialization etc.
  2. The Debian system switches itself to one of the specified multi-user runlevels (2 to 5) to start the system services.

The initial runlevel used for multi-user mode is specified with the "init=" kernel boot parameter or in the "initdefault" line of /etc/inittab. The Debian system as installed starts at the runlevel 2.

All scripts executed by the init system are located in the directory /etc/init.d/. There are four other directories which correspond to the multi-user runlevels:

These directories contain relative links to the scripts in /etc/inint.d/. The names of the symlinks in the runlevel directories have the form S<2-digit-number><original-name> or K<2-digit-number><original-name>. The 2-digit-number is used to determine the order in which to run the scripts. When init or telinit commands change the runlevel to <n>:

  1. the script names starting with a K in /etc/rc<n>.d/ are executed in alphabetical order with the single argument stop . (killing services)

  2. the script names starting with an S in /etc/rc<n>.d/ are executed in alphabetical order with the single argument start . (starting services)

For example, if you had the links S10sysklogd and S20exim4 in a runlevel directory, S10sysklogd would run before S20exim4.

The meanings of all the runlevels are as follows:




The configuration decision on the use of the runlevels between 2 and 5, is solely left to the system administrator on the Debian system.

/!\ It is not advisable to make any changes to symlinks in /etc/rcS.d/.