You are not logged in.

#1 2010-01-03 08:10:09

xiaweitang
Member
Registered: 2010-01-03
Posts: 61

dual booting, grub, MBR, confusing

Here is the story. It was a laptop with a single hard drive. The original partition looks like this

sda1 ntfs bootable
sda2 ntfs Windows 7

So I guess sda1 is where the Win bootloader resides. I used parted to shrink sda2 and made two new partions:

sda1 ntfs bootable
sda2 ntfs Windows 7
sda3 linux (later mounted at /)
sda4 swap

I boot with Arch CD and after the menu.lst file is finished, it asked me to choose where to install GRUB with the following choices

sda
sda1
sda2
sda3
sda4

I guess sda is the so called MBR.Following the Arch wiki on dual booting, I chose to install it to sda, but it failed. Then I chose sda3, the root partition, and it went through. I was able to reboot with a grub menu

Arch
Arch fallback
Windows

I chose Windows just to make sure I can go back to it, and it worked. However, the next time I reboot the grub menu didn't show up and it directly goes to windows. So I guess it's because the windows bootloader over rides the linux bootloader.

I reinstalled Arch, this time I reformatted sda1 to linux and mounted to /boot. I knew there is a risk to loose windows, but I didn't care becuase I have no important stuffs there. It succeded and I can boot to Arch. Now the problem is I can't boot to windows. The error says something like "can't find bootmgr for windows". I tried to change "rootnoverify (hd0,0)" to "rootnoverify (hd0,1)" in menu.lst, but it didn't help.

So the real questions are
1) What is that stupid sda1 for windows? It's over 100MB, why so large?
2) Is MBR contained in sda1 or before it?
3) Is sda the MBR? If it is, why grub failed to install to it?
4) How to fix this situation?

Below is the menu.lst and fstab

# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst

# DEVICE NAME CONVERSIONS 
#
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/sda        (hd0)
#  /dev/sdb2       (hd1,1)
#  /dev/sda3       (hd0,2)
#

#  FRAMEBUFFER RESOLUTION SETTINGS
#     +-------------------------------------------------+
#          | 640x480    800x600    1024x768   1280x1024
#      ----+--------------------------------------------
#      256 | 0x301=769  0x303=771  0x305=773   0x307=775
#      32K | 0x310=784  0x313=787  0x316=790   0x319=793
#      64K | 0x311=785  0x314=788  0x317=791   0x31A=794
#      16M | 0x312=786  0x315=789  0x318=792   0x31B=795
#     +-------------------------------------------------+
#  for more details and different resolutions see
#  http://wiki.archlinux.org/index.php/GRUB#Framebuffer_Resolution 

# general configuration:
timeout   5
default   0
color light-blue/black light-cyan/blue

# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

# (0) Arch Linux
title  Arch Linux
root   (hd0,0)
kernel /vmlinuz26 root=/dev/sda3 ro vga=773
initrd /kernel26.img

# (1) Arch Linux
title  Arch Linux Fallback
root   (hd0,0)
kernel /vmlinuz26 root=/dev/sda3 ro vga=773
initrd /kernel26-fallback.img

# (2) Windows
title Windows
rootnoverify (hd0,1)
makeactive
chainloader +1
# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

#/dev/cdrom             /media/cd   auto    ro,user,noauto,unhide   0      0
#/dev/dvd               /media/dvd  auto    ro,user,noauto,unhide   0      0
#/dev/fd0               /media/fl   auto    user,noauto             0      0

/dev/sda1 /boot ext4 defaults 0 1
/dev/sda3 / ext4 defaults 0 1
/dev/sda4 swap swap defaults 0 0

Offline

#2 2010-01-03 09:10:13

JuseBox
Member
Registered: 2009-11-27
Posts: 260

Re: dual booting, grub, MBR, confusing

Sadly when you reformatted sda1 that was where windows held its boot record. Since then being deleted and replaced with linux's /boot.  Best way to fix this is to get your window repair disk and get the sda1 partion back to windows. Using sda3/4/5 or how ever many partions you have install arch to those partions then when your installing grub through the installer just install grub to sda... The first time you did it was correct. tehre might have been and issue with the timeout in grub and thats why it went straight to windows.


Linux ArchLinux 3.2.8-1-ARCH
#1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012 x86_64 AMD FX(tm)-8120 Eight-Core Processor AuthenticAMD GNU/Linux
8192MB DDR3 1300MHz | Asus m5a97 | GeForce GTX 550 Ti | 120 GB SSD

Offline

#3 2010-01-03 19:10:02

xiaweitang
Member
Registered: 2010-01-03
Posts: 61

Re: dual booting, grub, MBR, confusing

JuseBox wrote:

Sadly when you reformatted sda1 that was where windows held its boot record. Since then being deleted and replaced with linux's /boot.  Best way to fix this is to get your window repair disk and get the sda1 partion back to windows. Using sda3/4/5 or how ever many partions you have install arch to those partions then when your installing grub through the installer just install grub to sda... The first time you did it was correct. tehre might have been and issue with the timeout in grub and thats why it went straight to windows.

The problem is grub can't be installed to sda in the first place. It always fails.

Offline

#4 2010-01-04 03:59:16

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: dual booting, grub, MBR, confusing

I have never heard of Windows (automatically) writing a new bootloader... ever.  And I've never heard of GRUB being able to load directly from a partition >1 without being chainloaded.  Are you sure you got the details of your post correct????

Grub is usually by most people installed to the MBR (i.e. the first sector (first 512 bytes) of a storage device) for simplicities sake.  This line: 'I guess sda is the so called MBR.Following the Arch wiki on dual booting, I chose to install it to sda, but it failed' doesn't tell us anything, we need more details.  To help in the future, when you encounter a problem (and are new) post here before things get too bad.  Look at GRUB on the wiki for more information:

http://wiki.archlinux.org/index.php/Gru … stallation


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#5 2010-01-04 05:29:39

xiaweitang
Member
Registered: 2010-01-03
Posts: 61

Re: dual booting, grub, MBR, confusing

In my case GRUB can't be installed to sda and the error message is simply something as "failed to install", no other details. Does it generate more detailed information somewhere in a file? The second time I installed GRUB to sda2, it indeed went through. I know it didn't make sense, but it did went through. Maybe some config files are corrpted, but I don't know.

Offline

#6 2010-01-04 17:04:00

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: dual booting, grub, MBR, confusing

Interesting that installing GRUB to sda2 booted to the GRUB menu.  The GRUB install must have partially installed GRUB to the MBR the first time but not completely that gave you the 'failed to install' message.  The GRUB bootloader is only able to be loaded if it is on /dev/sda or /dev/sda1.  From the GRUB documentation:

If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader. Refer to the manual for the boot loader to know how to chain-load GRUB.

So I'm thinking that the 'partial' GRUB install to the MBR must have somehow loaded the first time you tried GRUB and you were able to select Windows.  And the second time it didn't then looked for a bootloader on sda1 where your Windows bootloader was.   Hmm.... have you tried installed GRUB from the manual install method from the link mentioned above?


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#7 2010-01-04 23:58:35

xiaweitang
Member
Registered: 2010-01-03
Posts: 61

Re: dual booting, grub, MBR, confusing

Gen2ly wrote:

Interesting that installing GRUB to sda2 booted to the GRUB menu.  The GRUB install must have partially installed GRUB to the MBR the first time but not completely that gave you the 'failed to install' message.  The GRUB bootloader is only able to be loaded if it is on /dev/sda or /dev/sda1.  From the GRUB documentation:

If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader. Refer to the manual for the boot loader to know how to chain-load GRUB.

So I'm thinking that the 'partial' GRUB install to the MBR must have somehow loaded the first time you tried GRUB and you were able to select Windows.  And the second time it didn't then looked for a bootloader on sda1 where your Windows bootloader was.   Hmm.... have you tried installed GRUB from the manual install method from the link mentioned above?

No I havn't tried the manual method. Now that the grub is installed to MBR and Arch works but Windows not. I tried use the Windows installation disk and repair, but it didnt' work. How can I get windows back, without reinstalling Arch or Windows? Another question, the wiki desribes how to install Arch when there is already a windows, but how to install windows after Arch is installed to get dual boot? I guess Windows installer will erase the MBR and won't ask me for an option.

Offline

Board footer

Powered by FluxBB