Debian/Ubuntu Tips and Tricks

Debuntu

Debian/Ubuntu Tips and Tricks

How To: booting another Grub from Grub

Posted by chantra on March 15th, 2008

Chainloading an operating system allows grub to boot an opearating system's boot loader. This is commonly used to boot Windows for instance.

I personnaly use it to be able to have my "production" system's grub on the MBR, and address other distros'grub install on their root partition. The advantage is that kernel updates are real easy to handle. Each testing distro modifying their own grub won't interfere with my main OS bootloader.

This tutorial will explain how to configure grub's menu.lst from the main OS to boot other OSes bootloader through an example.

By being able to boot another grub from a primary grub, it make it easier to keep every OS kernel updated, as anytime a distro is updating its kernel, its own grub menu will be modified to represent the changes.

1. Example Settings

In this example, our main operating system (Linux 1) has its grub on /dev/sda MBR, it has 3 partition:

  1. /dev/sda1 : the root partition /
  2. /dev/sda2 : the swap partition
  3. /dev/sda3 : the home partition /home

Our testing distro (Linux 2) is installed on /dev/sda4 and its bootloader is installed on the root partition, namely /dev/sda4.

Please mind that you must have installed the secondary operating system on its root partition.

2. Setting up the main GRUB

As Linux 1 has its bootloader on the MBR, we will need to modify Linux 1's /boot/grub/menu.lst to inform grub that there is another operating system on /dev/sda4 which has its on boot loader.
This is done by adding:

#Entry for Linux 2 bootloader
title		Linux 2 on /dev/sda4
root		(hd0,3)
chainloader	+1

On Debian based distros such as Ubuntu, you should add your entry after:

### END DEBIAN AUTOMAGIC KERNELS LIST

This way, update-grub will not remove your settings.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>