Ubuntu : Dual booting w/XP using Grub bootloader | editing bootloader in Ubuntu

   Posted December 26, 2007 by Jimmy Selix in Linux

This recipe will explain how to edit the Grub bootloader while in Ubuntu. This will explain how to remove the recovery and memtest and also set XP/Windows as a default OS.

The first thing i did after my ubuntu install was to clean up my GRUB bootloader menu. Basically I wanted to remove the recovery mode and just make the bootloader show XP and Ubuntu.

Editing the GRUB bootloader on Ubuntu.

1. open Terminal, go to Applications > Accessories > Terminal

2. in the Terminal window/commandline, type: sudo nano /boot/grub/menu.lst

2a. you probably will be prompted for your password or the admin password, type it in and hit enter.

3. the menu.lst file should now open in the terminal window. you can navigate via the arrow keys. lets remove the recovery mode entry and the seperator for the windows bootloader (i installed ubuntu after having xp prof already setup).

find this section:

## ## End Default Options ##

title Ubuntu, kernel 2.6.12-9-686
root (hd0,1)
kernel /boot/vmlinuz-2.6.12-9-686 root=/dev/hda2 ro quiet splash
initrd /boot/initrd.img-2.6.12-9-686

title Ubuntu, kernel 2.6.12-9-686 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.12-9-686 root=/dev/hda2 ro single
initrd /boot/initrd.img-2.6.12-9-686

title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin

you can remove the bottom two items if you like (recovery mode and memtest) and also can rename the way title for the first one (i like to remove the kernel version since its clutter to me).

if you have windows installed prior (and possibly after ubuntu, i have not tested personally), you can also remove the label seperator and also edit the windows entry to the OS name itself.

below the ubuntu options we looked at above, you should see something like this:

# This is a divider, added to separate the menu items below from the Debian
# ones.
# title Windows Bootloader
# root

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Windows XP Tablet Ed 2005
root (hd0,0)
chainloader +1

you can remove the Windows Bootloader from the divider section and in turn make the windows entry below the 1 os for defaulting (see later).

also, i edited the title entry to be my actual windows version/os.

4. finally, lets setup the default OS option in the GRUB menu.lst file, this option is at the very top of the file. it is the

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
default 0

so if you removed the recovery mode entry, memtest entry, windows divider entry; ubuntu = 0 and xp tablet = 1

5. Once you have made all of your edits, hit CTRL+X to exit, and then choose Y to save and then hit Enter to overwrite the current menu.lst

6. reboot to test it out. have your ubuntu live cd ready just in case. 🙂 you can always go to terminal via the live cd to correct the menu.lst problems. just use the command from step 2.


About Jimmy Selix

Jimmy Selix is an early adopter that loves to be one of the first on the block to have the latest and greatest in technology and gadgets. Another love of his is being able to share his knowledge to others seeking it. Feel free to drop any comments or questions that you may have.
View more articles by Jimmy Selix

The Conversation

Follow the reactions below and share your own thoughts.

  • ace

    this is not working dude
    i get the following error

    Starting up…
    GRUB loading stage2

    and the grub menu is displayed

    how to solve this problem???

  • Neelam

    I have installed ubuntu on a laptop which was having vista already installed. Now the problem is while booting it goes in ubutu while I want default O. S as windows vista.

    where is grub.conf in ubuntu & how to change boot sequence

    Please help me.

    • Win Lin Guy

      I’m sorry to tell you this, but if you didn’t install Ubuntu on a separate Partition, or if you didn’t use Wubi, you may have LOST Vista.

  • Anonymous