Reorder your Boot Menu Manually

Last week, I covered how to use KGRUBEditor to re-order the boot menu you see at startup, so that dual boot users could move Windows to the top of the list if they would like.

It is also relatively simple, however, to manually reorder this menu by editing the configuration file of GRUB (that's the boot loader).

This tutorial will focus on Debian/Ubuntu, however these instructions should be able to be followed on any distribution (just ignore things about the automagic kernel list).

First of all, a word of warning. Editing configuration files can be a potentially risky business. Make sure you know what you're doing. You should also make a copy of the file /boot/grub/menu.lst and store it somewhere safe (you can restore it with a Live CD later if the worst does happen). If anything does go wrong, see the end of this post.

Right, let's get started. First of all, we need to open up the configuration file in an editor.

Assuming you're running GNOME, press Alt-F2 to bring up the Run Application window. Type gksu gedit /boot/grub/menu.lst and click Run. Enter your password when prompted.

Run Application window

This will open up a text editor, with the GRUB configuration file ready to edit. So let's assume once again that you want Windows to be the default entry.

Scroll towards the bottom of the file, you should see a section similar to this:

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

Select this whole section and choose Edit > Cut.

Scroll back up to find a line like this:

# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

Just after that line, but before BEGIN AUTOMAGIC KERNEL LIST, use Edit > Paste to put the Windows entry above all the Ubuntu entries.

Save the file and quit the editor. Assuming you did the process correctly, when you reboot, Windows should be at the top of the list and the default boot option. To start Linux, simply press down once and then Enter!

If you did run into problems, you can restore the functionality of Windows by booting the computer with the Windows XP CD in, choosing to go into the Recovery Console and typing fixmbr at the prompt. Linux can then be fixed by re-running the GRUB install from a Live CD.

Avatar for peter Peter Upfold -

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Reorder your Boot Menu Manually

  1. Andre (guest)

    # Posted on 10 August 2008 at 12:27 AM

    When I commented the previous post, my suggestion was just some kind of hint to the /boot/grub/menu.lst, however you surprised me and went way further my point and now I am all compliments to this couple of posts. Great job an great blogging.

    I'd just add to the most insecure ones that you may "cp /boot/grub/menu.lst /boot/grub/menu.old" and this way if something goes wrong and you want to move back, you may boot with a live cd (KNOPPIX is great, but Debian Installer has a mini recovering command line as well) and just rename the old file.

  2. # Posted on 10 August 2008 at 06:20 AM

    [...] (If you’d rather quickly edit the configuration file by hand, without installing new software, take a look at this alternative tutorial). [...]

  3. Peter (guest)

    # Posted on 10 August 2008 at 06:24 AM

    @Andre - Excellent suggestion to copy the menu.lst file, I've added that to the relevant section of the post.

    And thanks!

Home » Articles » Reorder your Boot Menu Manually