LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need Help With Chainloading (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-with-chainloading-900969/)

tb75252 09-03-2011 08:53 PM

Need Help With Chainloading
 
I have a desktop with Ubuntu 11.04 (32-bit) installed.
When I installed Ubuntu, I put its boot loader (GRUB 2) in the MBR. Ubuntu itself is installed in /dev/sda1 (root) and /dev/sda/5.

I have recently also installed Slackware 13.37. I put its boot loader (LILO) in the same partition where Slackware's root resides, i.e. /dev/sda3. The other partition used by Slackware is /dev/sda7 (/home).

Now I would like to insert a chainloader command in GRUB 2 so that I can start Slackware from its menu.

Here's what I've done (which obviously does not work!):

1) I inserted the following entries in file /etc/grub.d/40_custom (as root):
Code:

menuentry "Slackware" {
  set root=(hd0,3)
  chainloader (hd0,3)+1
}

2) I ran the following command (as root):
Code:

grub-mkconfig -o /boot/grub/grub.cfg
The error that I get when I select "Slackware" from the GRUB 2 menu is "No such partition". Of course, I am 100% sure that Slackware's root (and LILO) reside on /dev/sda3!

So, how do I chainload this correctly? Please note that Ubuntu 11.04 uses GRUB 2, not GRUB legay!

andrewthomas 09-03-2011 09:43 PM

You really don't need to deal with chainloading LILO from GRUB2.

The simplest solution is mount your slackware partition and :

Create a /boot/grub directory.

Create a /boot/grub/menu.lst file containing

Code:

title Slackware Latest
root (hd0,2)
kernel /boot/vmlinuz root=/dev/sda3 ro

If you have a custom kernel or use the huge kernel.

or

Code:

title Slackware Latest
root (hd0,2)
kernel /boot/vmlinuz root=/dev/sda3 ro
initrd /boot/initrd.gz

If you use an initrd.

You just have to make sure that the symbolic link /boot/vmlinuz points to the kernel of your choice.

Then boot your Ubuntu install and

Code:

sudo update-grub
and you will be able to boot into your latest slackware kernel.

You can add other entries to your menu.lst file if you choose.

Grub does not even have to be installed for this to work (although I believe that it is installed in a normal "full" slackware installation.)

tb75252 09-03-2011 09:56 PM

Quote:

Originally Posted by andrewthomas (Post 4460797)
You really don't need to deal with chainloading LILO from GRUB2.

The simplest solution is mount your slackware partition and :

Create a /boot/grub directory.

Create a /boot/grub/menu.lst file containing

Code:

title Slackware Latest
root (hd0,2)
kernel /boot/vmlinuz root=/dev/sda3 ro

If you have a custom kernel or use the huge kernel.

Thanks, Andrew.
It is my understanding that GRUB 2 no longer uses menu.lst. I found this information at https://help.ubuntu.com/community/Grub2 (in the File Structure section).
Do you think that I need to use some other file with GRUB 2?

andrewthomas 09-03-2011 10:26 PM

Put the menu.lst file in the slackware partition.

Grub2 will recognize the file and add the entries to Ubuntu's grub.cfg.

Larry Webb 09-04-2011 06:21 AM

I understand you wanting to chainload, if using multiple distros and changing to new releases and updates it is a lot easier to chainload the partition. Remove Lilo and install grub2 to root of slackware then try your chainloading.

colorpurple21859 09-04-2011 07:23 AM

Try this to chainload

menuentry "Slackware" {
insmod ext2
set root=(hd0,3)
chainloader +1
}

or

menuentry "Slackware" {
insmod part_msdos
insmod ext2
set root=(hd0,3)
chainloader +1
}

edit: change ext2 to the correct mod if your slack partition is not formated with ext4 or similar.

andrewthomas 09-04-2011 09:17 AM

Quote:

Originally Posted by Larry Webb (Post 4461020)
I understand you wanting to chainload, if using multiple distros and changing to new releases and updates it is a lot easier to chainload the partition. Remove Lilo and install grub2 to root of slackware then try your chainloading.

It is pretty easy to maintain one or two symlinks, especially at the rate that kernels are updated in Slackware.

Since I have never installed lilo, I am not sure if its installation to the partition boot record will interfere with grub2 picking up a /boot/grub/menu.lst file from that same partition.

EDIT: I will concede that the OP did ask for a chainloading solution and I did not provide one. I just believe that my proposed solution is a simple one.

Larry Webb 09-04-2011 04:16 PM

Try this on your lilo and if it does not work then you will have to boot direct or change to grub2 if you want to chainload. From terminal using ubuntu live cd. Substitute your lilo partition for the hdxx.

sudo mkdir /mnt/temp
sudo mount /dev/hdxx /mnt/temp
sudo chroot /mnt/temp
sudo lilo –b /dev/hdxx


All times are GMT -5. The time now is 08:30 AM.