MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

* DocIndex - Administration

System Recovery II

* Booting 'failsafe'
* Single User Mode
* The root Shell
* Linux Systems On Other Media

Related Resources:

LIGS, 4.11
Mdk-Ref 13
man linuxconf
man mount
man init

The LWN.net Linux Distribution List

Revision / Modified: Jan 28, 2002
Author: Tom Berger

 

* Booting 'failsafe'

'failsafe' is a standard boot option in all Mandrake Linux systems.

Under normal circumstances, the system switches right into the preferred runlevel during boot ('3' for console, '5' for X). 'failsafe' on the other hand first boots into runlevel 1 (Single User Mode, see below), then tries to switch to runlevel 3 (console) and then, if 5 is the default runlevel, into runlevel 5.
If the 'Linuxconf' administration suite is installed, it will be started in console mode upon reaching runlevel 1. You will be presented with a runlevel menu or the possibility to use 'Linuxconf' to do system maintenance tasks.

* section index * top

* Single User Mode

Linux also provides two built-in rescue systems, one of them is the 'single user mode', aka runlevel 1. This 'single user' is 'root'. There will only be a minimum of processes running.

There are several ways to get into this runlevel:

  • From within a running system (as 'root'): init 1. Notice that this command will shutdown almost everything on your machine. It's also a popular way to simulate a reboot.

  • From the prompt of a boot loader: linux single or linux init 1. You might also be dropped off here when using the 'failsafe' boot option if the system can't go to runlevel 3.
    There's no login required.

* section index * top

* The root Shell

The single user mode still relies on a working 'init'. But what if 'init' is corrupted or even missing? If you boot your system with this boot loader option:

linux init=/bin/sh

only the kernel will be loaded into system memory and you will be dropped almost immediately to a shell.

On a Mandrake Linux 8.1 system, you should add another option to turn off devfsd, because otherwise you will run into trouble with hardware related utilities:

linux init=/bin/sh devfs=nomount

Things you do not have initially in this shell:

  • A national key map and font. The default ASCII font and an American key map is used.
  • A PATH containing '/sbin'. Execute all commands from that directory with their full path, e.g. /sbin/fdisk -l /dev/hda instead of fdisk -l /dev/hda.
  • Mounts apart from the partition containing '/'. Only '/' is mounted, nothing else (thus the name).
  • A writable mount. Not only that just '/' is mounted, it is also mounted read-only.
  • init. Obviously ;-). There's no 'init', no 'shutdown' or 'halt'. You have to sync and unmount all media you might have mounted during your root shell session by yourself.

The first thing you should try is getting write access to your '/' partition:

mount -o remount,rw /dev/device

Run mount to find out the name of device. Another file system you want to mount is the virtual 'proc' file system, which provides you and the system utilities with information about what's going on in your system:

mount /proc /proc -t proc

From here on you should be able to do your repair tasks. Your main objective should be getting init to work again, so that you can do further repairs in single user mode.

Before leaving this shell, flush all buffers with

sync

unmount all mounts with

umount -a

and remount the '/' mount read-only again with

mount -o remount,ro /

Press <ALT> <CTRL> <DEL> simultaneously to leave the shell and reboot the machine.

Notice:

  • The flags of the 'mount' command are wrong and do not reflect changes, e.g. a remount from read-only to read-write. Don't trust them.

* section index * top

*Linux Systems On Other Media

There's quite a number of Linux distributions which run off a removable medium (floppy, CD, ZIP) or a Windows partition. CD based distributions often offer the added advantage of providing a graphical interface.

You'll find a fairly updated list of those Linux distributions on The LWN.net Linux Distribution List.

Things to keep in mind when using a third party rescue distribution:

  • Make sure it works. If you've downloaded a CD image, run

    md5sum name.iso

    and compare the resulting number with the one provided on the server you downloaded the image from.
    Floppy images are less prone to transmission CRC errors but media failures are much more likely. Having put the image onto a floppy, run

    cmp /dev/fd0 name.img

    to make sure the image on the floppy and the image you've downloaded are identical.
    Boot your new rescue system to check if everything's OK.

  • Check if the distribution is actively maintained. Linux is a fast moving target. If you can't mount your hard disk partition because of an out-of-date file system driver on your rescue system, you're back to square one.

  • Have a look at the included software. If your partitions are formatted with a less common file system like XFS or JFS, it might happen that the distribution does not contain the necessary utilities. Use the content list of the Mandrake Linux rescue system as a template.

The next two pages of this article will list some common (and some less common) emergency scenarios and describe how to handle them.

* section index * top

* Emergency scenarios I


 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.