What is linux kernel parameters

The kernel’s command-line parametersВ¶

The following is a consolidated list of the kernel parameters as implemented by the __setup(), core_param() and module_param() macros and sorted into English Dictionary order (defined as ignoring all punctuation and sorting digits before letters in a case insensitive manner), and with descriptions where known.

The kernel parses parameters from the kernel command line up to “–”; if it doesn’t recognize a parameter and it doesn’t contain a ‘.’, the parameter gets passed to init: parameters with ‘=’ go into init’s environment, others are passed as command line arguments to init. Everything after “–” is passed as an argument to init.

Module parameters can be specified in two ways: via the kernel command line with a module name prefix, or via modprobe, e.g.:

Parameters for modules which are built into the kernel need to be specified on the kernel command line. modprobe looks through the kernel command line (/proc/cmdline) and collects module parameters when it loads a module, so the kernel command line can be used for loadable modules too.

Hyphens (dashes) and underscores are equivalent in parameter names, so:

can also be entered as:

Double-quotes can be used to protect spaces in values, e.g.:

cpu lists:В¶

Some kernel parameters take a list of CPUs as a value, e.g. isolcpus, nohz_full, irqaffinity, rcu_nocbs. The format of this list is:

Note that for the special case of a range one can split the range into equal sized groups and for each group use some amount from the beginning of that group:

For example one can add to the command line following parameter:

where the final item represents CPUs 100,101,125,126,150,151.

This document may not be entirely up to date and comprehensive. The command “modinfo -p $” shows a current list of all parameters of a loadable module. Loadable modules, after being loaded into the running kernel, also reveal their parameters in /sys/module/$/parameters/. Some of these parameters may be changed at runtime by the command echo -n $ > /sys/module/$/parameters/$ .

The parameters listed below are only valid if certain kernel build options were enabled and if respective hardware is present. The text in square brackets at the beginning of each description states the restrictions within which a parameter is applicable:

In addition, the following text indicates that the option:

Parameters denoted with BOOT are actually interpreted by the boot loader, and have no meaning to the kernel directly. Do not modify the syntax of boot loader parameters without extreme need or coordination with .

There are also arch-specific kernel-parameters not documented here. See for example .

Note that ALL kernel parameters listed below are CASE SENSITIVE, and that a trailing = on the name of any parameter states that that parameter will be entered as an environment variable, whereas its absence indicates that it will appear as a kernel argument readable via /proc/cmdline by programs running once the system is up.

The number of kernel parameters is not limited, but the length of the complete command line (parameters including spaces etc.) is limited to a fixed number of characters. This limit depends on the architecture and is between 256 and 4096 characters. It is defined in the file ./include/asm/setup.h as COMMAND_LINE_SIZE.

Finally, the [KMG] suffix is commonly described after a number of kernel parameter values. These ‘K’, ‘M’, and ‘G’ letters represent the _binary_ multipliers ‘Kilo’, ‘Mega’, and ‘Giga’, equaling 2^10, 2^20, and 2^30 bytes respectively. Such letter suffixes can also be entirely omitted:

Источник

Kernel parameters

There are three ways to pass options to the kernel and thus control its behaviour:

  1. When building the kernel—in the kernel’s config file. See Kernel#Compilation for details.
  2. When starting the kernel—using command line parameters (usually through a boot loader).
  3. At runtime—through the files in /proc/sys/ (see sysctl) and /sys/ .

Between the three methods, the configurable options differ in availability, their name and the method in which they are specified. This page only explains the second method (kernel command line parameters) and shows a list of the most used kernel parameters in Arch Linux.

Читайте также:  Vas 5054 драйвер windows 10

Most parameters are associated with subsystems and work only if the kernel is configured with those subsystems built in. They also depend on the presence of the hardware they are associated with.

Kernel command line parameters either have the format parameter or parameter=value .

Contents

Configuration

Kernel parameters can be set either temporarily by editing the boot entry in the boot loader’s boot selection menu, or permanently by modifying the boot loader’s configuration file.

The following examples add the quiet and splash parameters to Syslinux, systemd-boot, GRUB, GRUB Legacy, LILO, and rEFInd.

Syslinux

  • Press Tab when the menu shows up and add them at the end of the string:

Press Enter to boot with these parameters.

  • To make the change persistent after reboot, edit /boot/syslinux/syslinux.cfg and add them to the APPEND line:

For more information on configuring Syslinux, see the Syslinux article.

systemd-boot

  • Press e when the menu appears and add the parameters to the end of the string:

Press Enter to boot with these parameters.

  • To make the change persistent after reboot, edit /boot/loader/entries/arch.conf (assuming you set up your EFI system partition) and add them to the options line:

For more information on configuring systemd-boot, see the systemd-boot article.

  • Press e when the menu shows up and add them on the linux line:

Press Ctrl+x to boot with these parameters.

  • To make the change persistent after reboot, you could manually edit /boot/grub/grub.cfg with the exact line from above, or if using grub-mkconfig:

Edit /etc/default/grub and append your kernel options between the quotes in the GRUB_CMDLINE_LINUX_DEFAULT line: And then automatically re-generate the grub.cfg file with:

For more information on configuring GRUB, see the GRUB article.

GRUB Legacy

  • Press e when the menu shows up and add them on the kernel line:

Press b to boot with these parameters.

  • To make the change persistent after reboot, edit /boot/grub/menu.lst and add them to the kernel line, exactly like above.

For more information on configuring GRUB Legacy, see the GRUB Legacy article.

For more information on configuring LILO, see the LILO article.

rEFInd

  • Press + , F2 , or Insert on the desired menu entry and press it again on the submenu entry. Add kernel parameters at the end of the string:

Press Enter to boot with these parameters.

  • To make the change persistent after reboot, edit /boot/refind_linux.conf and append them between the quotes in all required lines, for example
  • If you have disabled auto-detection of OSes in rEFInd and are defining OS stanzas instead in esp/EFI/refind/refind.conf to load your OSes, you can edit it like:

For more information on configuring rEFInd, see the rEFInd article.

EFISTUB

dracut

dracut is capable of embedding the kernel parameters in the initramfs, thus allowing to omit them from the boot loader configuration. See dracut#Kernel command line options.

Hijacking cmdline

Even without access to your bootloader it is possible to change your kernel parameters to enable debugging (if you have root access). This can be accomplished by overwriting /proc/cmdline which stores the kernel parameters. However /proc/cmdline is not writable even as root, so this hack is accomplished by using a bind mount to mask the path.

First create a file containing the desired kernel parameters

Then use a bind mount to overwrite the parameters

The -n option skips adding the mount to /etc/mtab , so it will work even if root is mounted read-only. You can cat /proc/cmdline to confirm that your change was successful.

Parameter list

This list is not comprehensive. For a complete list of all options, please see the kernel documentation.

parameter Description
init Run specified binary instead of /sbin/init as init process. The systemd-sysvcompat package symlinks /sbin/init to /usr/lib/systemd/systemd to use systemd. Set it to /bin/sh to boot to the shell.
initrd Specify the location of the initial ramdisk. For UEFI boot managers and EFISTUB, the path must be specified using backslashes ( \ ) as path separators.
debug Enable kernel debugging (events log level).
lsm Set the initialisation order of the Linux security modules, used to enable AppArmor, SELinux or TOMOYO.
maxcpus Maximum number of processors that an SMP kernel will bring up during bootup.
mem Force usage of a specific amount of memory to be used.
netdev Network devices parameters.
nomodeset Disable Kernel mode setting.
panic Time before automatic reboot on kernel panic.
resume Specify a swap device to use when waking from hibernation.
ro Mount root device read-only on boot (default 1 ).
root Root filesystem. See init/do_mounts.c for kernel’s supported device name formats. Note that an initramfs with udev supports more name formats.
rootflags Root filesystem mount options. Useful for setting options that cannot be applied by remounting (i.e. by systemd-remount-fs.service(8) ). For example, the discard option of an XFS root volume.
rw Mount root device read-write on boot.
systemd.unit Boot to a specified target.
video Override framebuffer video defaults.
Читайте также:  Mixer box для windows

1 mkinitcpio uses ro as default value when neither rw or ro is set by the boot loader. Boot loaders may set the value to use, for example GRUB uses rw by default (see FS#36275 as a reference).

Источник

The kernel’s command-line parametersВ¶

The following is a consolidated list of the kernel parameters as implemented by the __setup(), core_param() and module_param() macros and sorted into English Dictionary order (defined as ignoring all punctuation and sorting digits before letters in a case insensitive manner), and with descriptions where known.

The kernel parses parameters from the kernel command line up to “–”; if it doesn’t recognize a parameter and it doesn’t contain a ‘.’, the parameter gets passed to init: parameters with ‘=’ go into init’s environment, others are passed as command line arguments to init. Everything after “–” is passed as an argument to init.

Module parameters can be specified in two ways: via the kernel command line with a module name prefix, or via modprobe, e.g.:

Parameters for modules which are built into the kernel need to be specified on the kernel command line. modprobe looks through the kernel command line (/proc/cmdline) and collects module parameters when it loads a module, so the kernel command line can be used for loadable modules too.

Hyphens (dashes) and underscores are equivalent in parameter names, so:

can also be entered as:

Double-quotes can be used to protect spaces in values, e.g.:

cpu lists:В¶

Some kernel parameters take a list of CPUs as a value, e.g. isolcpus, nohz_full, irqaffinity, rcu_nocbs. The format of this list is:

Note that for the special case of a range one can split the range into equal sized groups and for each group use some amount from the beginning of that group:

For example one can add to the command line following parameter:

where the final item represents CPUs 100,101,125,126,150,151.

This document may not be entirely up to date and comprehensive. The command “modinfo -p $” shows a current list of all parameters of a loadable module. Loadable modules, after being loaded into the running kernel, also reveal their parameters in /sys/module/$/parameters/. Some of these parameters may be changed at runtime by the command echo -n $ > /sys/module/$/parameters/$ .

The parameters listed below are only valid if certain kernel build options were enabled and if respective hardware is present. The text in square brackets at the beginning of each description states the restrictions within which a parameter is applicable:

In addition, the following text indicates that the option:

Parameters denoted with BOOT are actually interpreted by the boot loader, and have no meaning to the kernel directly. Do not modify the syntax of boot loader parameters without extreme need or coordination with .

There are also arch-specific kernel-parameters not documented here. See for example .

Note that ALL kernel parameters listed below are CASE SENSITIVE, and that a trailing = on the name of any parameter states that that parameter will be entered as an environment variable, whereas its absence indicates that it will appear as a kernel argument readable via /proc/cmdline by programs running once the system is up.

The number of kernel parameters is not limited, but the length of the complete command line (parameters including spaces etc.) is limited to a fixed number of characters. This limit depends on the architecture and is between 256 and 4096 characters. It is defined in the file ./include/asm/setup.h as COMMAND_LINE_SIZE.

Finally, the [KMG] suffix is commonly described after a number of kernel parameter values. These ‘K’, ‘M’, and ‘G’ letters represent the _binary_ multipliers ‘Kilo’, ‘Mega’, and ‘Giga’, equaling 2^10, 2^20, and 2^30 bytes respectively. Such letter suffixes can also be entirely omitted:

Читайте также:  Драйвера для ati mobility radeon x2300 для windows 10

Источник

The kernel’s command-line parameters¶

The following is a consolidated list of the kernel parameters as implemented by the __setup(), early_param(), core_param() and module_param() macros and sorted into English Dictionary order (defined as ignoring all punctuation and sorting digits before letters in a case insensitive manner), and with descriptions where known.

The kernel parses parameters from the kernel command line up to “ — “; if it doesn’t recognize a parameter and it doesn’t contain a ‘.’, the parameter gets passed to init: parameters with ‘=’ go into init’s environment, others are passed as command line arguments to init. Everything after “ — ” is passed as an argument to init.

Module parameters can be specified in two ways: via the kernel command line with a module name prefix, or via modprobe, e.g.:

Parameters for modules which are built into the kernel need to be specified on the kernel command line. modprobe looks through the kernel command line (/proc/cmdline) and collects module parameters when it loads a module, so the kernel command line can be used for loadable modules too.

Hyphens (dashes) and underscores are equivalent in parameter names, so:

can also be entered as:

Double-quotes can be used to protect spaces in values, e.g.:

cpu lists:В¶

Some kernel parameters take a list of CPUs as a value, e.g. isolcpus, nohz_full, irqaffinity, rcu_nocbs. The format of this list is:

— (must be a positive range in ascending order)

Note that for the special case of a range one can split the range into equal sized groups and for each group use some amount from the beginning of that group:

For example one can add to the command line following parameter:

where the final item represents CPUs 100,101,125,126,150,151,…

The value “N” can be used to represent the numerically last CPU on the system, i.e “foo_cpus=16-N” would be equivalent to “16-31” on a 32 core system.

Keep in mind that “N” is dynamic, so if system changes cause the bitmap width to change, such as less cores in the CPU list, then N and any ranges using N will also change. Use the same on a small 4 core system, and “16-N” becomes “16-3” and now the same boot input will be flagged as invalid (start > end).

The special case-tolerant group name “all” has a meaning of selecting all CPUs, so that “nohz_full=all” is the equivalent of “nohz_full=0-N”.

The semantics of “N” and “all” is supported on a level of bitmaps and holds for all users of bitmap_parse() .

This document may not be entirely up to date and comprehensive. The command “modinfo -p $” shows a current list of all parameters of a loadable module. Loadable modules, after being loaded into the running kernel, also reveal their parameters in /sys/module/$/parameters/. Some of these parameters may be changed at runtime by the command echo -n $ > /sys/module/$/parameters/$ .

The parameters listed below are only valid if certain kernel build options were enabled and if respective hardware is present. The text in square brackets at the beginning of each description states the restrictions within which a parameter is applicable:

In addition, the following text indicates that the option:

Note that ALL kernel parameters listed below are CASE SENSITIVE, and that a trailing = on the name of any parameter states that that parameter will be entered as an environment variable, whereas its absence indicates that it will appear as a kernel argument readable via /proc/cmdline by programs running once the system is up.

The number of kernel parameters is not limited, but the length of the complete command line (parameters including spaces etc.) is limited to a fixed number of characters. This limit depends on the architecture and is between 256 and 4096 characters. It is defined in the file ./include/asm/setup.h as COMMAND_LINE_SIZE.

Finally, the [KMG] suffix is commonly described after a number of kernel parameter values. These ‘K’, ‘M’, and ‘G’ letters represent the _binary_ multipliers ‘Kilo’, ‘Mega’, and ‘Giga’, equaling 2^10, 2^20, and 2^30 bytes respectively. Such letter suffixes can also be entirely omitted:

Источник

Оцените статью