About Me

My photo
I'm a colonist who has declared war on machines and intend to conquer them some day. You'll often find me deep in the trenches fighting off bugs and ugly defects in code. When I'm not tappity-tapping at my WMD (also, known as keyboard), you'll find me chatting with friends, reading comics or playing a PC game.

Monday, April 7, 2008

Mess around with your GRUB menu

GRUB stands for GRand Unified Bootloader. I don't know why, but someone thought that it would be a funny play on the term "Grand Unification Theory" in physics. Essentially, GRUB is a bootloader program that loads when you boot into your PC. Using the GRUB menu, you can then pick your operating system of choice (if you happen to have more than one). I've been using Linux for a while now and today I'll show you how to tweak your GRUB menu settings so that it looks and behaves the way you might want it to. The Linux distribution that I currently use is Kubuntu 7.10. As such, many of the commands that I use may be Ubuntuish.

Let's get started. The options for your GRUB menu are stored in a file named menu.lst. Typically, this file will be located at /boot/grub. Before making any changes to menu.lst, let's first take a backup of the file. Open up a terminal and type the following:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup

The shell should prompt you for your root password. Once you enter your password, the contents of the file menu.lst will be copied to another file named menu.lst_backup.
Now type:

sudo nano /boot/grub/menu.lst
to take a look at the menu.lst file. I'd imagine the file contents to be something like this.
Any line in this file that starts with a # symbol is a comment. This means that it will be safely ignored when GRUB reads this file.

1. Changing the default OS.
You can change the OS that loads by default in the GRUB menu. In order to do this, first count the entries in the menu starting from zero (not one). Now, locate the line in the menu.lst file that says default<space>n where n is literally a number. Change that number to the entry you want. For example, in order to make the first entry in the list as the default OS to be loaded, change the line in menu.lst to default 0
Save the file and exit the editor by pressing Ctrl+O and Ctrl+X (only for nano). A common mistake that many make is inadvertently change the commented line in the file. If there is a commented line leave it as is.

2. Changing the timeout.
Generally, the GRUB menu gives you about five seconds to decide which OS you want to boot. At the end of this time, GRUB automatically boots into the default OS. To change the timeout, simply find the line in menu.lst that says timeout and change it to timeout<space>n where n is the number of seconds you want to set. I usually set this value to 15. Save the file and exit the editor.

3. Changing the splash image.
Here's a fun customization that you can do. Most GRUB menu screens are purely black with white text. If you want to change the GRUB menu screen to that of a picture, you can easily do that. Get a nice GRUB splash image from the net. You can find plenty under the BootSplash section on http://www.kde-look.org
The grub splash image file should be something like filename.xpm.gz. If your splash image file is not in the xpm format, then it cannot be loaded by GRUB. Alright, now to set this picture as a grub splash, copy it to /boot/grub. Do the following:

sudo cp <PATH_TO_IMAGE> /boot/grub/bootsplash.xpm.gz

where PATH_TO_IMAGE is the logical path to the GRUB bootsplash image file that you intend to use. Now reopen menu.lst with root previleges.
sudo nano /boot/grub/menu.lst

Add a new line to this file (preferably after the initial comments):
splashimage /boot/grub/bootsplash.xpm.gz
Save and exit the editor.
Now everytime you boot your system, you should see the pretty new GRUB splash image instead of that boring dark one!

NOTE: If at any point, you realise that you've messed up your menu.lst file, then just retrieve it from the backup that we had first created.
Type:
sudo cp menu.lst_backup menu.lst

No comments: