Skip to main content
p. 120

5.3 Kernel Parameters

When the Linux kernel starts, it receives a set of text-based kernel parameters containing a few additional system details. The parameters specify many different types of behavior, such as the amount of diagnostic output the kernel should produce and device driver–specific options.

You can view the parameters passed to your system’s currently running kernel by looking at the /proc/cmdline file:

$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.15.0-43-generic root=UUID=17f12d53-c3d7-4ab3-943e
-a0a72366c9fa ro quiet splash vt.handoff=1

The parameters are either simple one-word flags, such as ro and quiet, or key=value pairs, such as vt.handoff=1. Many of the parameters are unimportant, such as the splash flag for displaying a splash screen, but one that is critical is the root parameter. This is the location of the root filesystem; without it, the kernel cannot properly perform the user space start.

The root filesystem can be specified as a device file, as in this example:

root=/dev/sda1

On most contemporary systems, there are two alternatives that are more common. First, you might see a logical volume such as this:

root=/dev/mapper/my-system-root

You may also see a UUID (see Section 4.2.4):

root=UUID=17f12d53-c3d7-4ab3-943e-a0a72366c9fa
p. 121

Both of these are preferable because they do not depend on a specific kernel device mapping.

The ro parameter instructs the kernel to mount the root filesystem in read-only mode upon user space start. This is normal; read-only mode ensures that fsck can check the root filesystem safely before trying to do anything serious. After the check, the bootup process remounts the root filesystem in read-write mode.

Upon encountering a parameter that it doesn’t understand, the Linux kernel saves that parameter. The kernel later passes the parameter to init when performing the user space start. For example, if you add -s to the kernel parameters, the kernel passes the -s to the init program to indicate that it should start in single-user mode.

If you’re interested in the basic boot parameters, the bootparam(7) manual page gives an overview. If you’re looking for something very specific, you can check out kernel-params.txt, a reference file that comes with the Linux kernel.

With these basics covered, you should feel free to skip ahead to Chapter 6 to learn the specifics of user space start, the initial RAM disk, and the init program that the kernel runs as its first process. The remainder of this chapter details how the kernel loads into memory and starts, including how it gets its parameters.