Skip to content

How to find out all Kernel Boot Parameters

homepage-banner

Introduction

Kernel boot parameters are settings that can be passed to the Linux kernel during the boot process. They are used to configure various aspects of the system, such as hardware components, network settings, and debugging options. In this blog post, we will discuss how to find out all kernel boot parameters in Linux.

How to find out available kernel boot parameters in Linux

how to find out all the available kernel’s command-line parameters (kernel boot parameters)?

It locates in the following file of kernel source code package.

Documentation/admin-guide/kernel-parameters.txt

How to change kernel boot parameters in Linux

Edit file /etc/default/grub or /etc/default/grub.d/xxx.cfg and add the parameter like that (replace aaa=bbb into real parameter)

GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT aaa=bbb"

and update grub

sudo update-grub
sudo reboot

How to view present kernel boot parameter

Using the /proc/cmdline File

One way to view all kernel boot parameters is by looking at the contents of the /proc/cmdline file. This file contains the command line arguments that were passed to the kernel during the boot process. To view the contents of this file, open a terminal window and enter the following command:

cat /proc/cmdline
### or
dmesg | grep "Command line"

Using the sysctl Command

Another way to view kernel boot parameters is by using the sysctl command. This command is used to view and modify kernel parameters at runtime. To view all kernel boot parameters, enter the following command in a terminal window:

sysctl -a | grep boot

This will display a list of all kernel boot parameters that are currently set on the system. You can also use the sysctl command to view specific kernel boot parameters by specifying their name, like this:

sysctl kernel.printk

This will display the value of the kernel.printk parameter.

Using the /boot/config-* File

The kernel configuration file contains a list of all the kernel boot parameters that are compiled into the kernel. This file is usually located in the /boot directory and is named config-<kernel-version>. To view the contents of this file, open a terminal window and enter the following command:

cat /boot/config-$(uname -r) | grep CONFIG_CMDLINE

This will display a list of all kernel boot parameters that are compiled into the kernel.

Reference

  • https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html
  • https://www.kernel.org/doc/html/v4.19/admin-guide/kernel-parameters.html
  • https://www.kernel.org/doc/html/v5.10/admin-guide/kernel-parameters.html

Conclusion

Knowing the kernel boot parameters is important for system administrators and developers, as it allows them to fine-tune the system for better performance and to troubleshoot issues. By understanding how to find out all kernel boot parameters in Linux, you can gain more control over your system and optimize it for your specific needs.

Leave a message