LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
Search this Thread
Old 04-08-2008, 12:47 PM   #1
just.srad
Member
 
Registered: Apr 2008
Location: Singapore
Distribution: Slackware 14.0
Posts: 126

Rep: Reputation: 15
How to use GRUB to detect the other linux partition


Hi,

Two questions....

I intend to build a multi-OS.

1. Install Windows XP on first primary partition (/dev/sda1)
2. Install Sabayon on first logical partition (/dev/sda6)
3. Install Freespire on the second logical partition (/dev/sda7)

i;m able to multi-boot for the windows xp and sabayon, but not the Freespire.

During the installation of the Freespire, i chose the option of not writing the MBR.


Q1.

How could i use GRUB to update the current menu.lst file in sabayon? i know there's another way of manually edit the menu.1st to point to the correct kernel and initrd in the Freespire partition.


Q2.
By the way, is there any URL or sources that i can refer to for the detailed explanation on GRUB.

Thanks a lot for the feedback.

Justin
 
Old 04-08-2008, 01:08 PM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,125

Rep: Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119
Quote:
Originally Posted by just.srad View Post
i;m able to multi-boot for the windows xp and sabayon, but not the Freespire.

During the installation of the Freespire, i chose the option of not writing the MBR.
If I understand you correctly, the MBR was written as the stage 1 for the copy of Grub in /dev/sda6/boot/grub. The menu.lst file in /dev/sda6/boot/grub contains choices for booting xp and sabayon. The menu.lst in /dev/sda7/boot/grub contains the choice to boot Freespire (and maybe choices to boot the other two as well) but that menu.lst never gets used, because nothing boots the associated Grub.

Quote:
How could i use GRUB to update the current menu.lst file in sabayon?
I don't know how or even whether you can.

Quote:
i know there's another way of manually edit the menu.1st
So why not do that.

Boot Sabayon. Edit the menu.lst files in /dev/sda6/boot/grub and /dev/sda7/boot/grub. Compare them. Even if you don't understand most of the details, it should be pretty obvious whether the second one contains everything (so you could just copy the second one overwriting the first) or whether each contains only part of what you need (so you can copy/paste the Freespire content from the second file as extra menu choices in the first file).
 
Old 04-08-2008, 08:18 PM   #3
just.srad
Member
 
Registered: Apr 2008
Location: Singapore
Distribution: Slackware 14.0
Posts: 126

Original Poster
Rep: Reputation: 15
Thanks Johnsfine.

I did the manual editing of the Sabayon grub's file just to make it work.
 
Old 04-08-2008, 08:19 PM   #4
just.srad
Member
 
Registered: Apr 2008
Location: Singapore
Distribution: Slackware 14.0
Posts: 126

Original Poster
Rep: Reputation: 15
Hmm... here's one link which give an explanation on grub

GRUB Illustration
 
Old 04-08-2008, 08:21 PM   #5
just.srad
Member
 
Registered: Apr 2008
Location: Singapore
Distribution: Slackware 14.0
Posts: 126

Original Poster
Rep: Reputation: 15
Anyone here can provide more information on the GRUB ...

Thanks a million...
 
Old 04-08-2008, 09:05 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,448

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
Try here - you're probably interested in grub legacy.
 
Old 04-17-2008, 07:48 PM   #7
just.srad
Member
 
Registered: Apr 2008
Location: Singapore
Distribution: Slackware 14.0
Posts: 126

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
Try here - you're probably interested in grub legacy.
Thanks for the link.. will go thru it later.
 
Old 04-20-2008, 11:30 AM   #8
irlandes
Member
 
Registered: Nov 2003
Posts: 117

Rep: Reputation: 16
Grub manual

There is a Grub manual available for download, Google.

Also, I don't know if we can reference another message board, but is so, www.justlinux.com has a thread on how to install like 147 distros, including DOS; Win 95; Win 98; XP; plus a hundred Linux distros, all on one HD. It is believed one cannot put more than one Win on a HD, but a hide command in grub fixes this very well.
 
Old 04-20-2008, 06:14 PM   #9
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
just.srad,

Actually the answer is dead simple.

When a Linux is installed and denied the access to the MBR that makes it unbootable. In order to survive the installer will put the boot loader inside the root partition of Freespire.

With the exception of a few odd partition types most partitions have set aside the first sector as the boot sector permanently reserved for the boot loader so every Linux can store its boot loader there or the space is simply empty.

Every Linux that has a boot loader inside its root partition is chainloadable and can be booted by the exactly the same method a MS Windows is booted.

As an example if Linspire is in (hd0,3), the 4th partition of the 1st disk, then these lines in Sabyon's menu.lst will fire it up

Code:
title My Linspire in (hd0,3)
root (hd0,3)
chainloader +1
Some more explanation if you want it. The bootloader can be either Lilo and it makes no difference to Grub.

Chainloading is the method one boot loader boots another boot loader. It is up to the second boot loader boots its master. It is used by every boot loader of substance, including every one from MS Windows. They just haven't got a name for it. That is all.
 
Old 04-21-2008, 12:01 PM   #10
irlandes
Member
 
Registered: Nov 2003
Posts: 117

Rep: Reputation: 16
?????

>>When a Linux is installed and denied the access to the MBR that makes it unbootable. In order to survive the installer will put the boot loader inside the root partition of Freespire.

I can't say if I agree or disagree with that statement, because I'm not sure exactly what you mean. I have no idea what it means "denied access to the MBR". I suspect I disagree with it, it's just that I am not sure.

In December, I installed gOS 1.x in hda11 of an eMachine W3115 I have here in Mexico. When I rebooted, it gave me an fsck error, which required me to use CTRL-D which put me into Ubuntu 6.10. I lived with it until I made a visit to the States. In Virginia, I installed Kubuntu in my old Inspiron 2650, and it gave me the same fsck error. I learned Ubuntu changes partition names, which messes up old /etc/fstab values.

So, when I came back, sure enough, that was the problem with the W3115. I ran command:

ls /dev/disk/by-uuid/ -alh

to obtain correct partition names, and fixed that.

Still no gOS. I looked at hda11 from Ubuntu 6.10 and found the names for kernel and intrd, and simply added them into the menu.lst on Mandriva 2007 which is what happened to be running Grub, though that is not what I was booting. If you run into permission problems when trying to edit menu.lst on another partition, either run sudo nano from a terminal, or run sudo kwrite in a terminal. Or, sudo su to get a root prompt, then run kwrite or konqueror in superuser mode. Whatever works on your distro.

I typed in that information into the hda7 /boot/grub/menu.lst actually used, like this:

title gOS hda11 (directly loaded)
root (hd0,10)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/hda11 ro
intrd /boot/initrd.img-2.6.22-14-generic
savedefault


By directly loaded, I mean there is no chainloader at all. Hda11 does not need access to the MBR. Hda7 handles this, even when you don't boot to hda7.

I am not saying there is anything wrong with chainloading, it's just another delay and is not needed at all. When I chainloaded in the past because I was told I had to, I got the grub window with its time-out and choices, then when it chainloaded the other partition, I got that grub window from the second partition, which gave me most of the same choices, with the accompanying delay.
 
Old 04-21-2008, 06:13 PM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
irlandes,

If you install a Linux and do not want its boot loader in the MBR it cannot boot itself.

The standard homes for a Linux boot loader, Grub or Lilo, are

(1) MBR
(2) Root partition
(3) floppy
(4) None at all

Most installer will go for (2) if (1) is not selected and (3) and (4) are not offered. You can install the boot loader simultaneously in all three (1), (2) and (3) and boot it by any of the three ways you fancy.

You don't have to like chainloading but it is one that allows you to forget altering fstab, the types of boot loader, the name of the kernel, the name of the module, the name of initrd ram disk file, by-uuid or by-label partition addressing etc etc. It is the single method you can boot every PC system that has even been invented, regardless it is a Dos, Windows, Linux, BSD or Solaris. More over you can use same instructions changing it only the partition reference for every operating system!

If you don't want delay in booting you control it with the "timeout" statement in Lilo or Grub.

Technically if you issue kernel and initrd statements in the booting process you boot the Linux directly.

To chainload it is to boot the system indirectly.

Grub can only directly boot a system if it can read that partition, get inside and load the kernel and initrd. This limits the choice to Linux and Unix-like systems.

By comparison Grub can boot any PC system indirectly including systems residing in partitions it cannot read, like NTFS filing system used by Win2k, XP and Vista.

In the Justlinux link you mentioned booting 147 systems. I booted every single one of the 147 systems by "chainloading".

The same technique can be used by Vista as I tried its BCDedit to boot 150 Linux too.

Last edited by saikee; 04-21-2008 at 06:22 PM.
 
Old 04-21-2008, 08:36 PM   #12
irlandes
Member
 
Registered: Nov 2003
Posts: 117

Rep: Reputation: 16
Quote:
Originally Posted by saikee View Post
irlandes,

If you install a Linux and do not want its boot loader in the MBR it cannot boot itself.

The standard homes for a Linux boot loader, Grub or Lilo, are

(1) MBR
(2) Root partition
(3) floppy
(4) None at all

Most installer will go for (2) if (1) is not selected and (3) and (4) are not offered. You can install the boot loader simultaneously in all three (1), (2) and (3) and boot it by any of the three ways you fancy.

You don't have to like chainloading but it is one that allows you to forget altering fstab, the types of boot loader, the name of the kernel, the name of the module, the name of initrd ram disk file, by-uuid or by-label partition addressing etc etc. It is the single method you can boot every PC system that has even been invented, regardless it is a Dos, Windows, Linux, BSD or Solaris. More over you can use same instructions changing it only the partition reference for every operating system!

If you don't want delay in booting you control it with the "timeout" statement in Lilo or Grub.

Technically if you issue kernel and initrd statements in the booting process you boot the Linux directly.

To chainload it is to boot the system indirectly.

Grub can only directly boot a system if it can read that partition, get inside and load the kernel and initrd. This limits the choice to Linux and Unix-like systems.

By comparison Grub can boot any PC system indirectly including systems residing in partitions it cannot read, like NTFS filing system used by Win2k, XP and Vista.

In the Justlinux link you mentioned booting 147 systems. I booted every single one of the 147 systems by "chainloading".

The same technique can be used by Vista as I tried its BCDedit to boot 150 Linux too.p
You did a fine job on that 147 OS thread, Saikee. If there were a Linux Hall of Fame, I would nominate you just for that thread. And I bet my last nickel you would be the Second inductee, right after Linus. It was a world class job and brought sanity to a confusing issue.

And, I am well aware you can chain load everything. I just prefer direct loading myself, (edit: except for OS which cannot be loaded directly) and so far it meets all my modest needs. I suppose if I had 147 working, it might change my mind. But, my main point is, we should never try to stop dissemination of all options, for several reasons. People are all different, and even on the simplest issues have personal preferences. Examples are KDE/Gnome/iceWM/Enlightenment. Not to even mention the common distro wars which drive moderators loony.

In this case, I think it makes sense to understand both ways of doing it, and then each person makes their own decision for their own needs, as you have done . It matters not if 99% prefer one way and only 1% the other way. The principle reason many come to Linux is because MS has traditionally made such decisions for everyone, with not a lot of choice in a lot of areas.

If Linus had held to conventional wisdom, where would Linux be today?

I am going to tell you one case where direct loading is helpful. People do somehow screw up the loader when installing multiple OS. People put them through all sorts of folderol, when all they have to do is modify the menu.lst in use, and they are up and running. After that, they can decide what to do.

Last edited by irlandes; 04-21-2008 at 08:42 PM.
 
Old 04-21-2008, 09:23 PM   #13
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Despite I gave the impression I sell "chainloading" hard to everybody in reality I do boot every system directly by its own boot loader.

My statement that I could use one Grub to chainload everyone of the 147 systems only serves to show the technique works as far as I could stretch.

In reality Grub chainloads the second boot loader which in turn boots up its own master "directly".

I really have no intention stopping others from booting a Linux directly. It does require a fair bit of understanding of the booting commands which can be daunting for the newbies.

With chainloading it is an easy way out. I use it a lot on my advice to others because it is easier for me to explain and the result is effective. Also I don't need to know what mistake the poster has committed resulting his/her system unbootable.

It is possible the resistance comes from others thinking I am substituting the very basic principle of booting a Linux directly with something too-simple to them.

Last edited by saikee; 04-21-2008 at 09:24 PM.
 
Old 04-23-2008, 01:15 PM   #14
irlandes
Member
 
Registered: Nov 2003
Posts: 117

Rep: Reputation: 16
This thread did help me understand something I have noted over the years. Mandrake/Mandriva has always placed links in /boot where the kernel and initrd.img are located.

They are called vmlinuz and initrd.img, with no version numbers, and booting is done to those abbreviated filenames which of course are links to the actual kernel and initrd.img to be used.

Until you explained this, I had no idea why they did this.

I suspect Mandriva does that so the OS can be booted either directly or indirectly. And, it also seems probable that installing an update package for the kernel will also plunk in new links automatically. Thus no matter where you boot from, grub need not be changed.

IF that is true, it would seem this should be standard practice for all distros.

I am certainly not criticizing anyone for chainloading. My whole point was personal preference, not superiority of either technique, and so it would be somewhat hypocritical to say anything at all negative about chainloading, just because I have chosen not to use it myself.
 
  


Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
grub failed to load linux (grub think ext3 partition as fat) khairilthegreat Linux - Newbie 7 08-09-2007 01:12 PM
grub help booting into another linux partition newusermike Linux - Newbie 3 08-04-2005 11:34 AM
grub can't mount linux partition bruno buys Linux - General 1 09-29-2003 02:10 PM
In desperate need... Grub wont detect my windows partition... psyklops Linux - General 4 08-20-2003 01:34 AM


All times are GMT -5. The time now is 12:44 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