Grub is a popular Linux boot loader. Actually easily the most popular. It supersedes lilo.
Booting grub from the command line just means typing in the commands normally found in the grub.conf (or menu.lst).
For example if you were booting a Xen kernel, with a /boot/grub/grub.conf that should look like this:
title Xen
root (hd0,0)
kernel /xen.gz dom0_mem=196608
module /vmlinuz-2.6.11.12-xen0 root=/dev/md1 ro console=tty0 panic=30 max_loop=96
module /initrd-2.6.11.12-xen0.img
You would type the following to boot the system from the grub prompt:
grub> root (hd0,0)
grub> kernel /xen.gz dom0_mem=196608
grub> module /vmlinuz-2.6.11.12-xen0 root=/dev/md1 ro console=tty0 panic=30 max_loop=96
grub> module /initrd-2.6.11.12-xen0.img
Finally you issue the 'boot' command and it'll start the boot procedure with the kernel etc you specified.
grub> boot
Note: the above notes are based on having a seperate /boot partition. If you __do not__ have a seperate /boot partition, use /boot instead of / before the filenames, e.g. /boot/xen.gz. These notes work fine on a RAID 1 setup as well.
This will install grub onto two RAID 1 disks. In this example they would be the first and second disks.
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
In RedHat, they're stored in /usr/share/grub/i386-redhat. All you need to do is copy them into place:
cp /usr/share/grub/i386-redhat/stage1 /boot/grub/
cp /usr/share/grub/i386-redhat/stage2 /boot/grub/
cp /usr/share/grub/i386-redhat/*stage1_5 /boot/grub/
They may also live in /usr/share/grub/i386-pc.
Sometimes we have found when installing a distro (e.g. Centos4) then re-installing the distro that the boot loader is not installed, or the 'old' one is not overwritten. It appears some distros check for an existing boot loader and don't try to overwrite in.
When this is the case you will just get a grub prompt and no boot options. Further re-installs don't change this.
What you need to do is uninstall the boot loader. You can boot into knoppix and run lilo -U /dev/sda (or hda or whatever). Or if lilo is not readily available then use dd from knoppix: dd if=/dev/zero count=1000 of=/dev/sda (or hda or whatever). This will zero out the first 1000 bytes on the disk removing the partition tables and any boot loader. Do not run this on a disk when you need data from that disk.
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:
mkdir -p iso/boot/grub
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=10
title 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.img
Or for a UML kernel (which uses a regular kernel and initrd):
timeout=10
title 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