LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-06-2011, 09:17 PM   #1
rusty2
Member
 
Registered: Aug 2005
Posts: 65

Rep: Reputation: 15
How do you incorporate a Grub2 OS into a menu.lst file in Grub Legacy


Background:

I have a "master" IDE HD upon which reside several Linux OSs and a couple of Windoze OSs. The boot system is Mandriva using Grub Legacy and the latter's menu.lst file is where I select which OS I wish to use. I use HD physical carriers for my HDs. I used GPartEd to copy over newly installed OSs on another drive to the "master" HD.

The commands in the menu.lst file for Linux OSs are representative as follows:

Name of OS
root (hdx,x)
configfile /boot/grub/menu.lst

Task:

Enter Grub2 which, I seem to understand, is a work in progress. I presume that some commands in Grub2 are not recognizable by Grub Legacy.

I installed Debian 6 on another drive and I wish to incorporate an entry in the menu.lst file described above using the technique described above.

Is it possible to use the menu.lst file in Grub Legacy (0.97) in order to boot the Grub2 Debian OS ? Or am I chasing windmills?
 
Old 03-06-2011, 09:56 PM   #2
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,084

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Is Debian bootable?
I can't tell you how to deal with grub legacy, but if you have grub2 booting, you can just do
"os-prober"
"update-grub"
 
Old 03-06-2011, 11:12 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,096

Rep: Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979
You can't use configfile, but you can chainload to it.
Install grub2 to the partition boot record (it'll complain, but work), then simply chainload it like you do your Windoze.
 
Old 03-07-2011, 01:41 PM   #4
rusty2
Member
 
Registered: Aug 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Hi;

I assume that you mean install Grub2 to the partition boot record of the Debian 6 installation. Is that correct? If so, should it not be there automatically? Debian 6 uses Grub2.

Or am I misunderstanding something?
 
Old 03-07-2011, 02:03 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,096

Rep: Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979
On your Debian drive, grub2 will be in the MBR of the drive, not the partition boot sector record (unless you already put it there).
You will need to run grub-install directing it to use the partition as a target.
 
Old 03-07-2011, 02:11 PM   #6
prushik
Member
 
Registered: Mar 2009
Location: South Korea
Distribution: Lubuntu, BetterLinux
Posts: 364

Rep: Reputation: 28
Debian is not a "GRUB2 OS", its linux, just like any other distribution. I see what you are trying to do, and no, you can not do that with grub 2. Grub 2 changed the syntax of the config files significantly, its totally different, almost all grub2 commands will not work in grub legacy and visa-versa. However, since linux is linux, you can still boot your debian through grub legacy, either directly by loading debian's kernel and initramfs files by grub legacy, or by chainloading grub 2 by grub legacy. I recommend loading the kernel directly, its a much cleaner way to do it.
Your menu.lst should look something like this:

Name of OS (debian)
root (hdx,x)
linux /boot/vmlinuz-2.6.37
initrd /boot/initrd.img-2.6.37
boot

(make sure you use the correct file names and hdd numbers)

alternatively, you can chainload, which is easier, but sloppy and irresponsible and harder to maintain when there are problems
in that case, your menu.lst will look something like this:

Name of OS (debian)
rootnoverify (hdx,x)
chainloader +1
boot
 
Old 03-07-2011, 03:20 PM   #7
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
Quote:
Originally Posted by prushik View Post
alternatively, you can chainload, which is easier, but sloppy and irresponsible and harder to maintain when there are problems
You should also add this is your view on chainloading. I personally chainload 10 partitions on one hd and four on another. I try to keep the distros up to date and I find it easier to only have to worry about changing the distro inside the partition and not worrying about changing the grub.cfg. Like Syg00 says grub2 will complain but I have never had any problems except with puppy. But sloppy, I think it is cleaner and easier once the partitions are setup.

Last edited by Larry Webb; 03-07-2011 at 03:22 PM.
 
Old 03-07-2011, 06:57 PM   #8
prushik
Member
 
Registered: Mar 2009
Location: South Korea
Distribution: Lubuntu, BetterLinux
Posts: 364

Rep: Reputation: 28
Quote:
Originally Posted by Larry Webb View Post
You should also add this is your view on chainloading. I personally chainload 10 partitions on one hd and four on another. I try to keep the distros up to date and I find it easier to only have to worry about changing the distro inside the partition and not worrying about changing the grub.cfg. Like Syg00 says grub2 will complain but I have never had any problems except with puppy. But sloppy, I think it is cleaner and easier once the partitions are setup.
Some of it is opinion, yes, but the fact is that it is more complicated for the computer to perform a chainload than to just boot directly, your machine will have to load grub twice instead of just once, which seems pretty sloppy to me. I avoid chainloading because I like to be able to update everything in one place, plus it cuts a couple seconds off your boot time. Obviously sometimes its nearly unavoidable (Darwin, Haiku, Windows).
What does grub2 complain about? I don't have experience with this exact scenario, I chainload other bootloaders all the time, but rarely (or never) do I chainload grub from grub. Without thinking too much I changed my "root" to a "rootnoverify" thinking that would suppress grub's complaints, but now I am second guessing myself.
 
Old 03-07-2011, 07:10 PM   #9
yancek
Senior Member
 
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Slackware
Posts: 4,523

Rep: Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702
I use PCLinuxOS-2010 (Mandriva based system) using Grub Legacy to boot Ubuntu with Grub2. The entry I use to boot Ubuntu from PCLinux is:

title Ubuntu
root (hd0,4)
kernel /boot/grub/core.img
savedefault
boot

Ubuntu is on partition sda5 so you will need to change your entry to fit. You also need to make sure you actually have the core.img file in the /boot/grub directory of Debian if it is using Grub2.

Last edited by yancek; 03-07-2011 at 07:11 PM.
 
Old 03-07-2011, 08:33 PM   #10
rusty2
Member
 
Registered: Aug 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Thanks for all your individual help. I shall now task myself to experiment with this. As an afterthought I was able to revert to Grub legacy on another drive which has the same Debian 6 Squeeze. But that is just what I do not want for this setup. Sooner or later all distros will use Grub2. I think that it is inevitable so, inevitably, I will have to use Grub2 with everything.
 
Old 03-07-2011, 10:52 PM   #11
rusty2
Member
 
Registered: Aug 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Hi again and thanks to all for your input.

I've experimented with your suggestions and the one which worked like gang busters the first time was from Yancek above:

title Debian 6 Squeeze Grub2
root (hd0,13)
kernel /boot/grub/core.img
savedefault
boot

I looked in /boot/grub and the core.img file was indeed there so that was the first way I processed it.

Thanks again
 
Old 03-08-2011, 02:32 AM   #12
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
Quote:
Originally Posted by prushik View Post
Some of it is opinion, yes, but the fact is that it is more complicated for the computer to perform a chainload than to just boot directly, your machine will have to load grub twice instead of just once, which seems pretty sloppy to me.

What does grub2 complain about?
To cut down on complication I make a simple menu, all it will list is the os that I have dedicated to that partition so that the original list does not need to change when I upgrade the os. I also change the timeout on the distro bootloader to '0'. I kill the os-prober and grub-update on both bootloaders which seems to cut down on load time.

When you install grub2 in the root partition it complains about 'blocklists being unreliable' and a couple of other items. The only time I have run into this problem is if I changed partition numbers or hd layout. The way to avoid this is plan your hd layout ahead.
 
Old 03-08-2011, 08:52 AM   #13
prushik
Member
 
Registered: Mar 2009
Location: South Korea
Distribution: Lubuntu, BetterLinux
Posts: 364

Rep: Reputation: 28
Quote:
Originally Posted by Larry Webb View Post
To cut down on complication I make a simple menu, all it will list is the os that I have dedicated to that partition so that the original list does not need to change when I upgrade the os. I also change the timeout on the distro bootloader to '0'. I kill the os-prober and grub-update on both bootloaders which seems to cut down on load time.
os-prober and grub-update do not run at boot time. The only way that they affect boot time is by the menu.lst/grub.cfg that they jointly create. I think in Ubuntu the grub.cfg that they create has a hidden timeout of like 10 seconds, so changing that will increase your boot time by 10 seconds, but that still leaves the couple of seconds it takes grub2 to load, you can cut down on that by making sure grub2 doesn't load any unnecessary modules, but its still going to be there. Also, 3 file systems have to be mounted instead of just 2. grub legacy mounts the file system it needs to read the menu.lst file, chainloads grub2 which mounts the filesystem it needs to read its grub.cfg file (which could be your root filesystem) and then finally your root filesystem to load your kernel and initramfs (which is another file system actually).

Quote:
Originally Posted by Larry Webb View Post
When you install grub2 in the root partition it complains about 'blocklists being unreliable' and a couple of other items. The only time I have run into this problem is if I changed partition numbers or hd layout. The way to avoid this is plan your hd layout ahead.
Huh... Never seen that before.

@rusty2
Just so you know, that is still chainloading, even though it doesn't use the chainloader command.
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grub menu.lst file help needed unix1adm Linux - General 32 12-08-2009 06:10 AM
Configuration of the file 'menu.lst' in GRUB Gins Linux - General 7 08-27-2007 11:23 PM
Grub Menu doesn't reflect menu.lst file fatsheep Linux - Software 4 06-11-2007 01:29 PM
GRUB menu.lst/grub.conf file with multiple partitions dasy2k1 Linux - General 1 04-19-2007 08:42 AM
/grub/menu.lst file disappeared but computer still boots (grub) rrrssssss Linux - General 5 04-08-2007 09:02 AM


All times are GMT -5. The time now is 03:38 PM.

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