10. Don't Let Linux Give You the Boot
In complex dual-boot environments, there are times when there's no option other than to reinstall Windows to solve a problem. When that happens, Windows overwrites the master boot record (MBR), so you need a boot disk to boot Linux and restore the Linux dual bootloader. Of course many new computers don't have floppy drives, so you'd really find yourself up the proverbial creek unless you had the foresight to make a boot CD. Luckily, version 2.3 of mkrescue (a utility included in Linux distros) has the option to make a bootable rescue.iso you can burn to CD and use instead of a boot floppy.

We tested this in a few distros and found that only Slackware 9.1 and Mandrake 9.2 have mkrescue with the --iso option. Mandrake 9.1, Red Hat 9, and SuSE 8.2 still have an older version of mkrescue without the --iso option. We expect that future versions of these distros will include the 2.3 (or even newer) version of mkrescue.

Because newer Linux kernels and initrd.img (initial ramdisk image) are getting larger, the chances are that you will need this technique in other distros soon. Mandrake 9.2, for example, requires 1722KB to make a boot floppy. You can format a floppy to accommodate this under Linux, but it is not always stable, and that's the last thing you want to have to worry about when you're having boot problems. CD drives are the default removable media these days, and besides, booting from a CD is just plain faster than from a floppy.

For more information about Linux ISOs, please read this earlier Linux Explorers tip.

IMPORTANT: The tips in this document require the use command-line commands. For more information about how to read and execute Linux command-line prompts and commands, please check the LinuxClues.com's Linux Cheat Sheet, especially Linux Prompt Basics and Linux Command-Line Nomenclature.

With that as an introduction, here's how to make boot CDs.

Mandrake 9.2
Use these steps under Mandrake 9.2 to make a boot CD:

$ su
Password: <type your root password here>
# mkrescue --iso --initrd /boot/initrd-2.4.22-10mdk.img --kernel /boot/vmlinuz-2.4.22-10mdk

If you use a kernel other than the default kernel, such as the 4GB RAM kernel, you will have to adapt the numbers for intrd and vmlinuz using these steps:

$ su
Password: <type your root password here>
# uname -r     (shows the Linux kernel version you should use below)
# mkrescue --iso --initrd /boot/initrd-2.4.22-21mdk-i686-up-4GB.img --kernel /boot/vmlinuz-2.4.22-21mdk-i686-up-4GB

After running the command you will find a rescue.iso file in your /home and can simply burn it:

$ cdrecord --scanbus     (checks number of burn device)
$ cdrecord dev=0,0,0 rescue.iso     (where dev=0,0,0 is number above; may be 0,0,1)

Slackware 9.1
Use these steps under Slackware 9.1 to make a boot CD:

$ su
Password: <type your root password here>
# mkrescue --iso     (Slackware automatically knows what kernel to put in the ISO)

Test Your Boot CD
After you burn the CD, be sure to test it as your last step. If you wind up having to reinstall Windows you'll be golden. If your system is messed up and you find out your boot CD is flawed, you'll be miserable.

Reinstating Your Linux Bootloader
If you are forced to reinstall Windows, boot back into Linux using the boot CD. Your next step is to restore the Linux bootloader -- which is either Lilo or Grub, depending on your Linux-installation configuration. If you're not sure which bootloader your Linux installation is using, run this command at the command line:

$ ls -l /etc/lilo.conf

If that returns "no such file or directory" it means you're using Grub.

Here are the steps to restore your Linux bootloader for both in Lilo and Grub:

For Lilo:
$ su
Password: <type your root password here>
# /sbin/lilo -v     (for restoring Lilo to the MBR)

For Grub:
$ su
Password: <type your root password here>
# grub-install /dev/hda     (for restoring Grub to the MBR)

Rescue Me
Of course, there are times when even a boot disk alone won't save you. (We hate it when that happens.) To protect yourself when that unwelcome event occurs, take some time now and create a Linux rescue disk.

We like the Ultimate Boot CD because it has a whole bundle of useful tools for hardware diagnosis, as well as fixing configuration files and partitions. Plus it's free (although you should make a donation if you like it even half as much as we do). This thing can really save your bacon.

You can download all 58 utilities in a single uncompressed 101MB ISO file. Just scroll down the page to where it says "Downloads." You can use BitTorrent or select one of the mirror sites listed below it. FileArena.net is a good one to try. Download it and burn it to a CD (a separate one from your regular boot CD) and you'll be ready for whatever comes your way.

Note: Scot's Newsletter made the Ultimate Boot CD the Link of the Week in the April 26, 2004 of the newsletter.