PDA

View Full Version : [ubuntu] Lost GRUB with Windows 7 install



Maheriano
November 10th, 2009, 10:04 PM
My brother has Ubuntu 9.10 installed across 3 partitions for /, /home and SWAP and everything was working fine. He also had a spare NTFS partition sitting there and finally got around to installing Windows 7 onto it. Now when he reboots his machine Windows 7 boots without showing GRUB so he can't boot into Ubuntu at all.

I searched the forums and most people seem to be having the opposite issue, I couldn't find anything similar to this. Is there a way he can repair the MBR to get GRUB to load again and dual boot? Is there any reason he should install GRUB 2 instead? Does it matter?

darkod
November 10th, 2009, 10:09 PM
This is quite normal if you install windows after linux. Windows just writes his own bootloader in the MBR and it can't even see linux partitions even if it wanted.

It is quite easy to restore grub from the ubuntu cd but I am new to ubuntu and wouldn't like to misinform you about the steps.

Google reinstalling grub and you'll find loads of posts and tutorials. Cheers.

oldfred
November 10th, 2009, 10:12 PM
The way to reinstall grub2 is different than that for legacy grub.

I have save these links:
reinstall grub2
https://wiki.ubuntu.com/Grub2#Recover%20Grub%202%20via%20LiveCD
http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html#Re-install_GRUB_from_Live_CD
How to restore the Ubuntu/XP/Vista/7 bootloader (Updated for Ubuntu 9.10)
http://ubuntuforums.org/showthread.php?t=1014708

Maheriano
November 10th, 2009, 10:18 PM
The way to reinstall grub2 is different than that for legacy grub.

I have save these links:
reinstall grub2
https://wiki.ubuntu.com/Grub2#Recover%20Grub%202%20via%20LiveCD
http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html#Re-install_GRUB_from_Live_CD
How to restore the Ubuntu/XP/Vista/7 bootloader (Updated for Ubuntu 9.10)
http://ubuntuforums.org/showthread.php?t=1014708

Awesome, thanks. Will this work for installing GRUB2 if he only had GRUB before? It says reinstall so I'm wondering if he'll have to install GRUB now since that's what was on there previously.

ratcheer
November 10th, 2009, 10:22 PM
Here is the current documentation on grub2. Should have everything on installing, reinstalling, and using it. Even covers errors and troubleshooting.

https://help.ubuntu.com/community/Grub2

Tim

Irony
November 10th, 2009, 10:52 PM
Just boot up with your ubuntu live CD then issue the following commands in terminal;


sudo grub

This opens up the grub program, with a prompt of grub>, now type;


find /boot/grub/stage1
root (hd0,X)
setup (hd0)
quit

If your ubuntu install is on say hda3 or sda3 then (hd0,X) is (hd0,2) which is what the find command is doing. setup (hd0) means install to the MBR which is the place to do it.

caue.rego
November 18th, 2009, 07:16 AM
Just boot up with your ubuntu live CD then issue the following commands in terminal;


sudo grub

This opens up the grub program, with a prompt of grub>, now type;


find /boot/grub/stage1
root (hd0,X)
setup (hd0)
quit

If your ubuntu install is on say hda3 or sda3 then (hd0,X) is (hd0,2) which is what the find command is doing. setup (hd0) means install to the MBR which is the place to do it.

This doesn't work with Karmic Koala any more. As others already mentioned, it comes with grub2, which works differently. The links provided are already helpful enough, but I'll add a direct official one (which I find not to be as simple as the wiki or the updated topic already mentioned):
https://help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD

From my experience, basically the "new steps" are quite easy:
0. Boot to the LiveCD Desktop (Ubuntu 9.10 or later)
1. From the Places menu, select and mount (double-click) the partition with your Ubuntu installation
2. sudo grub-setup -d /media/XXXX/boot/grub /dev/sda
3. if 2 fails: sudo grub-install --root-directory /media/XXXXX /dev/sda

Just keep in mind you better read more and understand what you're doing before frenzing on those steps.

Maheriano
November 18th, 2009, 09:00 PM
Just boot up with your ubuntu live CD then issue the following commands in terminal;


sudo grub

This opens up the grub program, with a prompt of grub>, now type;


find /boot/grub/stage1
root (hd0,X)
setup (hd0)
quit

If your ubuntu install is on say hda3 or sda3 then (hd0,X) is (hd0,2) which is what the find command is doing. setup (hd0) means install to the MBR which is the place to do it.

This worked perfect for his 9.1 install, thanks.