bhobjj
11-30-2005, 02:42 PM
Using chainload with Grub to boot multiple systems
In an effort to stay organized, and have easy access to various operating systems and kernels on a testing system, I make use of Grub chainloader command.
Warning: if you don't understand what you are doing, you could make your system unbootable!
Each time I install an OS, I install Grub to it's root partition.
example
In my example, I have a different OS on hda5, hda9, hda11, hdc1, hdc3
If I install an OS in hda11, I run the command
# grub-install /dev/hda11
Then I edit the /boot/grub/menu.lst file
I replace the entries section below the "automagic kernels list" with my chainloading entries.
I repeat this with each OS.
Example section of my menu.lst for /dev/hda5:
note the chainloader section after the "AUTOMAGIC KERNELS LIST"
## ## End Default Options ##
title Libranet GNU/Linux, kernel 2.6.13.4-k7
root (hd0,4)
kernel /boot/vmlinuz-2.6.13.4-k7 root=/dev/hda5 ro
initrd /boot/initrd.img-2.6.13.4-k7
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.13.4-k7 (single user mode)
root (hd0,4)
kernel /boot/vmlinuz-2.6.13.4-k7 root=/dev/hda5 ro single
initrd /boot/initrd.img-2.6.13.4-k7
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.13.4-lnadminmenu.0.5
root (hd0,5)
kernel /boot/vmlinuz-2.6.13.4-lnadminmenu.0.5 root=/dev/hda5 ro
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.13.4-lnadminmenu.0.5 (single user mode)
root (hd0,4)
kernel /boot/vmlinuz-2.6.13.4-lnadminmenu.0.5 root=/dev/hda5 ro single
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.11-ln.std
root (hd0,4)
kernel /boot/vmlinuz-2.6.11-ln.std root=/dev/hda5 ro
initrd /boot/initrd.img-2.6.11-ln.std
savedefault
boot
### END DEBIAN AUTOMAGIC KERNELS LIST
# Chainloader List
title Libranet on hda5
rootnoverify (hd0,4)
chainloader +1
title Ututo on hda9
rootnoverify (hd0,8)
chainloader +1
title Debian Etch on hda11
rootnoverify (hd0,10)
chainloader +1
title Blag on hdc1
rootnoverify (hd2,0)
chainloader +1
title Debian Sarge on hdc3
rootnoverify (hd2,2)
chainloader +1
Make a Grub floppy
Note that the command
# grub-floppy /dev/fd0
Will install the Grub system on a floppy.
This is what you want if you want to just use the Grub prompt on a bootable floppy.
To create a Grub floppy that is specific for your system and has a boot menu:
# grub-install /dev/fd0
Then edit the menu.lst on the floppy. Remove any reference to splash screen (if your splash screen image is not found, it could make the boot floppy usless).
I use a simplified file with just my chainloading entries for each partition.
This is what mine looks like:
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
# Simplified menu.lst example
## default num
default 0
## timeout sec
timeout 10
## ## End Default Options ##
# Chainloader List
title Libranet on hda5
rootnoverify (hd0,4)
chainloader +1
title Ututo on hda9
rootnoverify (hd0,8)
chainloader +1
title Debian Etch on hda11
rootnoverify (hd0,10)
chainloader +1
title Blag on hdc1
rootnoverify (hd2,0)
chainloader +1
title Debian Sarge on hdc3
rootnoverify (hd2,2)
chainloader +1
Resources
Creating a bootable Grub CD (http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD_002dROM.html#Making-a-GRUB-bootable-CD_002dROM)
Grub Manual
http://www.gnu.org/software/grub/manual/html_node/
Thanks to Leon for the idea.
In an effort to stay organized, and have easy access to various operating systems and kernels on a testing system, I make use of Grub chainloader command.
Warning: if you don't understand what you are doing, you could make your system unbootable!
Each time I install an OS, I install Grub to it's root partition.
example
In my example, I have a different OS on hda5, hda9, hda11, hdc1, hdc3
If I install an OS in hda11, I run the command
# grub-install /dev/hda11
Then I edit the /boot/grub/menu.lst file
I replace the entries section below the "automagic kernels list" with my chainloading entries.
I repeat this with each OS.
Example section of my menu.lst for /dev/hda5:
note the chainloader section after the "AUTOMAGIC KERNELS LIST"
## ## End Default Options ##
title Libranet GNU/Linux, kernel 2.6.13.4-k7
root (hd0,4)
kernel /boot/vmlinuz-2.6.13.4-k7 root=/dev/hda5 ro
initrd /boot/initrd.img-2.6.13.4-k7
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.13.4-k7 (single user mode)
root (hd0,4)
kernel /boot/vmlinuz-2.6.13.4-k7 root=/dev/hda5 ro single
initrd /boot/initrd.img-2.6.13.4-k7
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.13.4-lnadminmenu.0.5
root (hd0,5)
kernel /boot/vmlinuz-2.6.13.4-lnadminmenu.0.5 root=/dev/hda5 ro
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.13.4-lnadminmenu.0.5 (single user mode)
root (hd0,4)
kernel /boot/vmlinuz-2.6.13.4-lnadminmenu.0.5 root=/dev/hda5 ro single
savedefault
boot
title Libranet GNU/Linux, kernel 2.6.11-ln.std
root (hd0,4)
kernel /boot/vmlinuz-2.6.11-ln.std root=/dev/hda5 ro
initrd /boot/initrd.img-2.6.11-ln.std
savedefault
boot
### END DEBIAN AUTOMAGIC KERNELS LIST
# Chainloader List
title Libranet on hda5
rootnoverify (hd0,4)
chainloader +1
title Ututo on hda9
rootnoverify (hd0,8)
chainloader +1
title Debian Etch on hda11
rootnoverify (hd0,10)
chainloader +1
title Blag on hdc1
rootnoverify (hd2,0)
chainloader +1
title Debian Sarge on hdc3
rootnoverify (hd2,2)
chainloader +1
Make a Grub floppy
Note that the command
# grub-floppy /dev/fd0
Will install the Grub system on a floppy.
This is what you want if you want to just use the Grub prompt on a bootable floppy.
To create a Grub floppy that is specific for your system and has a boot menu:
# grub-install /dev/fd0
Then edit the menu.lst on the floppy. Remove any reference to splash screen (if your splash screen image is not found, it could make the boot floppy usless).
I use a simplified file with just my chainloading entries for each partition.
This is what mine looks like:
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
# Simplified menu.lst example
## default num
default 0
## timeout sec
timeout 10
## ## End Default Options ##
# Chainloader List
title Libranet on hda5
rootnoverify (hd0,4)
chainloader +1
title Ututo on hda9
rootnoverify (hd0,8)
chainloader +1
title Debian Etch on hda11
rootnoverify (hd0,10)
chainloader +1
title Blag on hdc1
rootnoverify (hd2,0)
chainloader +1
title Debian Sarge on hdc3
rootnoverify (hd2,2)
chainloader +1
Resources
Creating a bootable Grub CD (http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD_002dROM.html#Making-a-GRUB-bootable-CD_002dROM)
Grub Manual
http://www.gnu.org/software/grub/manual/html_node/
Thanks to Leon for the idea.