Chapter 42. System Rescue

Objectives

  • Know the different forms system rescue media come in
  • Know how to enter into emergency mode
  • Know how to enter single user mode, what can be done there and how it differs from emergency mode

Emergency Boot Media

The are linux images that comes handy when there is a problem booting the current system due to misconfigurations or any other error.

They came in these flavors

  • CD
  • DVD
  • USB
  • Network
    • NFS
    • FTP
    • HTTP

Live media are unique since they can run on a computer lacking secondary storage, such as a hard disk drive, or with a corrupted hard disk drive or file system, allowing data rescue.

Rescue USB Key

Many distributions provide a boot.iso image file for download, we can use dd command to place this on a USB key drive as in

$ dd if=boot.iso of=/dev/sdX

​Assuming that the USB drive is within /dev/sdX. This will obliterate the previously existing contents on the drive.

If the systems is able to boot from the USB, then the boot can take place from this location.

Helpful utilities such as livecd-tools and liveusb-creator allow specification of either a local drive or the Internet as the location for obtaining an install image, and do the hard work of constructing a bootable image and burning it on the removable drive. This is extremly convenient and works for virtually all Linux distributions.

Emergency Mode

This is the most minimal environment possible. The root filesystem is mounted read-only, no init scripts are run and almost nothing is set up.

The main advantage of emergency mode over single-user mode is that if init is corrupted or not working, you can still mount filesystems to recover data that might be lost during a re-installation.

To enter this mode select an entry within the GRUB boot menu and then hit e for edit. Then add the word

emergency

to the kernel command line before telling the system to boot. You will be asked for the root password before getting a shell prompt.

We can enter into emergency mode for several reason including a filesystem issue

Single User Mode

If the system boots but do not allow login when if finished booting, let's try single user mode. On this mode the next tasks will be accomplished :

  • init is started
  • Services are not started
  • Network is not activated
  • All possible filesystems are mounted
  • Root access is granted without a password
  • A system maintenance command line shell is launched

In this mode your system boots to

runlevel1

Because single user mode mount the filesystem, do not use it when the filesystem can not be mounted successfuly or if the init configuration is corrupted.

To boot into single user mode, use the same method as for emergency mode but change the letter emergency for single.

Laboratories