Pinterest Stumbleupon Whatsapp
Ads by Google

bootloaderWith Windows getting real good and Linux trying to cater to needs of every user How To Run Google Chrome OS From A USB Drive [Windows] How To Run Google Chrome OS From A USB Drive [Windows] Read More , it is not unusual to have a dual boot configuration on your computer.

Dual boot means you have two operating systems (most likely Windows and a Linux distro) on your computer. You get some kind of menu to choose which operating system to boot when you start your computer and depending upon your choice, the appropriate system boots up. More often than not, if you are dual-booting with Windows and Linux, chances are that the menu you see at boot time is the GRUB boot menu.


By default, GRUB is installed by many distributions and is available as an option with others. It automatically detects the other operating systems present on your computer and adds them as an entry in the menu along with the Linux distribution you are currently installing. All this happens without any additional steps during the Linux installation process if you install Linux after Windows is already present on the disk.

bootloader

If you go the other route, that is — install Windows after Linux, or if you play with partitions on your hard drive too much; you can end up messing up GRUB. In that case, depending upon what you just did, you might only be able to boot into Windows or GRUB might fail to display any menu at all. In either case, before you panic and rush to forums or tech support, there is a simple fix that will most likely alleviate your woes. Its to restore GRUB, and you can do it in a snap. Let’s see how.

First off, as is often the case when a new version to a popular software is released, both versions continue to be in use for some time before the newly version is adopted. The same with GRUB. Sadly, the procedure is a little different for both versions and we shall tackle both of them here.

Ads by Google

First off, you need a Live CD handy. Your Linux distro CD should work just fine if it installed GRUB on your computer in the first place. You can also use Knoppix or SystemRescueCD. We will be using Ubuntu Live CD. Keep in mind that the CD uses same version of GRUB. This can be insured by using the disc that you used to install Linux.

Boot off from the Live CD and give it some time before you can view the desktop. Next up – fire up terminal and get ready for some command line action. Before we proceed keep in mind that hd0 refers to the first hard disk on your computer, second will be hd1 and so on. Similarly (hd0,2) means second partition on the first hard disk.

GRUB

bootloader

  • Type sudo grub, this will give you a the GRUB prompt. Now you can enter GRUB specific commands.
  • Type find /boot/grub/stage1. This should return the location of GRUB files on your hard disk.
  • Next up, use the location returned above and issue the command root(hdX, Y). For example, if the previous command returned (hd0, 1), you should issue root(hd0, 1)
  • Next issue the command setup(hd0) or hdX as the case may be. PLEASE NOTE: This will overwrite the MBR, which is fine if you were using GRUB in the first place or you install Windows after Linux. If you had some other bootloader or custom configuration, you should watch out.
  • Type quit to exit GRUB and then reboot the computer.

GRUB 2

grub bootloader

  • Enter sudo mount /dev/XdYZ/ /mnt where X can be either ‘h’ or ‘s’ and Y represents the hard disk number and Z represents the partition. eg mount /dev/sda3 /mnt, in which case /dev/sda3 is your Linux system partition. You can use sudo fdisk -l, to list all partitions if you are not sure about the system partition. NOTE: If you have a separate boot partition, you will need to mount it explicitly at /mnt/boot
  • grub bootloader

  • Then issue the command sudo grub-install –root-directory=/mnt /dev/sdX X being the hard disk where you want to restore GRUB.
  • Next, unmount the partition via sudo umount /mnt and then reboot your computer.

After running these steps, you should be able to restore GRUB within 5 minutes. If things go well and if GRUB was the reason for your troubles, you just fixed them. If these didn’t fix your problem, you might want to have a closer look at your hard disk’s health and partitions. You can use GParted or the Ubuntu Live CD or any other Live USB/CD that suits you.

Have you ever run into booting troubles? How did you fix it? Shoot off any tips in the comments, that might be helpful to fellow readers!

  1. Dileep Malayanur
    September 5, 2010 at 1:52 pm

    Cool! Checkout my blog of similar interest @ http://starksolutions.blogspot...

  2. Anonymous
    July 3, 2010 at 3:03 pm

    I solved my dual boot problems by not doing it anymore. I use Linux Mint 9 as the only OS loaded on my computer. If I need to use a program that will only run in Windows, I use Virtualbox, no more rebooting just to use one piece of software for a few minutes.

  3. Austin B
    June 27, 2010 at 6:03 am

    +1 for Super Grub Disk. Warning that the current version of SGD only works with GRUB2 (which is fine for recent versions of Ubuntu). I still use GRUB 1 since that's still the default in Arch, I just needed to download an older ISO for SGD that was for GRUB 1.

  4. Axel482
    June 27, 2010 at 1:35 am

    Go to the Ubuntu Software Center and search for "Startup Manager." You can't change the order with it, but it will allow you to change the default OS so that Win7 is selected first and will load when the timer runs out.
    You can also change the time-out to whatever you like.

  5. rif
    June 26, 2010 at 10:11 pm

    Also, there's a excellent grub utility called Super Grub Disk that can resolve nearly any bootloading issue.

  6. rif
    June 27, 2010 at 12:10 am

    check out this link to change the default operating system:

    http://www.howfixcomputer.com/...

  7. Zachary Miller
    June 26, 2010 at 10:01 pm

    Is there a way to change the order of the boot list that pops up when GRUB loads (when your computer starts)? Because Ubuntu comes first on mine, and Win 7 is all the way on the bottom, and as I use 7 much more I'd rather it be on top so that if I walk away after pushing the power button it will automatically load 7 instead of ubuntu (it has a timer of ten seconds or something, if there is no activity it loads the first boot option on the list)

    • Axel482
      June 26, 2010 at 11:35 pm

      Go to the Ubuntu Software Center and search for "Startup Manager." You can't change the order with it, but it will allow you to change the default OS so that Win7 is selected first and will load when the timer runs out.
      You can also change the time-out to whatever you like.

    • 1fastbullet
      July 3, 2010 at 12:43 am

      The real solution, of course, is to use Ubuntu as you primary OS. (Sorry. The devil made me do it).

Leave a Reply

Your email address will not be published. Required fields are marked *