LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 08-29-2008, 07:25 AM   #1
maxvonseibold
Member
 
Registered: Mar 2006
Location: Oxford, UK.
Distribution: Debian, Ubuntu, RHEL5, OSX
Posts: 41

Rep: Reputation: 15
Unhappy Grub, Problem with installing to correct area and loading.


Hello,

I am having major problems with grub.

My setup is:-

A Dell Precision 390.

Two Sata, 160 gig hard drives sda and sdb

I have RHEL5 and Debian on SDB (the Second hard drive) partitions 1 and 2.

I want to put Ubuntu on SDA1 (the first hard drive).


The install process is fine but I cannot get the installer to update the existing grub on sdb which loads RHEL and Debian.
I have tried manually adding an entry to menu.lst for the sdb grub but attempts at booting result in:-

Code:
Error 15 or "Error 17 :  Cannot Mount the selected partition" errors.

I have also tried to install grub using 'grub-install' with the following:-


Code:
grub-install /dev/sda1
Code:
Searching for GRUB installation directory ... found: /boot/grub
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0)	/dev/sda
(hd1)	/dev/sdb
machine_name:~# ls /boot/

This looks encouraging but when I ls the drive there is only the following:-


Code:
abi-2.6.24-19-generic	  
initrd.img-2.6.24-19-generic	
System.map-2.6.24-19-generic
config-2.6.24-19-generic  
memtest86+.bin		
vmlinuz-2.6.24-19-generic

i.e. the Kernel images are there, but no way of loading them.


Code:
grub-install --root-directory=/boot /dev/sda2
This put a boot directory into the existing one on sdb which is not what I want!

I tried mounting sda1 to mnt and then doing:-

Code:
machine_name:/mnt# grub-install --root-directory=/mnt /dev/sda1
mkdir: cannot create directory `/mnt/boot': Read-only file system
No luck there either.


Code:
fdisk /dev/sda > p 

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          37      297171   83  Linux
/dev/sda2              38        9598    76798732+  83  Linux
/dev/sda3            9599       19452    79152255   83  Linux

sda1 is a 300m boot partition where I would like grub to go.
sda2 is for /


In the BIOS settings there is NO way to specify the hard drive order. SO I tried physically swapping the cables over, but the message stated that it could not find an OS to load ....

Can anyone advise me on what to do here!

Many Thanks,



Max.
 
Old 08-29-2008, 09:18 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
I can't follow all those details, so let's start from the beginning.

If you want a drive to be bootable, there must be boot code in the MBR of the drive (the first sector). Putting GRUB on a partition does no good unless there is something that links to it.

Assuming that you can boot into something, all you have to do is edit the appropriate menu.lst to point to the other drive. When GRUB is installed to the MBR, it gets "hard-coded" to point to the partition containing its files. If you don't know where this is, just look at all the possibilities until you see the menu.lst that matches what you see on the GRUB menu at startup.

Once you are booted into a working Linux, then proceed as follows:
fdisk -l ....##to confirm the drive numbering
Locate the correct menu.lst file
lets assume that Ubuntu is on sdb1, and there is no separate /boot partition. The menu.lst entry will look like this:
title Ubuntu
root (hd1,0) ...##This is Grub's way of saying 2nd drive, 1st partition
kernel /boot/vmlinuz...... root=/dev/sdb1 ro
initrd /boot/initrd....
boot

I always alias the vmlinuz..... and initrd..... filenames to simply "vmlinuz" and "initrd". Then I don't have to know the actual names when setting up menu.lst entries.

Note the two "root" statements: The first one tells GRUB where the boot files are. The second one tells the kernel where to mount "/"--ie the root of the filesystem

More gory details in the "booting" link below
 
Old 08-29-2008, 09:40 AM   #3
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Let us see just plain fdisk -l, it appears that you have linux on sda. Do you want to point grub to its own partition?
 
Old 08-29-2008, 09:43 AM   #4
maxvonseibold
Member
 
Registered: Mar 2006
Location: Oxford, UK.
Distribution: Debian, Ubuntu, RHEL5, OSX
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks pixellany,

I was unclear on the aspect of the MBS pointing to grub.

However, what is strange from this is that I did have a working grub from the original Debian installation. This grub could boot both linuxes of their own (second) hard drive and also boot a windows xp which had previously been on the first (sda) hard disk.

So from this I deduced that this grub can access both disks because it has done on many prior occations.

Soooooo... Surely adding a new entry to menu.lst as you suggested:-

Quote:
Code:
title Ubuntu
root (hd1,0) ...##This is Grub's way of saying 2nd drive, 1st partition
kernel /boot/vmlinuz...... root=/dev/sdb1 ro
initrd /boot/initrd....
boot
and then pointing the root and kernel at the new Ubuntu should make it work?

Despite these attempts I kept getting the Error 15 and 17 messages.

I also tried manually doing this when grub loaded and entering the grub shell to type the entries in myself and it still refuses to mount the first hard disk and start the boot sequence off.

Thanks for your feedback though, it has helped clarify several things.


Max.
 
Old 08-29-2008, 10:05 AM   #5
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,754

Rep: Reputation: Disabled
Try to use uuids
Your bios maybe complicating the drive order.
(hd1,0) maybe (hd0,0) relative Ubuntu!

The easiest thing to do is

Install one grub to the MBR.
Install the grub of others to their root partition and chainload them from the original grub.
 
Old 08-29-2008, 12:11 PM   #6
yancek
Senior Member
 
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Slackware
Posts: 4,143

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
Your entries with a separate /boot partition are going to be very different than if you install Grub stage1 to mbr and the rest of the Grub bootloader to the root partition. I would suggest you check out and read the information on this link, it's specific to Ubuntu but the info on Grub would be the same.

http://users.bigpond.net.au/hermanzo...boot_partition

I'd agree with amani about chainloading being the easiest.

Last edited by yancek; 08-29-2008 at 12:12 PM. Reason: forgot link
 
Old 09-01-2008, 03:06 AM   #7
maxvonseibold
Member
 
Registered: Mar 2006
Location: Oxford, UK.
Distribution: Debian, Ubuntu, RHEL5, OSX
Posts: 41

Original Poster
Rep: Reputation: 15
Hi guys,

I need to cram up on what you have just posted so let me have a read and I will try and reply asap.

Yancek, I did try running grub-install normally and with the seperate /boot partition after the first approach kept installing the files into a directory inside/boot/ on the already booted sdb drive.

Somewhere along the line here I seem to have got very muddled indeed.

Regarding the chainloading of grubs to grubs. Would this result the first grub menu appearing and then upon a selection, having a second new grub menu appear?

Thanks,


Max.
 
Old 09-01-2008, 06:56 AM   #8
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
On the chainloading that is right, a second grub menu.lst will appear, but you can almost eliminate it by changing the timeout to 1. You have to make sure the default selection is the os that you want to boot.
 
Old 09-01-2008, 07:05 AM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
You can also hide the menu.....

http://www.gnu.org/software/grub/man...tml#hiddenmenu
 
  


Reply

Tags
error, fdisk, gparted, grub, menulst


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub not loading after installing REDHAT 9 Pawan Sangal Red Hat 1 04-04-2008 02:33 AM
GRUB Loading starge 1.5... GRUB Loading please wait ERROR 21 davidjames Linux - Newbie 2 03-03-2008 10:01 AM
grub loading error 16 after installing ubuntu 6 timbuktu Linux - Newbie 1 07-08-2006 01:02 PM
Boot problem: "GRUB Loading stage2read Error" after installing PCI Ethernet card nsyng Fedora - Installation 1 06-06-2005 06:53 AM
Problems installing Gentoo / grub not loading wiredj Linux - Newbie 7 04-11-2004 05:17 PM


All times are GMT -5. The time now is 07:43 AM.

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