LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-24-2010, 02:13 PM   #1
Nizzok
LQ Newbie
 
Registered: Dec 2009
Posts: 29

Rep: Reputation: 0
How to repair grub2 in MBR? win7/10.10 dual boot.


Hi everyone, I apologize for re-posting what seems to be a common problem. I have a win7/10.10 dual-boot set up, more or less following the lifehacker.com tutorial (I know, I know). I had to reinstall windows, and its taken over the MBR so that only win7 boots now. My shared drive and the ubuntu filesystem are still there, I just can't get to them without a boot cd. So, I tried to follow the tutorials, which all basically say to reinstall grub or grub2. I tried one method, but ubuntu told me that installing grub2 anywhere but the MBR was a bad idea. Ok...so how do I do this so that ubuntu and win7 stay happy, but I get my grub menu back? Thanks in advance.
 
Old 12-24-2010, 02:24 PM   #2
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,989

Rep: Reputation: 544Reputation: 544Reputation: 544Reputation: 544Reputation: 544Reputation: 544
Have you tried
"sudo os-prober"
and
"sudo update-grub"
?

Is your ubuntu desktop or server edition?

Last edited by EDDY1; 12-24-2010 at 02:25 PM.
 
Old 12-24-2010, 03:01 PM   #3
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
You have reinstalled Win 7 , so Grub is gone I assume .
So you do not have a other option than reinstalling GRUB .
After that if windows does not appear run the command susdo update-grub
If windows 7 is capable of booting UBUNTU than you can install GRUB on the root partition UBUNTU and let WIndows do the booting .
But do not ask me how , I do not use windows,.
 
Old 12-25-2010, 08:09 AM   #4
imagine_me2
Member
 
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136

Rep: Reputation: 22
boot ur ubuntu cd/dvd then select the rescue mode (there should be something like that)..

if the disk image is mounted under some other path then

#chroot "path" eg. #chroot /mnt/sysimage

#grub

grub> root (hdX,Y).... this is where ur linux is (hd0,0) for 1st part. (hd0,1) for 2nd part and so on

grub> setup (hdX) ..... usually (hd0)

exit and reboot
 
Old 12-25-2010, 09:47 AM   #5
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Quote:
Originally Posted by Nizzok View Post
I tried one method, but ubuntu told me that installing grub2 anywhere but the MBR was a bad idea. Ok...so how do I do this so that ubuntu and win7 stay happy, but I get my grub menu back? Thanks in advance.
You probably tried
Code:
grub-install /dev/sda3
rather than
Code:
grub-install /dev/sda
Obviously, I've missed out the rest of the commands and the partition may be wrong, but basically you want to be installing onto the drive, "/dev/sda" not a partition, "/dev/sdaX"
 
Old 12-25-2010, 06:12 PM   #6
Nizzok
LQ Newbie
 
Registered: Dec 2009
Posts: 29

Original Poster
Rep: Reputation: 0
Hi all,

Thanks for your responses. I've tried a lot different tutorials, and I'm not sure what I'm doing wrong.

Here are the results of os-prober, and just trying to update grub.
Code:
ubuntu@ubuntu:~$ sudo os-prober
/dev/sda1:Windows 7 (loader):Windows:chain
/dev/sda3:Ubuntu 10.10 (10.10):Ubuntu:linux
ubuntu@ubuntu:~$ sudo update-grub
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
and for reference here's the results of fdisk -l
Code:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0x000d7d9e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              13        4279    34267136    7  HPFS/NTFS
/dev/sda3            4280        7834    28555537+  83  Linux
/dev/sda4            7836       19457    93353715    7  HPFS/NTFS
So, I thought it was because I hadn't mounted the drive, but even after having mounted the drive, it still doesn't work

Code:
sudo mount /dev/sda
mount: can't find /dev/sda in /etc/fstab or /etc/mtab
ubuntu@ubuntu:~$ sudo mount /dev/sda /mnt
mount: /dev/sda already mounted or /mnt busy
ubuntu@ubuntu:~$ sudo grub-install /dev/sda
/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.
Anyway, I'm not sure what to try to do next. Most of the tutorials on line don't apply to this system, or repeat some of the steps suggested above.

thanks again from the n00b

PS...only win7 loads...

Last edited by Nizzok; 12-25-2010 at 06:18 PM. Reason: adding stuff
 
Old 12-25-2010, 07:17 PM   #7
Nizzok
LQ Newbie
 
Registered: Dec 2009
Posts: 29

Original Poster
Rep: Reputation: 0
Ok...
so...I ran this code successfully

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

this now borked the system completely as win7 now does not load either and I just get a black screen where the boot menu would have been

Last edited by Tinkster; 12-26-2010 at 02:47 PM. Reason: profanity removed.
 
Old 12-25-2010, 09:30 PM   #8
Nizzok
LQ Newbie
 
Registered: Dec 2009
Posts: 29

Original Poster
Rep: Reputation: 0
forget it, went nuclear and just re-did the linux install, all seems to be well. I really wanted to fix it though...
 
Old 12-25-2010, 10:05 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,429

Rep: Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055
Have a read of this.
For future reference take particular note of section 12 - of the options presented, I prefer method 3, the chroot. Note that you mount partitions (or directories), not device(s).
 
Old 01-11-2013, 10:56 AM   #10
smartgilli
LQ Newbie
 
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
Solution for newbie's

This might help someone who come across this thread ,,
ssatish.wordpress.com/2013/01/11/how-to-re-install-grub-2-in-mbr-from-ubuntu-live-disk/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to repair Grub2 for Ubuntu 10.04 in multi-boot scenario thepenquin Linux - Newbie 3 01-10-2011 10:56 AM
[SOLVED] Attempting DUAL BOOT Win7 with Kub 10.04 Bhakta Neal Linux - Newbie 33 07-28-2010 06:39 PM
how to make a win7 and backtrack 4 dual boot? kevinx17910 Linux - Newbie 1 06-08-2010 01:09 AM
adding Fedora 10 to dual boot with Win7? lenny45 Fedora 11 10-19-2009 01:04 AM
Using the installation CD to boot and repair the MBR in Mandrake 10 dvela Mandriva 5 08-19-2004 10:17 AM


All times are GMT -5. The time now is 05:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration