LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub menu doesnt load at startup : dual boot : grub in the /boot partition (http://www.linuxquestions.org/questions/linux-general-1/grub-menu-doesnt-load-at-startup-dual-boot-grub-in-the-boot-partition-839270/)

jayesh.bhoot 10-20-2010 08:32 AM

Grub menu doesnt load at startup : dual boot : grub in the /boot partition
 
Yesterday I installed Arch Linux on my laptop. I had Windows 7 already installed on /dev/sda1 (hd0,0).
The root partition or Arch is on /dev/sda3 (hd0,2).
Also, I installed grub on root partition and not on MBR.
I configured grub accordingly.

The grub entries look like below :
Code:

# 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  9
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,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-label/rootp ro nomodeset
initrd /boot/kernel26.img

# (1) Arch Linux
title Arch Linux Fallback
root (hd0,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-label/rootp ro nomodeset
initrd /boot/kernel26-fallback.img

# (2) Windows
title Windows7
rootnoverify (hd0,0)
#makeactive
chainloader +1

Here "rootp" is the label that i gave to the root partition. I would also like to mention that I did give a try of using /dev/sdx format for fstab entries as well as grub entries.
I found everything right in the menu.lst file. But when I boot, the grub command line hits the screen instead of the desired menu.

From the command line, I made the grub identify its root partition by :

Code:

root (hd0,2)
Also, from here I was not only able to boot the linux kernel (by using the appropriate kernel and initrd commands), but I was also able to generate the menu by running the following the command :

Code:

configfile /boot/grub/menu.lst
The menu appeared and worked correctly, i.e., both windows and arch loaded from that menu correctly.

So why doesnt the grub menu load at the first place?

MrUmunhum 10-20-2010 04:01 PM

if you want to boot Grub, install it in the MBR.

jayesh.bhoot 10-21-2010 04:01 AM

Quote:

Originally Posted by MrUmunhum (Post 4134005)
if you want to boot Grub, install it in the MBR.

Yeah. I am aware of that option. But isn't what I am trying possible? Even the arch wiki instructed to install the grub on the boot partition.

syg00 10-21-2010 04:46 AM

Quote:

Originally Posted by jayesh.bhoot (Post 4133525)
I installed grub on root partition and not on MBR.
I configured grub accordingly.
...
But when I boot, the grub command line hits the screen instead of the desired menu.
...
So why doesnt the grub menu load at the first place

If you didn't install grub to the MBR you woudn't even get a grub prompt.
Quote:

Even the arch wiki instructed to install the grub on the boot partition.
That is not my recollection - installing to the partition boot sector record is an option. However you still need code in the MBR to find it.

jayesh.bhoot 10-22-2010 10:46 AM

Quote:

Originally Posted by syg00 (Post 4134524)
If you didn't install grub to the MBR you woudn't even get a grub prompt.

Well, I was/am kind of confused with that fact.

Quote:

That is not my recollection - installing to the partition boot sector record is an option. However you still need code in the MBR to find it.
I got this idea from this page :
http://wiki.archlinux.org/index.php/...Arch_Dual_Boot

And regarding the need to have some code in MBR, yes, I agree to that.
I did not have a detailed idea about how it worked.

Anyways, I set up the grub using
Code:

setup (hd0)
which I guess is used to install and configure the grub in the MBR.

Do correct me if I am wrong in my understanding.
Now I have the menu appearing at startup. So I consider this problem as solved.

However if someone has any elaborations over this problem please share. :)

yancek 10-22-2010 11:01 AM

Generally, Grub is installed during the installation of your operating system and the default is always (or almost always) to install to the master boot record.

The standard methods of installing Grub if it was not successfull during the operating system install are:

grub-install /dev/sda

This would need to be run from your Linux partition you want to boot if you have multiple Linux installations.

To install Grub to the third partition of the first drive from the grub prompt:

root (hd0,2)
setup (hd0)
quit

The above works on Grub Legacy. Grub2 numbering is different, numbering partitions from one rather than zero. I haven't used Grub2 so I don't know if this method still works.

syg00 10-22-2010 06:07 PM

We don't know what you were planning to do - as in use the Win7 bootloader, or grub - or what you may have done to try to achieve it.
Had you done a normal Arch install, grub would be installed to the MBR, and would find that menu.lst - unless it was moved subsequently. The use of "setup (hd0)" following a "root(hd?,?)" to identify the grub root directory will (usually) fix things. The grub-install mentioned above is merely a wrapper around these commands - although it does do some sanity checks.

jayesh.bhoot 10-23-2010 03:58 AM

Yes! Even I feel that I confused you people. :o
But I followed the same steps that yancek and syg00 suggested and its all working perfectly now.
So, I would rather call this as solved than creating more confusion. :)

Thank you for help :)


All times are GMT -5. The time now is 11:47 PM.