Reinstall of Windows Screwed Up GRUB

Howdy! So, I installed a dual-boot setup (Win 7/Ubuntu 11.04) and it has been jamming along nicely for a while. Then Windows started slowing down, and as I’ve had this setup for over a year now, it was high time to do a little spring cleaning. So I reinstalled Windows 7. And it works like new, if not better!

But the selection screen for “Choose an OS” doesn’t show up anymore. Now, looking at the drive from the Windows side of it, it seems to be respecting the partition that Ubuntu created when it first installed. It shows the original amount I gave it, and it doesn’t even seem to detect a parition beyond that. It acts like a normal 500 GB HDD, on a 1 TB HDD.

So I booted Ubuntu from a disk, and it shows two distinct drives; OS (which referred to Windows) and the one that has Ubuntu on it (I even tried accessing the ‘root’ folder, and as I didn’t have admin priveliges, because I wasn’t technically signed in, it wouldn’t let me). But the size was the same; there was about 468 GB of unused space on that partition, which is consistent with still having Ubuntu installed.

I took a poke at the BIOS; it shows a boot order, but nothing more detailed than that, just a “Samsung HDD.” I took a poke at the only other key option to press during startup (My two choices were F2 and F12) and it brought me to a boot selection screen which only included Windows.

Short of reinstalling the whole shebang, what else should I do?

All you have to do is reinstall GRUB… there are instructions here:
http://linuxforums.org.uk/ubuntu/reinstalling-grub-1-99-in-ubuntu-11-04-from-livecd-command-change/

Be sure to follow the instructions for your version of Ubuntu.

If you’re not sure how… boot to a LiveCD\DVD\USB of your version of Ubuntu, then send me the output from

sudo fdisk -l

and I’ll tell you commands you need to enter to reinstall GRUB.

Also, tell me which distro/version ??

Oops, did I forget what the correct version number is? I thought it was the “11.04” part in my previous post. . . But I’ve heard it referred to as Natty Narwhal, I think. Is either one of those what you meant? Lots of different version numbers and names to keep track of. :-\ Gonna get on that procedure you linked. The link pulls a HTTP 404 Error, for some reason. But as it seems to be a link to another page on here, I’ll poke around. And if that doesn’t work, I’ll post results from the command you mentioned. Thank you much!

Okey dokey, so I found the page you linked to. Here is the output from ‘sudo fdisk -l’ :

ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bd2c32a

Device Boot Start End Blocks Id System
/dev/sda1 1 5 40131 de Dell Utility
/dev/sda2 * 6 1918 15360000 7 HPFS/NTFS
/dev/sda3 1918 61760 480680300 7 HPFS/NTFS
/dev/sda4 61760 121602 480679937 5 Extended
/dev/sda5 61760 121211 477544448 83 Linux
/dev/sda6 121212 121602 3134464 82 Linux swap / Solaris

Now, I tried to follow the instructions, but after this step I got hung up. Here is what everything I tried turned up:

ubuntu@ubuntu:~$ sudo mount /dev/sda5/ mnt
mount: mount point mnt does not exist
ubuntu@ubuntu:~$ sudo mount /dev/sda5/mnt
mount: can’t find /dev/sda5/mnt in /etc/fstab or /etc/mtab
ubuntu@ubuntu:~$ sudo mount/dev/sda5/ mnt
sudo: mount/dev/sda5/: command not found
ubuntu@ubuntu:~$ sudo mount /dev/sda5/ mnt
mount: mount point mnt does not exist
ubuntu@ubuntu:~$ sudo mount /dev/sda5/ mnt
mount: mount point mnt does not exist
ubuntu@ubuntu:~$ sudo gub-install --boot-directory=/mnt/boot/dev/sda5
sudo: gub-install: command not found
ubuntu@ubuntu:~$ sudo grub-install --boot-directory=/mnt/boot/dev/sda5
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

-h, --help print this message and exit
-v, --version print the version information and exit
–modules=MODULES pre-load specified modules MODULES
–boot-directory=DIR install GRUB images under the directory DIR/grub
instead of the /boot/grub directory
–grub-setup=FILE use FILE as grub-setup
–grub-mkimage=FILE use FILE as grub-mkimage
–grub-mkrelpath=FILE use FILE as grub-mkrelpath
–grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
–grub-probe=FILE use FILE as grub-probe
–no-floppy do not probe any floppy drive
–allow-floppy Make the drive also bootable as floppy
(default for fdX devices). May break on some BIOSes.
–recheck probe a device map even if it already exists
–force install even if problems are detected
–disk-module=MODULE disk module to use

INSTALL_DEVICE can be a GRUB device name or a system device filename.

grub-install copies GRUB images into /boot/grub, and uses grub-setup
to install grub into the boot sector.

Report bugs to bug-grub@gnu.org.
ubuntu@ubuntu:~$ sudo mount /dev/sda5/ mount
mount: mount point mount does not exist
ubuntu@ubuntu:~$ sudo mount /dev/sda5 /mnt/boot
mount: mount point /mnt/boot does not exist
ubuntu@ubuntu:~$ sudo mount /dev/sda5 /mnt/home
mount: mount point /mnt/home does not exist
ubuntu@ubuntu:~$

I dunno what I’m missing from there. Am I trying the wrong partition?

Firstly, as you didn’t give me the distro/version you are running, I’m assuming you are running Ubuntu 11.04

If you are using a different distro or version STOP NOW, and tell me which distro/version you are running… these instructions are for Ubuntu 11.04 ONLY… and will fail on earlier versions

In the first command you were using the right partition, but entering one of the spaces in the command in the wrong place.

The second command doesn’t need (or want) the 5 on the end… it’s expecting a disk, not a partition.

Can I give you a hint though… if someone gives you a series of commands you don’t fully understand, and one of them throws up an error, it’s normally a good idea to STOP and ask them rather than carry on with the next command… that could cause more damage than good.

OK, here we go… boot to an 11.04 LiveCD, open a terminal, and enter:

sudo mount /dev/sda5 /mnt

then

sudo grub-install --boot-directory=/mnt/boot /dev/sda

Then REBOOT to Ubuntu

then

sudo update-grub

Cool beans! Thank ya’ Mark! Worked a treat; guess I need to practice harder with the Terminal command structure. Everything installed without a hitch, and updated Grub and it detected everything else on the HDD. Thanks again!