Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
09-21-2009, 12:44 AM
|
#1
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Rep:
|
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 ?
|
|
|
|
09-21-2009, 05:42 AM
|
#2
|
|
LQ Veteran
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
|
From any linux distro that you can get to boot from terminal as root please post the results of 'fdisk -l'.
|
|
|
|
09-28-2009, 03:19 PM
|
#3
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
fdisk -l drive partitions from Ubuntu 8.04, on 9-28-09;
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x44fdfe06
Device Boot Start End Blocks Id System
/dev/sda1 1 7310 58717543+ c W95 FAT32 (LBA)
/dev/sda2 * 7311 9529 17824117+ 83 Linux
/dev/sda3 9530 11749 17832150 83 Linux
/dev/sda4 11750 60801 394010190 5 Extended
/dev/sda5 11750 13838 16779861 83 Linux
/dev/sda6 13839 14099 2096451 82 Linux swap / Solaris
/dev/sda7 14100 15927 14683378+ 83 Linux
/dev/sda8 15928 17885 15727603+ 83 Linux
/dev/sda9 17886 19843 15727603+ 83 Linux
/dev/sda10 19844 23759 31455238+ c W95 FAT32 (LBA)
/dev/sda11 23760 25717 15727603+ 83 Linux
/dev/sda12 25718 60801 281812198+ 83 Linux
Disk /dev/sdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x89518951
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 7833 62918541 7 HPFS/NTFS
/dev/sdb2 7834 10444 20972857+ 83 Linux
/dev/sdb3 10445 12402 15727635 83 Linux
/dev/sdb4 12403 24321 95739367+ 5 Extended
/dev/sdb5 12403 12663 2096451 82 Linux swap / Solaris
/dev/sdb6 12664 14621 15727603+ 83 Linux
/dev/sdb7 14622 16580 15735636 83 Linux
/dev/sdb8 18147 19974 14683378+ 83 Linux
/dev/sdb9 19975 24321 34917246 b W95 FAT32
/dev/sdb10 16581 18146 12578863+ 83 Linux
Partition table entries are not in disk order
|
|
|
|
09-28-2009, 06:32 PM
|
#4
|
|
LQ Veteran
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
|
The first logical partition sdb5 is a swap partition. Try installing grub to sdb6 then change your menu,lst to chainload
(hd1,5).
|
|
|
|
09-29-2009, 02:54 PM
|
#5
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
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.
|
|
|
|
09-29-2009, 03:09 PM
|
#6
|
|
LQ Veteran
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
|
First you should not have to partition the extended partition, but it will be unusable space.
I do not understand what exactly you want to boot.
Which hd do you want to boot from and what partition?
|
|
|
|
10-02-2009, 03:26 PM
|
#7
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
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).
|
|
|
|
10-02-2009, 08:17 PM
|
#8
|
|
LQ Veteran
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
|
Use your ubuntu cd and in terminal see if you can get a grub command with 'sudo grub' without the quotes then enter:
grub> root (hd0,4)
setup (0,4)
exit
Then make sure your menu.lst has the partition numbered right.
Last edited by Larry Webb; 10-02-2009 at 08:19 PM.
|
|
|
|
10-02-2009, 10:01 PM
|
#9
|
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,220
|
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 ?.
|
|
|
|
10-04-2009, 03:50 AM
|
#10
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
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.
|
|
|
|
10-04-2009, 10:47 PM
|
#11
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
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 ?
|
|
|
|
10-05-2009, 12:00 AM
|
#12
|
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,220
|
If you had typed what I had suggested, it would have been more meaningful. No closing bracket.
|
|
|
|
10-05-2009, 01:03 AM
|
#13
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
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
|
|
|
|
10-05-2009, 03:32 PM
|
#14
|
|
Member
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 333
Original Poster
Rep:
|
So here is the result of that root (hd and hit tab key; "Possible disks are: hd0 hd1", that's all it said from the grub prompt, thanks.
|
|
|
|
10-05-2009, 04:04 PM
|
#15
|
|
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Rep: 
|
Larry Webb's suggestion is the one I used but with a small correction. (I use setup (hd0,4) and not setup (0,4) which I believe is just a typo)
If you have Linux in (hd0,1), (hd0,2), (hd0,3).....(hd0,15)
You can make all of them chainloadable in one operation in any Grub prompt or Grub shell
Code:
root (hd0,1)
setup (hd0,1)
root (hd0,1)
setup (hd0,2)
root (hd0,3)
setup (hd0,3)
...
...
...
root (hd0,15)
setup (hd0,15)
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.
Last edited by saikee; 10-05-2009 at 04:39 PM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:01 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|