Change grub boot order – Ubuntu 9.10

I have a dual boot system running Ubuntu 9.10 and Windows 7. The default boot order was linux first, and then windows, so i decided to change that.

Prior to Ubuntu 9.10, making the above changes wasn’t that hard at all. You simply had to change the order of the menu entries in /boot/grub/menu.lst, but now, with Ubuntu using Grub2 as a bootloader, things aren’t that straight forward anymore.

menu.lst has been replaced with grub.cfg which is automatically generated from some file templates and scripts and you are not allowed to edit it.

Ok… so things are a bit different now. No worries. Just cd into /etc/grub.d and do a ls. You should get something like this:

Effect of ls command in /etc/grub.d

Notice the numbers in front of every filename? Those numbers dictate the order in which grub displays the menu entries. So if you haven’t altered the order before, you should have:

  • 00_header
  • 05_debian_theme
  • 10_linux
  • 20_memtest86+
  • 30_os-prober
  • 40_custom

Now, if you want to change the order of the menu entries just rename the prefix of your files. As i wanted for grub to first display the windows os i renamed 10_linux and 30_os-prober to 10_os-prober and 20_linux. I also renamed 20_memtest86+ to 30_memtest86+ because i don’t do memory tests at all.
Be sure to rename the files as root or else you’ll get a permission denied warning.

After you’ve finished the process make sure you run update-grub for the changes to take effect. This command will generate the new conf.cfg in /boot/grub.

That’s all folks.

P.S.  You are solely responsable for any damage you might do to your bootloader by using the above instructions. I tested this on my box only!

Advertisement

  1. dude

    This worked perfectly for Windows 7 and Ubuntu 10, thanks.

    sudo mv 10_linux 30_linux
    sudo mv…do the others

    sudo update_grub

    Boot orrder was Windows 7, then Ubuntu

  2. Lee SUblett

    Looking at the list, above I do not see where the Grub addresses
    the windows XP partition.

    I have a duel boot system and when I up dated to 9.10 I see the XP option but will not to run now.

    Any idean where it went?

    • i’m not sure i understand….
      Are you saying that the menu entry shows up in the grub menu and you cannot boot it; or it doesn’t show at all.
      On my pc, the windows os is named “Other operating system”, in grub.

    • I can think of two methods of repairing your problem:
      1. You can try running the command “update-grub” in the linux console. Maybe this will repair it
      2. Make a startup disk for ubuntu (floppy or usb stick). restart your machine, plug in the windows xp cd and boot in recovery console. Run “fixmbr”. This will delete grub and restore the original windows bootloader. Boot back to linux using the startup disks previously created and repair grub. For the last part i don’t have enough know-how, but you can google it and get more details.

      • Lee SUblett

        The line “Windows XP” was listed in grub when booting up… But whne high lited to try and run it. It would go to black screen…

        I Fixed it buy re-installing windows XP in the repair mode
        Thanks for the reply.

        Every thing is working OK now…






Follow

Get every new post delivered to your Inbox.