Repairing SUSE Linux Enterprise Server using a Rescue CD
SUSE Linux Enterprise Server offers a Rescue CD for repairing the system if your hardware causes a crash at reboot. This tip shows you how to use it.
Most problems with SUSE Linux Enterprise Server arise when you restart it. Many problems on this operating system are hardware-based and therefore only manifest on a server reboot. In such situations the Rescue System on every SUSE Linux installation CD or DVD can play a useful role. Here, you'll learn how to manually start your server using this option.
When using a rescue CD to recover your server, nothing on the hard drive mounts automatically. That means that you'll need to mount all file systems yourself. This requires more work, but also allows you to fix any problems that occur in the mounting process. Mounting just your ordinary file systems, however, is not enough; you'll need to make sure that only special file systems such as /dev and /proc become available. If, after mounting these file systems, you want to continue booting your server, you'll have to use the CHROOT command to change your current root environment. Only then will you be able to run all services as you would normally do.
- Put your SUSE Linux Enterprise Server installation CD or DVD in your server's optical drive and reboot the server.
- When the GRUB menu from the optical disk shows, select the Rescue System option to load the Rescue environment from the installation disk. It will take about two minutes to load -- it needs to probe all hardware on your server.
- On the Rescue CD prompt, enter root as the user name that you want to use to login. As this is the generic root user from the rescue system, you don't have to enter a password.
- At this point, you have logged in but don't have access to any of your servers file systems yet. Check your documentation to find out which file systems are on your server and on which partition or logical volume you can find these file systems. If you are using partitions, fdisk -l may be of great help. For instance, fdisk -l /dev/sda shows all partitions that exist on the /dev/sda device. If you are using logical volumes, commands such as lvdisplay or lvs give an overview of all logical volumes on your server. In this article, we'll assume you have to mount the following file systems.
/ /dev/system/root (LVM) /var /dev/system/var (LVM) /boot /dev/sda1
- Since the root partition is the starting point of everything mount it first. The rescue system is already mounted on the root directory, so you can mount it on a temporary directory such as /mnt with the following command:
mount /dev/system/root /mnt
- The ultimate goal is to use chroot to make of /mnt your root (/) directory. Since in this chroot environment you also need access to dynamically generated directories like /dev and /proc, you need to mount them before activating the chroot environment. To do so, use the following two commands:
mount -o bind /dev /mnt/dev mount -t proc proc /proc
- You are now ready to activate the chroot environment. You should do this before mounting all other file systems in order to make sure that these file systems make use of the correct devices in /dev in the chroot environment. It will also ensure that the file systems write information to the right /proc directory.. To activate the chroot environment, use the following command:
- Now that you have the chroot environment activated, you can mount all other file systems. In this example, these are: 1) the logical volume /dev/system/var and 2) the primary partition /dev/sda1. You can mount them with the following commands:
mount /dev/system/var /var mount /dev/sda1 /boot
You have now completely reconstructed your SUSE environment. So, if you use a command such as PASSWD, the new password is written to the right /etc/shadow file ( the file on your server's hard drive and not the one on your rescue system). All other commands you may wish to use for maintenance will work as well at this point because they'll be able to work on all the original files on your server's hard drive. Once finished, just reboot to start your server as you usually do.
SUSE Linux Enterprise Server has a complete Rescue environment on the installation disk. Using this rescue environment, you can reconstruct your complete server environment if you run into trouble. Here we have discussed how to perform these tasks that will help you repair access to your server as quickly as possible. Good luck repairing your server!
ABOUT THE AUTHOR:
Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SUSE Linux Enterprise Desktop 10 (SLED 10) administration.