Notes about Kernel parameters
本文主要记录内核参数相关笔记。
1. Introduction
There are three ways to pass options to the kernel and thus control its behavior:
- When building the kernel—in the kernel’s
config
file. - When starting the kernel—using command line parameters (usually through a boot loader).
- At runtime—through the files in
/proc/sys/
and/sys/
.
This page only explains the second method (kernel command line parameters).
2. Set kernel command line parameters in GRUB
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 GRUB.
Press
e
when the menu shows up and add them on thelinux
line:1
linux /boot/vmlinuz-linux root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash
Press
Ctrl+x
to boot with these parameters.To make the change persistent after reboot, the best practice is to:
Edit
/etc/default/grub
and append your kernel options between the quotes in theGRUB_CMDLINE_LINUX_DEFAULT
line:1
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
And then automatically re-generate the
grub.cfg
file withupdate-grub
.
3. Verification
You can check the parameters your system was booted up with by running cat /proc/cmdline
and see if it includes your changes.
4. Parameter list
“The kernel’s command-line parameters” documentation
List of kernel parameters with further explanation and grouped by similar options
参考资料: