Linux Kernel Boot Parametres Howto

From Super Grub Disk Wiki
Jump to navigationJump to search

How to change Kernel parametres.

Introduction

Readme: Options, Parametres and Arguments might be used with the same meaning.

Let's see. What's an option? If you have worked in the terminal and, maybe, you have deleted files with rm you know that you use it like that: "rm file" and that then the file called "file" is deleted.

Thus "file" is the option of rm program.

Linux's kernel, the kernel we everyday use, has also arguments.

And... How's that possible? Yes, in fact, it always have a root option that specifies the Linux root partition, in other words, where the Linux Kernel has to find every data from your distribution and boot.

There are sometimes that we need to edit the kernel options. We are going to see three ways of making so: On the fly, Classic, and Debian ways.

Advice

When you have to edit menu.lst I always say the same thing. Try to edit it on the fly and once in your system try to make changes permanent with the other methods. This will avoid you a lot of headaches with not knowing how to mount and edit a partition from a live cd.

OPTION 1: On the Fly:

When we boot if we see:

Press ESC to see the menu and a countdown we must press ESC key.

If we already see Grub menu we should choose with arrow keys our Linux usual boot entry and press 'e' key. We will see some lines that will begin with kernel, initrd, boot, etc. We will choose the kernel line and we will press 'e' key again. Now we will use the END key (or use the arrow keys in order to go to right) and at the end we will write our arguments. If we write more than one argument they should be separated by spaces.

We will press ENTER and then press 'b' key. Our Linux should boot but with this new option.

Let's remember that these are volatile changes, next time we will reboot these new added kernel boot options will not be there and you will have to re-enter them (if you want them back again, of course ; ) ).

OPTION 2: Classic:

We edit /boot/grub/menu.lst from our running system as the root user.

Something like:

su
gedit /boot/grub/menu.lst

or:

gksudo gedit /boot/grub/menu.lst

We will find the lines that begin with kernel and we will put the cursor at the end. We will write our options there (separated by spaces) and we will save the file.

When rebooting, boot options should still be there.

OPTION 3: Debian:

Option 2 (Editing menu.lst) should be the best one but Debian update system (Ubuntu too) is a problem when updating kernel packages because it also updates its boot arguments.

Let's see how to manage Debian installations.

We should edit

/boot/grub/menu.lst

file as a root user.


su
gedit /boot/grub/menu.lst

or:

gksudo gedit /boot/grub/menu.lst

and we search for following line:

# kopt=root=/dev/sda3 ro

not this one:

## e.g. kopt=root=/dev/hda1 ro

At the end of the line we should add our arguments, we save the file and as a root user we run: update-grub.

In Ubuntu we run: sudo update-grub.

Tips

Let's see some tips about boot parametres.

TIP 1: In order to see what makes your kernel not boot (or other problems): splash and quiet options are removed.

TIP 2: In order to see if boot parametres are being read ok we can run "cat /proc/cmdline" which will show as all the boot parametres that our current kernel does have.

TIP 3: You can force your entry as root when it does not boot at all by removing all the boot options except the root one and adding 2 and single options. Something like:

kernel /boot/linux-2.2.20 root=/dev/sda5 single 2