# Need Help With Chainloading



## tb75252 (May 24, 2006)

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):

```
menuentry "Slackware" {
  set root=(hd0,3)
  chainloader (hd0,3)+1
}
```
2) I ran the following command (as root):

```
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!


----------



## saikee (Jun 11, 2004)

In order to chainload an operating system you must install the boot loader of that system in its own partition. In your case it is sda3 for Slackware. This command in Slackware will put Lilo into sda3

```
lilo -b /dev/sda3
```
Now the trick is how to get into Slackware. How about booting up Slackware manually by Grub2?

Instead of choosing any system to boot in the Grub menu press the "c" key to get a Grub prompt. Slackware is the easiest distro to boot in the world and it should answer these Grub commands

```
root (hd0,3)
linux /boot/vmlinuz ro root=/dev/sda3
boot
```
Once inside Slackware put Lilo in sda3 and commands in Ubuntu's \boot\grub\grub.cfg should be 

```
menuentry "Slackware" {
  set root=(hd0,3)
  chainloader +1
}
```
Grub may work with "chainloader (hd0,3)+1" but it is unnecessary if you have already declare the partition with the "set root" command. You can use Grub1's "root" command like I did in Grub2.

*------------------------------extra fun section--------------------------------------------------------------*

*To get Ubuntu Grub2 to boot Slackware "directly" *(chainloading a system is to boot that system "indirectly")

add this in the Ubuntu's /bootgrub/grub.cfg

```
menuentry "Slackware is sda3 booted directly" {
  set root=(hd0,3)
  linux /boot/vmlinuz ro root=/dev/sda3
}
```
*To ask Slackware to chainload Ubuntu*

In Ubuntu issue this command at a terminial

```
sudo grub-install --force /dev/sda1
```
In Slackware add these lines to /etc/lilo.conf


```
other = /dev/sda1
label = Ubuntu
```


----------



## tb75252 (May 24, 2006)

saikee said:


> Now the trick is how to get into Slackware. How about booting up Slackware manually by Grub2?
> 
> Instead of choosing any system to boot in the Grub menu press the "c" key to get a Grub prompt. Slackware is the easiest distro to boot in the world and it should answer these Grub commands
> 
> ...


Bear with me since I am relatively new to linux...
Unfortunately

```
root (hd0,3)
```
 is not recognized by GRUB 2. I get


> grub> unknown command "root".


 When I installed Slackware 13.37, the installer put LILO in the partition where Slackware's root resides, i.e. sda3. (Slackware calls it the "Superblock" of Root.) I can see LILO files in /sbin/sda3. Given this fact, do I really have to install LILO in /dev/sda3? How?


----------



## saikee (Jun 11, 2004)

But you say you are chainloading Slackware from Ubuntu's Grub. Grub counts disk number and partition number exactly like a MS Windows by from zero and one respectively. Thus (hd0,3) is the 3rd partition of the first disk. In LInux convention this is sda3.

Different versions of Grub2 may have different stage of implementation of the Grub1 commands. If your Grub2 dislikes 

```
root (hd0,3)
```
try

```
set root='(hd0,3)'
```
All the recent Grub2 I tried accept the Grub1 command "root" thus my suggestion.

To install Lilo inside Slackware in sda3 you do it in the terminal by command

```
su
lilo -b /dev/sda3
```
You did state in your thread title that you "Need Help With Chainloading", right?

In chainloading you use one boot loader (Grub2) to boot another boot loader (Lilo). This is to tell Grub to hand over the control to Lilo and then bugger off. It is Lilo that fires up Slackware. If you do not install Lilo then there is no chainloading possible. Got it?

Lilo is already inside Slackware and you should find its configuration file in /etc/lilo.conf unless during installation you explicitly tell Slackware not to install Lilo.


----------

