Installing grub from a Knoppix Live CD

 

Some notes on installing grub.  This is a somewhat contrived example that installs grub to a FAT32 partition on the primary hard drive and places the grub 1st stage in the MBR.  Installing from a running Linux installation (booted my some kind of magic) is similar, but the  /boot/grub files should already be in place.

This example uses Linux /dev/sda2 as the target partition.  In Linux land, this indicates a scsi or usb or maybe sata drive.  It is the first such drive and we will install the grub files in the 2nd partition.  For some historical (hysterical) reason, Linux calls the 1st drive "a" and the first partition "1".  In grub notation that is drive 0, partition 1.  In this example we assume that something (like an NTFS Windows installation) is in the 1st partition, and we can't install there, so we install to the "service partition" which may or may not be a good idea.  This is just an example!

NOTE:  sda doesn't always correspond to grub drive 0.  It is the 1st scsi/usb/sata drive.  If there is a mix of IDE and scsi/usb/sata drives in the machine, grub drive 0 may not be the 1st scsi/usb/sata drive.  It is the 1st drive in whatever order BIOS uses to enumerate drives.  Check and double check before stepping on a drive.

With the Knoppix Live CD up and running, make sure the target partition is mounted, and is writable.  From the Knoppix desktop, left click the partition's icon to mount it, then right click and select change read/write mode to writable.  Alternatively create a mount point and mount it (or remount it) manually.  It shows up as sda2 in my example.

Create the install directory:

Copy the grub files:

Create /mnt/sda2//boot/grub/menu.lst using your favorite editor.  If installing grub from an already-installed Linux, it should already exist.  It may be necessary to add entries to it for booting other OSs.  Here's a made-up example that has XP in the first primary partition, a FAT32 service partition in the 2nd where we have put the grub files, Solaris in the 3rd, and Linux installations in logical partitions in an extended partition.  A menu.lst from an existing Linux installation would probably also have an entry to boot a kernel directly.  This example does only chainloading since the grub files are installed to a partition that doesn't have a running OS in it.  Like I said, it's a contrived example...

Install grub to the drive's MBR.  The setup command uses "(hdX)" to put the 1st stage in the MBR.  "(hdX,Y)" would put it in the boot sector of partition "Y":

That should do it.  Check my drive numbering/lettering before trying this at home!