Clean up your GRUB

17Jun07

GRUB

If you dual boot or multiboot your computer with linux and other operating systems, chances are you are using GRUB (GRand Unified Bootloader) to select which OS will be launched. GRUB resides in the first 512bytes of your hard disk (also referred to as the MBR – Master Boot Record) and is the first process that loads after your BIOS.

Since 512bytes is not enough to contain all of GRUB, the majority of the application resides on the linux partition under /boot/grub (GRUB Stage 2). This is where you can change how GRUB looks and behaves. Looking at the files in this directory you will find one named “menu.lst”. To edit this file, you will have to open it as root:

$sudo gedit /boot/grub/menu.lst

Here you will find several customization options available for getting GRUB to look and act exactly the way you want it to. This page is an excellent resource on how to customize GRUB. It shows you how to change default OS, timers, adding a splash image to the GRUB menu, adding color to the menu, setting passwords and much more.

Over time, Ubuntu will present you with kernel updates through the update manager that will all be added to your GRUB menu list. This can become very annoying after 3 or 4 kernel updates because you now have 2 GRUB entries for each (main and recovery mode) kernel which will result in a cluttered GRUB menu. To remove unwanted kernels from your GRUB menu, open the “menu.lst” file with root privileges (as described above) and scroll to the very bottom of the file. Everything after the line below is used to configure menu entries:

## ## End Default Options ##

You should see the latest kernel version as the first entry followed by recovery mode for that kernel. If you do not use other kernel versions, you can go ahead and delete the blocks of code associated with these kernels such as:

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,4)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=8d5c365a-5816-405d-a910-6604c4bbf973 ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

When deleting these entries, ensure that you are only deleting old kernel entries of a given OS and not entries from another OS such as Windows XP. It is also a good idea to backup your menu.lst file before you do any editing.

Advertisements


One Response to “Clean up your GRUB”

  1. 1 Abhishek Mathur

    Hi
    I have been reading your blog. All pretty interesting. I have a question – I have a dual boot. Once Winxp and the other Linux. I initially allocated only 11GB on my linux and have slowly started running out of space. Is there a way to increase this partition? I know I could use the gparted and get additional partition, but can I expand the current partition to a higher value?
    Any information would be very helpful.

    Thanks,
    Abhi


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: