Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub2 break Windows 7 mbr (dual boot)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
CyberMuz
n00b
n00b


Joined: 03 Jan 2012
Posts: 41

PostPosted: Sun Jan 19, 2014 12:00 pm    Post subject: Grub2 break Windows 7 mbr (dual boot) Reply with quote

I have Gento and Windows 7 on my machine, i have recently upgraded to GRUB2 and after the grub install i can't boot to windows.
THis is my setup:
Code:

fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x77777777

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   102398309    51199123+   7  HPFS/NTFS/exFAT
/dev/sda2       102398371   488392064   192996847    f  W95 Ext'd (LBA)
/dev/sda5       102398373   225279494    61440561    7  HPFS/NTFS/exFAT
/dev/sda6       225279558   389110364    81915403+   7  HPFS/NTFS/exFAT
/dev/sda7       389113856   390137855      512000   83  Linux
/dev/sda8       390139904   482414591    46137344   83  Linux
/dev/sda9       482416640   488392064     2987712+  82  Linux swap / Solaris


In grub.cnf i have added the following:
Code:

   menuentry "Windows 7 BIOS/MBR" {
      insmod part_msdos
      insmod ntldr
      insmod ntfs
      ntldr (hd0,msdos1)/bootmgr
   }


When I select the Windows 7 in grub menu I get the following error
[IMG]http://i.imgur.com/HlBKM2t.jpg[/IMG]

To fix Windows boot I have to insert the Win installation directory and run BootRec.exe /fixmbr (from command prompt) but then system boots directly to windows (no grub). If I reinstall grub then Windows is not working. :-/
Any idea how I can fix this issue?
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Sun Jan 19, 2014 12:28 pm    Post subject: Reply with quote

It is strange enough that you managed to install grub2. You should get an error during grub2-install. Free space before first partition isn't enough to fit grub2 boot image. Your partition should start at 2048th sector, not at 63th. Probably grub2-install overwrites Windows files and leads to Windows boot breakage.
Back to top
View user's profile Send private message
CyberMuz
n00b
n00b


Joined: 03 Jan 2012
Posts: 41

PostPosted: Sun Jan 19, 2014 3:24 pm    Post subject: Reply with quote

Grub2 install doesn't report any errors. I had sabayon installed on this machine that also used Grub2 and it could boot to WIndows without any problem. I delete sabayon and installed Gentoo on the same partition, I didn't change anything on Windows partitions.
Is there a way to have dual boot with grub2 without rearranging the partitions?
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Sun Jan 19, 2014 11:00 pm    Post subject: Reply with quote

It's hard to predict the Windows behavior when something change in the partition tables and/or when you format one of them. creaker point that the first sector of the first partition do not start at 2048. I see that the extended partition is not the fourth one. If the C partition come after, Windows can feel any change more easily.

I dont know the exact cause of the Windows boot incapability, you can make a search about Windows problems related with Grub. One thing I did to resolv a problem I had to bualboot Windows with Gentoo in EFI mode with Grub2, was to remove Windows. :D

The way things are going in DOS/MBR and GPT partition tables and in BIOS and EFI modes, it is easier to use a Windows bootloader to boot Windows/Linux than a Linux bootloader to do it.

On quetion, if the first partition is the Windows boot partition, have you try to make Grub only chainload to the first partition like this
Code:
menuentry "Windows 7 BIOS/MBR" {
      root (hd0,msdos1)
      chainloader +1
      boot
   }

Note that you should not edit the /boot/grub/grub.cfg file directly, but use the /etc/grub.d/40_custom file to make an entry instead and than
Code:
grub2-mkconfig -o /boot/grub/grub.cfg

_________________
Paul


Last edited by Logicien on Mon Jan 20, 2014 3:40 pm; edited 2 times in total
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Mon Jan 20, 2014 8:50 am    Post subject: Reply with quote

That's the reason I boot _through_ Windows to a grub partition - Windows is
pretty neurotic, especially on my laptops. It adds about 10 seconds to the
boot time, but it's worth it for peace of mind and easy setup (given a separate
grub boot partition).

Google for EasyBCD to get an idea of what's possible.

Good luck - Will
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum