[2002-11-14]

Emergency Booting

 

Introduction

A much greater problem than not knowing how to boot linux from the NT boot-menu, which I described in my earlier, somewhat redundant article "NT Bootloader", is what to do when things go wrong and you lose the ability to boot your computer at all.

This might happen when you (re)move disks around or when you fail to install a boot loader the proper way, or after making partitioning changes. Maybe you're staring at a mysterious "missing system disk", LILO or GRUB error message and know not what to do?

What you need then is some alternative way of booting, and the most popular way is to use a boot floppy.

Of course, if you'd thought about that before playing around with the system, you wouldn't be here reading this, now would you?

For my own convenience (offsite backup) and because I believe it might be useful for the internet population at large (remember, redundancy is a good thing in this context) I will here provide the tools and instructions you need to create a floppy from which to boot a computer.

Please understand that the following is only of use if the breakage is between the POST (power on self-test) and the next stage of booting. It won't do you any good if the disk or filesystem has crashed!

Tools

First you'll have to download the GRUB boot floppy image (55Kb). GRUB is a boot loader, of which you need not know a thing unless you want to make advanced use of it, beyond what I describe here.

For maximum compatibility the image is a full 1.44MByte and is compressed using the ubiquitous "pkzip" (inflate) compression to save space and time. If you have a modern archiver installed, such as WinRAR, then you can almost certainly decompress the image through that.

You should now have a decompressed image with the filename grubbootimage.img. The next step is to write this image to a floppy or burn it unto a CDR(W).

Aside; Booting a CD-ROM is very similar to booting a floppy, as far as the computer is concerned, only you'll have to burn the floppy image to a CDR(W) instead of writing it to a floppy. Duh. I won't get in to that, but if you have a program such as Nero it shouldn't be hard to figure out (new "CD-ROM (boot)", select the image (see below), burn). Please note that you cannot just burn the image as a file as you'd normally do, you'll have to use a special "Bootable CD-ROM Wizard" or similar to do it. Read the documentation if you're unsure how it's done with your particular brand of CD-writing software.

That about booting off a CD-ROM. Let's concentrate on booting off a floppy instead. Now that you have the image decompressed there's a multitude of ways in which to write it onto a floppy. You can use software such as WinImage, or rawrite or dd. Personally I'd use rawrite if I was using a Microsoft Windows based OS. If you locate rawrite2.exe somewhere you can write the image using the command line "rawrite2 -f grubbootimage.img -d A" to write to A:

Booting

When you have successfully booted the floppy or CDROM you'll find yourself in a command line interface to GRUB. If you can't boot from here, it's not very likely you can boot at all. Let's look at how you'd go about booting the different operating systems.

Windows

All windows versions are somewhat inflexible in how they boot, a deficiency with the positive side effect that doing a rescue boot is simple. Issue the commands:

chainloader +1
boot

.. and the boot process should continue, either directly into one operating system, or through the Microsoft boot menu of your OS. When this works you will probably want to fix the original loader on the harddisk so that you won't have to go through the floppy. The first thing to try is to run the OS command "fdisk /MBR". If that doesn't work you might have to investigate the administrative tools further, or go as far as installting GRUB as your permanent loader.

Linux

To boot linux you must tell the loader the location of your root partition and the kernel to load. For example:

root (hd0,6)
kernel /boot/bzImage root=/dev/hda8
boot

Remember that GRUB counts disks and partitions starting from zero. The part after the kernel filename is sent verbatim to the kernel. In this case we'll simply pass the root-parameter, but you might need to add more paramaters to boot, especially if you have nonstandard hardware.

If you're trying to reinstall GRUB after changing the configuration (for instance, if you've deleted a partition prior to your boot or root partition which causes all the partition numbers to go invalid, or if you've installed an OS from a manufacturer who doesn't play nice and try to monopolise the boot loader, such as would happen if you reinstall Microsoft Windows), then you can issue:

root (hd0,6)
setup (hd0)

To reinstall GRUB in the MBR of the first harddisk. Note that this assumes that you have all the files in place already, so this if for reactivation, not for a first install.

Note that the boot image above does NOT include a linux kernel. If you're in dire need of a linux boot floppy, download this alternative image (967Kb) which includes a linux 2.4.18 kernel and a sample menu for booting from it. Note that this is not a real rescue disc as it does not contain any specific tools. There's no shortage of rescue-disks on the internet, use the power of google.

Happy booting!

Do not email me. I mean it.

©2002 Eddy L O Jansson. All rights reserved. All trademarks acknowledged.