How to edit your kernel boot parameters on Linux

Changing or editing your kernel boot parameters is very important when you want to fix an issue that causes errors during boot, or test a new feature, activate a different driver, or disable a feature on your system. These parameters are stored as text, in the boot loader's configuration file which the kernel parses during the “init” process. To determine what parameters were used during your system's last boot, you should enter the following on a terminal:

cat /proc/cmdline

The usual output by default is “quiet splash” while in most cases the grub menu is initially hidden. This is often the case when there is only one Linux distribution installed on a computer, so inexperienced users may have no idea how to access grub's options to change the kernel boot parameters. To do this, you can simply hold the “Shift” key once the splash screens appears. This should take you to the grub menu from where you may choose a kernel option. Depending on the grub settings, you may be offered the option of multiple kernel versions on this stage. Choose the one that you want to edit and press the “e” key to access the configuration file for the highlighted option. Inexperienced users should be extra careful at this point and consider testing the parameter changes on a previous kernel version, and always keep a working kernel option untouched and available for the case that things go wrong.

Now to add a new parameter, you simply take your cursor to the line that begins with the word “Linux” using your arrow keys. You may then add the new parameter after the last text entries on the line (“quiet splash” in our case). Each new parameter that is added should be separated by a space. If written in a wrong and unreadable way, the kernel should disregard the text and move on to the next parameter. This typically means that mistakes like that shouldn't normally cause your system to malfunction.

There are many parameters that help users determine all aspects of their system's operation during the boot process. As an example for this tutorial, I will suppose that we're changing the kernel boot parameters to deal with a GPU driver update that causes the X server launch to fail. The first thing we can do is to add a parameter that will allow us to disable the driver that is currently used. This can be the “nomodeset” parameter, or the “blacklist=module” parameter (module being the problematic one). To instruct the system not to attempt to start the X server, you should add the “pfix-nox” parameter. This will allow you to work in console mode and install/enable an alternative driver. Last, there is also the “pfix=xorgwizard” parameter that will launch a wizard to help you choose a different driver, resolution and color depth to test your system in different settings. To test the new parameters, press “Ctrl+x” to boot with the new settings.

This will apply for only once, as all the additional parameters are wiped out when your restart your system. If your new settings are tested and working properly, you can make them permanent by editing grub's configuration file. You may do this by open a terminal and giving “sudo gedit /etc/default/grub” (or your preferred text editor instead of “gedit”). Notice the line beginning with “GRUB_CMDLINE_LINUX_DEFAULT” on the following screenshot.

On this line, you may find the “quiet splash” part. Enter the new parameters in the quotes and by leaving a space between the entries. You may then save the file and seal the deal by typing “sudo update-grub” on the terminal. If done right, this process will make the boot kernel parameter changes permanent.

One thing to note is that this guide is in regard to the widely used Grub bootloader. There are however other bootloaders such as Lilo, Syslinux, Gummiboot and Efibootmgr. Some of these will work similarly to the ways we described, but some may not. If you are using a different bootloader, you can visit howtoforge.com forums to get help and information on how to change the kernel boot parameters.

Share this page:

1 Comment(s)

Add comment

Comments

From: Anon

Hi there! I got a bigger problem: I do not have an access to a bootloader,

and I need to be able to change /proc/cmdline on a running system

(at initramfs) and continue to boot further... Do you know how to do it?