What is the startup of the Linux system

Linux practical book / The boot process

This article describes the start-up process of a computer, which ultimately leads to a Linux kernel being loaded into main memory and taking control of the computer. This process is usually also referred to as boot (spoken: Buuten). The details of the boot process depend on the specific hardware architecture. Since Linux is available for many platforms, it is beyond the scope of this article to cover all of the variations here. The article is therefore essentially limited to the boot process for the PC.

From the computer start to the loading program [edit]

After starting the computer, the BIOS (Basic input output system) active. This is a program in the computer's permanent memory. The BIOS carries out a series of test and initialization routines, which are finally concluded when the boot routine is called.

At this point in time, it is already known which mass storage media exist in the computer. The BIOS itself manages a list of devices that can be used to start the loading process of an operating system. The first device in this list that is actually connected and contains a medium is selected by the boot routine. The code from the first sector of this device, the so-called master boot record, is loaded into the main memory.

The processes up to this point are completely independent of the operating system installed. In particular, any program can be stored in the master boot record, e.g. a virus, a memory check program, a loader program or a (very small) operating system. Since a sector is only 512 bytes, its size is limited. In fact, only the first 446 bytes are intended for program code, the rest is required for the partition table, among other things. The file that contains the Linux kernel (called the kernel image) is structured in such a way that the first 512 bytes contain a regular master boot record. It is thus possible to write the kernel directly to a boot medium in order to start it. However, there are a number of reasons in favor of using a separate loading program.

The following two flow charts provide a detailed view of the processes up to the start of the loading program. A precise understanding of all the details is usually not necessary. Should the loading program not even be called during the start-up process, one should keep in mind that this can have a number of causes.

Loaders [edit]

The program type that is used as the loader program is also known as Boot loader designated. In principle, loading programs can act independently of the operating system to be loaded (although manufacturers of operating systems are free to design their installed loading program so that only their "own" operating system can be loaded). Linux distributors usually use flexible loading programs that are also able to boot other types of operating systems (such as Windows or another Unix). In addition to its main task from the system point of view, the loading of the operating system, the load program also has the task of a Selection of the operating system if several operating systems are installed on the computer concerned.

Various loading programs [edit]

The two loaders LILO and GRUB are the most common in the Linux community. An alternative that is currently even less common is XOSL. As in other areas of the Linux world, such competition between different solutions is advantageous from a technical point of view, but requires more knowledge from the user or administrator if he works on different Linux installations.

The basic problem

The basic problem that all the different loading programs have to solve is that the operating system (e.g. the Linux kernel that is to be loaded) is available as a file on a hard disk partition, but that a loading program does not understand files due to its early start time and has file systems. The concept of a file only emerges from the operating system point of view, while a loader program without additional information only knows physical blocks on the respective medium. Since the operating system is just about to be loaded, it cannot help you find the right blocks. One way to solve this problem is to use so-called map files or short Maps. A map contains the "addresses" of the physical blocks of the medium to be loaded in the correct order. These are precisely the blocks that, when put together, make up the kernel file. So the loader is able to load the file into memory without even having any concept of files.

LILO and GRUB [edit]

The solution described is implemented by LILO. GRUB, on the other hand, works with file system drivers and can therefore access the kernel file directly via path names. One advantage of Grub is the interactive shell, from which you can start operating systems that are not in the configuration file or with incorrect calls. In addition, the Grub startup files do not need to be changed when changing the configuration. With Lilo, on the other hand, you have to inform the bootloader of every change to the configuration, which firstly takes longer and is more cumbersome and secondly can be problematic with non-Linux systems. The other explanations apply regardless of the loading program used. We assume that a Linux kernel is to be loaded.

GRUB info [edit]

At GRUB should be noted that a new version 2 has been available for several years and is not compatible with versions 0.9x. Please refer

Pass boot parameters [edit]

The Linux kernel can be loaded with a large number of different parameters, most of which influence the presence or absence of certain performance characteristics. This is of particular interest in the event of an error: If there are problems operating a hard disk in DMA mode, a parameter can be passed to the kernel that prevents the hard disk from being controlled in DMA mode. If this was not possible, it might no longer be possible to start up the relevant system. Most loading programs enable the transfer of such parameters in two ways. On the one hand, standard parameters that you want to transfer at every system start can be recorded in a configuration file. On the other hand, the parameters can be varied via an input line when the system is started.

Load kernel file into memory [edit]

After the kernel to be loaded has been selected and any other boot parameters entered, the loader program loads the kernel into main memory. There are basically two variants of Linux to be distinguished here. For one thing, the kernel uncompressed are present. The entry point for execution is then identical to the beginning of the kernel code. On the other hand, the kernel compressed be. In this case, the kernel was preceded by a small program section that is responsible for unpacking the kernel and finding the correct entry point. An uncompressed kernel file can be recognized by its name after compilation vmlinux. A compressed kernel file is called vmlinuz, zImage or bzImage. These files can of course be renamed later. So let's assume that the kernel has been loaded and the correct entry point has been found.

The kernel starts by [edit]

init [edit]

The init program can be found in / sbin like other normal system administration programs. It is responsible for starting or ending certain init scripts that can be found in /etc/init.d. Which scripts are called when during the boot process is determined by so-called runlevels. The individual runlevels are defined by the directories /etc/init.d/rc.0.d to rc.6.d and rc.S.d and by / etc / inittab. The inittab is the configuration file in which it is determined when during the boot process in which runlevel and the associated init scripts are executed.

runlevel [edit]

menu.lst [edit]

If you have installed a grub loader, you can use the grub boot menu in the file menu.lst change.

The menu.lst file is usually in the / boot or / boot / grub directory

To edit the file you need root rights.

How does that work in practice?

You go to the console and give see below and the root password. (Knoppix has no root password, so just enter su)

see below

Change to the directory / boot / grub

cd / boot / grub

You load the file menu.lst into an editor

pico menu.lst

You go to the last lines in which the menu entries are located.

All lines with # begin are only comments and do not change anything in the program sequence.

You can cut a line with Ctrl + K and insert it again with Ctrl + U.

If you have changed everything as you wish, you can save the file again.

Ctrl + o

And leave Pico

Ctrl + x.

Then you restart the system and look at the new menu of the grubloader.

Setkey [edit]

In the menu.lst you can with setkey change the keyboard layout.

The following setting for setkey changes the keyboard layout on the German keyboard:

setkey yz setkey zy setkey YZ setkey ZY setkey equal parenright setkey parenright parenleft setkey parenleft asterisk setkey doublequote at setkey plus bracketright setkey minus slashs setkey slash ampersand setkey ampersand percent setkey percent caret setkey underscore question setkey question underscore setkey backsignlash less setkey numbers setkey numbers setkey colon greater setkey greater bar setkey asterisk braceright