Friday, September 16, 2011

Reinstalling GRUB2

This has come up a million times (every time I reinstall Windows, in fact), and every time I have to search around online and try to remember how to do it. I figured this most recent time that I would just go ahead and write a blog post about it and be done with it, so here it is.

According to this handy page from the Ubuntu community documentation, there are a couple of ways to skin this particular cat. The one that worked best for me was to take an Alternate CD that I already had on-hand, boot into it, and choose 'Repair an Existing Installation' (or something like that) at the first splash screen (the one where you can check the CD integrity, run memtest, etc.).

Once it gets started, run through the options choosing the default keyboard layout, time zone, etc. When it asks you to choose a root, accompanied by a list of all of the HDD partitions, it appears you may choose any of them (I chose /dev/sda5 on this particular machine, which has Win7 in a primary partition and Ubuntu spread across 3 logical partitions). Then, once it kicks you to a command prompt, type:
sudo grub-install /dev/sda
That's it.

Other easy options that I didn't try include booting into a LiveCD session, then installing and running the boot-repair package (it didn't even show up in the apt-cache when I searched for it, so YMMV). In the program, choose the "First Repair" option and then reboot without the CD in the drive. A GRUB splash should show up proposing both Ubuntu and Windows.

No comments:

Post a Comment