DEV Community

gjorgivarelov
gjorgivarelov

Posted on

Permanently add a kernel boot parameter in RHEL 8

In this post, I will describe how to permanently add a kernel boot parameter to either one of the kernels you have on offer to boot or to all of the kernels on your machine.

I recently wrote a post on how to change the root poassword on your RHEL 8 installation, where an important part of the whole procedure was adding a kernel boot parameter before the user boots a certain kernel. Adding a boot parameter at the end of linux16 line at the boot menu for a chosen kernel is a temporary solution that won't survive a reboot. Sometimes you'll be required to add a boot parameter that will be a permanent part of the kernel boot sequence. That need may arise if you added some new hardware component to your system after you installed and configured Linux on it. Or you are installing some software and part of the requirements for the successful installation is permanently enabling some kernel parameter at boot. Recently for example, while enabling virtualization on my RHEL 8 system, I was warned that I needed to enable a kernel boot parameter that wasn't enabled by default and on which virtualization depended.

Some great news

Although the "permanently enable a kernel boot parameter" may suggest a complicated procedure full of uncertainty, the good news is that it's not that difficult at all. And can be done while you are already running the kernel on which you need to enable that parameter.

The grubby tool- enable a kernel parameter for the currently running kernel

grubby is a useful tool when dealing with many issues connected to the boot procedure. In this case, this tool will help us enable that kernel parameter we need enabled at boot. Just tell it first for which kernel you need the parameter enabled, as well as the name of that parameter (become root first):

grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="some_parameter"
Enter fullscreen mode Exit fullscreen mode

And for all the kernels on your system? grubby can do that too!

grubby --update-kernel=ALL --args="some_parameter"
Enter fullscreen mode Exit fullscreen mode

What if... you wanted to actually turn off a kernel parameter so that it won't be available at boot?

grubby to the rescue again:

grubby --update-kernel=/boot/vmlinuz-$(uname -r) --remove-args="some_parameter
Enter fullscreen mode Exit fullscreen mode

And yes, reboot will be needed for the change to take effect.

Latest comments (0)