Interview Prep/Linux/Boot Process & Kernel

How do you view and change kernel command-line parameters?

IntermediateConceptBoot Process & Kernel
Answer

In one line: Kernel parameters are settings passed to the kernel when it starts. You can see the current ones in /proc/cmdline and change them permanently through the GRUB configuration.

See the current parameters:

cat /proc/cmdline
# BOOT_IMAGE=/vmlinuz-6.8.0 root=/dev/sda1 ro quiet splash

Change them permanently:

# RHEL/CentOS/Rocky — easiest way
sudo grubby --update-kernel=ALL --args="transparent_hugepage=never"
sudo grubby --update-kernel=ALL --remove-args="quiet"

# Ubuntu/Debian — edit the GRUB file, then regenerate
sudo vi /etc/default/grub       # add to GRUB_CMDLINE_LINUX="..."
sudo update-grub

Then reboot and check /proc/cmdline again.

Change them for one boot only: at the GRUB menu, press e, add the parameter to the line starting with linux, and press Ctrl+X. This is how you boot into rescue mode when a server is broken.

Real DevOps example: database servers often need transparent_hugepage=never for better performance, and cloud VMs often need console=ttyS0 so you can see boot logs in the cloud console.

All Linux questions Roadmap: Linux

More on Boot Process & Kernel