Red Hat Docs  >  Red Hat Manuals  >  Archived Red Hat Linux Manuals  > 


What is Rescue Mode?

Rescue mode is a term used to describe a method of booting a small Linux environment to make necessary repairs to your system.

What follows in this section may help you recover from a problem at some point.

As the name implies, rescue mode is there to rescue you from something. In normal operation, your Red Hat Linux system uses files located on your system's hard drive to do everything -- run programs, store your files, and more.

However, there may be times when you are unable to get Linux running completely enough to access its files on your system's hard drive. By using rescue mode, it's possible to access the files stored on your system's hard drive, even if you can't actually run Linux from that hard drive.

Normally, you'll need to get into rescue mode for one of two reasons:

  • You are unable to boot Linux, and you'd like to fix it.

  • You are having hardware or software problems, and you want to get a few important files off your system's hard drive.

Let's take a closer look at each of these scenarios.

Unable to boot Linux

Many times this is caused by the installation of another operating system after you've installed Red Hat Linux. Some other operating systems assume that you have no other operating systems on your computer, and overwrite the Master Boot Record (or MBR) that originally contained the LILO bootloader. If LILO is overwritten in this manner, you're out of luck -- unless you can get into rescue mode.

Hardware/software problems

There can be as many different situations under this category as there are systems running Linux. Things like failing hard drives and forgetting to run LILO after building a new kernel are just two instances that can keep you from booting Red Hat Linux. If you can get into rescue mode, you might be able to resolve the problem -- or at least get copies of your most important files.

To boot your system in rescue mode, enter the following parameter at the installation boot prompt:


boot:
 

linux rescue


        

You can get to the installation boot prompt in one of these ways:

  • By booting your system from the diskette or CD-ROM that came with your Red Hat Linux boxed set.

  • By booting from a network or PCMCIA boot diskette. These methods assume your network connection is working and require you to identify the network host and transfer type. For an explanation of how to specify this information, see "Installing over the Network" in Chapter 9 .

Once you have your system in rescue mode, a prompt appears:


bash#

        

From this prompt, you can run the commands listed below:


badblocks  bash     cat
chattr     chmod    df        
fdisk    gunzip     ln
ls       lsattr     lsmod
mkdir    mke2fs     mknod
mkraid   mkswap     mount
ps       python     raidstart
rm       rpm        sh
umount   uncpio
	  

	

However, if your root filesystem is undamaged, you can mount it and then run any standard Linux utility. For example, suppose your root filesystem is in /dev/hda5 . Here's how to mount this partition:


mount -t ext2 /dev/hda5 /mnt

	

Now you can run chroot , fsck , man , and other utilities. At this point, you are running Linux in single-user mode.

If you don't know the names of your Linux partitions, you can guess: mounting non-existant partitions will do no harm.

Booting Single-User Mode Directly

You may be able to boot single-user mode directly. If your system boots, but does not allow you to log in when it has completed booting, try rebooting and specifying one of these options at the LILO boot prompt:


LILO boot:
 

linux single



LILO boot:
 

linux emergency


	

In single-user mode, your local filesystems will be mounted but your network will not be activated. In emergency mode, the root filesystem will be mounted read-only and almost nothing will be set up.

A Handy Trick

Have you ever rebuilt a kernel and, eager to try out your new handiwork, rebooted before running LILO? And you didn't have an entry for an older kernel in lilo.conf ? Read on…

Here's a handy trick. In many cases, it's possible to boot your Red Hat Linux/Intel system from the Red Hat Linux boot disk with your root filesystem mounted and ready to go. Here's how:

Enter the following command at the boot disk's boot: prompt:


linux single root=
/dev/hd

XX


 initrd=

        

(Replace the XX in /dev/hd XX with the appropriate letter and number for your root partition.)

What does this do? First, it starts the boot in single-user mode, with the root partition set to your root partition. The empty initrd specification bypasses the installation-related image on the boot disk, which will cause you to enter single-user mode immediately.

Is there a downside to this trick? Unfortunately, yes. Because the kernel on the Red Hat Linux boot disk only has support for IDE built-in, those of you with SCSI-based systems won't be able to use this trick. In that case, you'll have to use the boot/rescue disk combination mentioned above.