[SOLVED] how can a boot sector be repaired to then allow grub to install for chainload booting
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how can a boot sector be repaired to then allow grub to install for chainload booting
I need to know how can a boot sector be repaired to then allow grub to be installed, and boot by chainload. This is for a Ubuntu 9.04 new install on the first logical partition inside the extended partition on a SATA external hard drive, (connected by eSATA). I boot multiple systems from a main grub on the internal IDE drive, including some Linux such as Ubuntu on the external hard drive by the normal method with root, kernel, and the initrd lines added into the /boot/grub/menu.lst file. But since I do have the other Linux installs with grub onto their root partitions, I do like to be able to chainload to some as well. The error message from grub when a boot attempt is made by chainload is; "Invalid device requested", error 12, or just a dark screen with a cursor. And when I try to install grub to that boot sector from a grub prompt at the main grub boot loader screen, it says stage 1.5 fails, but stages 1 and 2 succeed. Then when I boot into the Ubuntu 9.04, and try a grub install from terminal as sudo root, it gives error 17, "cannot mount partition". So is there a command which will fix corrupt boot sectors ?
The /dev/sdb 200 GB is a internal IDE drive, and that sda 500 GB drive is my eSATA connected external drive, which has Ubuntu 9.04 on sda5 and is the parttion boot sector I have not been able to fully install grub to. On that external SATA drive; sda1 is a fat32 storage, and sda2 is PCLinux installed with it's grub on it's root, which does chainload from the main grub on the internal sdb where windows XP is installed also. Within the extended partition can there be unallocated space, or should there be only formatted partitions inside the extended, and have any unused space be outside of the extended partition ? Thanks for the help.
All my operating systems boot fine now from my main grub on the internal drive, but I also like to chainload to Linux partitions installed on the external drive too. So I put grub on each Linux root boot sector to have that chainload option. Only the new Ubuntu 9.04 on sda5 is not able to do this method, but boots by the normal method, (root, kernel, and initrd).
I'd be guessing the external isn't bootable. From the grub boot menu - not the grub command from a terminal - (with the external plugged in) go to command mode and enter "root (hd" (no quotes) and hit the <tab> key. It will either auto-complete hd0, or offer you an option to pick a disk.
What happens ?.
Larry Webb; For the BIOS drive order and how grub sees them also, the first drive as; hd0, is the internal hard drive, so that the external is as hd1, and my Ubuntu 9.04 is on the external drive as; (hd1,4) so 2nd drive and fifth partition. The exception is the Fedora 11 installed on the internal drive, which views the drives switched from that.
syg00; I will try that idea, and post back soon, thanks.
When I did try that; root (hd), and hit the tab key, from my main grub at a grub prompt it gave this error; "error 23, error while parsing number", so what the heck does that mean then ?
I see then, so like this; root (hd0 , without the other ). Thanks for the correction, I thought that was a typing error with the ) missing. I will try that on the next reboot.
Last edited by james2b; 10-05-2009 at 01:05 AM.
Reason: more
Thereafter the command in menu.lst to boot them are
Code:
title Linux in (hd0,1)
root (hd0,1)
chainloader +1
title Linux in (hd0,2)
root (hd0,2)
chainloader +1
title Linux in (hd0,3)
root (hd0,3)
chainloader +1
...
...
...
title Linux in (hd0,15)
root (hd0,15)
chainloader +1
The only exception is the Linux controlling the MBR must be booted directly using the "kernel" and "initrd" command. Why? Simple, if you don't Grub will chase its own tail on this one!
The above is the exact method I used to boot 145 OSes. I even wrote the Grub menu.lst before I installed the OSes! I hosted Grub alone in a data-only Fat partition so that every one of the 145 system was chainloaded.
-------------------
Theory
Each partition has a reserved boot sector just for the boot loader right at the beginning of the partition. Every M$ system uses it from Dos to Win7 so it is a standard. A M$ system by default must install its boot loader there. Most Linux filing systems also have it but a few odd filing systems apparently have none. The Grub's "setup" command will install the Grub sourced from the partition specified by the "root" command.
Grub is laughingly simple. Don't make it more complicated than what it is.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.