Sometimes, you just need a rescue disk. The example of a missing GRUB configuration file is a good way to test the rescue mode available from the Ubuntu installation CD. For the purpose of this section, I run the following command to disable the GRUB menu:
$ sudo mv /boot/grub/menu.lst /home/michael
Now that GRUB is disabled, use the Ubuntu Server installation CD—the ISO file described in Chapter 2 would work just as well. Boot from that CD, and when you get to the main Ubuntu Server installation menu, choose Rescue A Broken System and press enter.
The first few steps of rescue mode proceed like an installation. As shown in Figure 4-6, a Rescue Mode label appears in the upper-left corner.
The first few steps are essentially identical to the first few steps of the installation process described in Chapter 2. Remember that as these are text-mode installation screens, use the tab and arrow keys to highlight a selection and press enter to confirm the choice.
Rescue mode also provides full access to the other installation tools; just select Go Back, and you should recognize the installation menu.
1. Select a language and press enter.
2. Based on the selected language, a choice of countries or regions may be presented. Select the most appropriate option and press enter to continue.
3. When you see an option Detect Keyboard Layout, I prefer to select No. Otherwise, you're prompted to type in one of several different characters, several times. Make a choice and press enter to continue.
4. Select a Keyboard Origin and press enter.
5. Select a Keyboard Layout and press enter.
6. The Ubuntu installer now takes a few moments to detect critical hardware and install packages required for rescue mode.
7. Enter a hostname for the system, which does not have to match the hostname of the system being rescued.
Enter a device you wish to use as your root file system. You Dill be able to choose among various rescue operations to perform on this file system.
Device to use as root file system:
Figure 4-7. Selecting a root filesystem in rescue mode
8. Based on the national origin associated with the keyboard, review the options for time zones. Select a time zone most appropriate for your location and press enter.
9. In the Rescue Mode screen shown in Figure 4-7, you'll see a list of detected devices, which can be partitions, logical volumes, or RAID devices. Select the device associated with the top-level root directory (/) and press enter.
If in doubt about the right device, shell access is available in the second and third virtual consoles, in the same manner as during the regular Ubuntu installation process. Press alt-f2 or alt-f3, and then press enter, to access the ash shell in one of these consoles. You can run basic commands such as df, fdisk, cat, and mount to review available files. You can then return to the Rescue Mode screen by pressing alt-fi.
Alternatively, just try all available options; if the top-level root directory (/) device is not found, an error message appears after the next step, at which point you can select Go Back and try a different device.
10. There are four options which appear, as shown in Figure 4-8. The first option depends on the device selected in step 9.
■ Execute A Shell In /dev/xyz The actual device file that appears (instead of xyz) depends on the device selected in step 9. This option mounts the device and looks for a shell in the associated volume. If a shell doesn't exist in that volume, you'll see an error message. If it exists, you're asked to confirm, before the device file is mounted on the top level root directory (/), and you're taken to a root user prompt. Generally this is the preferred option.
■ Execute A Shell In The Installer Environment The device file selected earlier is mounted on the /target directory, a shell from the installation CD is used, and you're shown a root user prompt.
Figure 4-8. Selecting a rescue mode operation
■ Choose A Different Root Filesystem This option opens the Ubuntu Installer Main Menu, defaulting to the Enter Rescue Mode option. Select this option, and repeat step 8.
■ Reboot The System This option does not reboot the system, as of this writing.
11. Assuming you've selected one of the first two options from Figure 4-8, you should have access to a root prompt. If the / var directory is part of the top-level root directory (/) volume, you should have access to log files in the / var/log directory, to diagnose errors as needed.
12. Let's return to the original problem, a moved GRUB configuration file. Assume the find command was used to search and locate the menu.lst GRUB configuration file, say in your home directory. In that case, you can restore the menu.lst configuration file with the following command (substituting your user information):
# cp /home/michael/menu.lst /boot/grub
13. Once changes are complete, type exit to return to the screen shown in Figure 4-8. At that point, you can select Reboot The System. If this takes you to the Ubuntu Installer Main Menu, select Execute A Shell, select Confirm, and press enter. Then type in the reboot command.
Was this article helpful?