Archive

Updating Grub


If you are using Debian, please read “The Debian Way”, at the bottom

This is initially aimed at those new to Linux, who have decided to update their kernel from the stock one that came with their distribution.

Installing a kernel is described in KernelBuilding but once that is done, grub.conf needs editing so that it’s possible to boot your new kernel.

grub.conf needs to point to two separate places to be able to run your new kernel.

When making your kernel, the image is created, previously this has been bzImage, which gets saved in the arch/i386/boot directory of the source directory where you’ve been building your new kernel.

(Note I’m unsure as to what bzImage is called if make bzImage is replaced by make — CiemonDunville)

Copy bzImage to your /boot directory, giving it a suitable reference to your new kernel. For example:

cp /usr/src/linux-2.6.5/arch/i386/boot/bzImage /boot/2.6.5-image

You also need to make an initrd image using the initrd command; it takes two options, the first indicates the name of the new image, the second indicates the kernel from which the modules are taken. For example:

mkinitrd /boot/vmlinuz-2.6.5 2.6.5

So with those files made, you can now edit /boot/grub/grub.conf. The additional lines in our example configuration are:

title Fedora Core (2.6.5) {{{         root (hd0,0)         kernel /vmlinuz-2.6.5 ro root=LABEL=/ rhgb         initrd /2.6.5-image

}}}

Where you put this in your grub.conf will determine where it is in the boot list. It’s probably a good idea not to put it at the top, until you’re happy with the kernel.

The Debian Way

Debian doesn’t use a grub.conf but uses the file /boot/grub/menu.lst and has a script, update-grub, to manage updating menu.lst for you. This script will search your hard disk for any bootable OS and re-writes the file with the new kernel, by default, at top of the menu list. It also allows you the option of having a recovery-mode for each kernel version which allows you to run the kernel in ‘single’ mode.

Leave a Reply