LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to use GRUB to detect the other linux partition (https://www.linuxquestions.org/questions/linux-general-1/how-to-use-grub-to-detect-the-other-linux-partition-633958/)

just.srad 04-08-2008 11:47 AM

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

johnsfine 04-08-2008 12:08 PM

Quote:

Originally Posted by just.srad (Post 3114776)
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).

just.srad 04-08-2008 07:18 PM

Thanks Johnsfine.

I did the manual editing of the Sabayon grub's file just to make it work.

just.srad 04-08-2008 07:19 PM

Hmm... here's one link which give an explanation on grub

GRUB Illustration

just.srad 04-08-2008 07:21 PM

Anyone here can provide more information on the GRUB ...

Thanks a million... :)

syg00 04-08-2008 08:05 PM

Try here - you're probably interested in grub legacy.

just.srad 04-17-2008 06:48 PM

Quote:

Originally Posted by syg00 (Post 3115217)
Try here - you're probably interested in grub legacy.

Thanks for the link.. will go thru it later.

irlandes 04-20-2008 10:30 AM

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.

saikee 04-20-2008 05:14 PM

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.

irlandes 04-21-2008 11:01 AM

?????
 
>>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.

saikee 04-21-2008 05:13 PM

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.

irlandes 04-21-2008 07:36 PM

Quote:

Originally Posted by saikee (Post 3128357)
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.

saikee 04-21-2008 08:23 PM

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.

irlandes 04-23-2008 12:15 PM

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.


All times are GMT -5. The time now is 04:27 PM.