HOWTO: Create a bootable GRUB CD
This HOWTO will create a bootable GRUB CD using the working kernels from your system. It's useful if your bootloader no longer works and/or you want a CD that boots up to the GRUB command line.
You will need GRUB and mkisofs. On Debian you can install these with:
apt-get install grub mkisofs
Next create the directory structure:
You will need the stage2_eltorito file. On Debian this is stored in /lib/grub/i386-pc/. On other systems it may be in /usr/lib/grub/i386-pc.
cp /lib/grub/i386-pc/stage2_eltorito iso/boot/grub
Next you will want your kernel(s). Copy them from your regular boot directory (e.g. /boot/) to iso/boot.
Now setup a menu.lst for GRUB to read upon booting. It should point to the kernels you want to select from the menu.
This is an example for a Xen kernel, and would live at iso/boot/grub/menu.lst.
timeout=10title Xen
kernel /boot/xen.gz dom0_mem=196608
module /boot/vmlinuz-2.6.11.12-xen0 root=/dev/md1 ro console=tty0 panic=30 max_loop=96
module /boot/initrd-2.6.11.12-xen0.imgOr for a UML kernel (which uses a regular kernel and initrd):
timeout=10title UML
kernel /boot/vmlinuz-2.6.11.10-skas3-v8 ro root=/dev/md1
initrd /boot/initrd-2.6.11.10-skas3-v8.img(Aside: Why do you sometimes see "kernel /boot/blah" and sometimes just "kernel /blah"? Answer: Grub file names are relative to where grub is booting from (typically a CD or a hard drive partition). In this case we are burning a CD ISO with a /boot directory in it so we use a /boot prefix. If you had a /boot _partition_ then we would use /blah without the /boot prefix since the file would be in the topmost directory of the boot partition).
Once you're happy with your menu.lst, and your kernels are in place in iso/boot, you need to create the actual CD. This command will create a 'grub.iso'. Run it in the parent directory of the 'iso' directory.
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso/
Burn the resulting ISO, and boot.
Also see the GRUB documentation on making a CD:
http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD-ROM.html