Lab 11 System Rescue and Troubleshooting

Goal: To build skills in system rescue procedures.

Estimated Duration: 2 hours

Lab Setup: When using rescue mode on a Xen enabled system, you may be prompted to select which root partition to mount. If you are prompted in this lab to select a root partition, choose the logical volume, not the /dev/{s,h}daX partition (which is the root used by your Xen domU).

Sequence 1: Repairing the MBR in the rescue environment

Scenario: The rescue environment provides a last resort for repairing an unbootable machine, even when the bootloader or the root filesystem is damaged or misconfigured. In order to access the rescue environment, you will need either a boot.iso cdrom on a network that has the Red Hat installation tree (the Server directory) available via NFS, or a Red Hat Enterprise Linux CDROM.

Instructions:

1. Use the following command to overwrite the first stage of GRUB in your Master Boot Record with zeros. Specify the block size carefully. If you write too many zeros, you will overwrite your partition table as well, and this will become a much more difficult exercise. (Note that the command below assumes you are using IDE drives. You might need to modify the destination device.)

After typing the following command, check it three times and hit Enter but once.

# dd if=/dev/zero of=/dev/hda bs=256 count=1 && reboot

You have just wiped out your boot sector, but your primary partition table will still be intact. Attempt a reboot to confirm that your system is unbootable. Use the Red Hat rescue environment to repair the system.

a. Load the rescue environment by booting from a Red Hat installation media (either CDROM or PXE), and typing linux rescue at the boot prompt. Proceed with the normal installation defaults. Choose NFS image for the media type and use the following NFS information:

• NFS server : server1.example.com

• NFS directory : /var/ftp/pub

b. The rescue environment will ask if you wish to mount the hard drive's filesystems. Select Continue to mount the filesystems in read-write mode. Examine the output of mount to confirm that the filesystem was correctly reconstructed. You might want to refresh your memory by examining your disk's partitions with fdisk.

c. Note that your hard drive has been reconstructed under the mount point /mnt/sysimage. Examine grub.conf (on your hard drive) to confirm that it is appropriately configured.

# cat /mnt/sysimage/boot/grub/grub.conf

d. To reinstall GRUB, you must shift contexts, so that grub-install believes that the root of your filesystem is the /mnt/sysimage directory. Spawn a chrooted shell, run grub-install, and then exit.

# chroot /mnt/sysimage
# grub-install /dev/hda
# exit

(Or, should the above fail to execute properly)

Exit the chroot environment and then type the command: grub at the bash prompt. This will place you into grub's command shell where you can enter the following commands:

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

e. Now exit your rescue shell. Note that the rescue environment will unmount any partitions that you mounted. Eject the CD.

Sequence 2: Installing software in rescue mode

Instructions:

1. Use the following command to overwrite the mount command.

# cp /bin/date /bin/mount

You have just wiped out a key executable on your system. Upon attempting a reboot, you should find your system unbootable. Use the Red Hat rescue environment, along with its version of the rpm command and the library of RPMs provided by the installation tree, to repair the system. Hint: /bin/mount is part of the util-linux RPM.

a. Load the rescue environment as in the previous exercise.

b. The rescue environment will attempt to automatically mount the hard drive's filesystems. Examine the output of mount to confirm that the filesystem was correctly reconstructed.

c. Discover what package the /bin/mount command comes from and then verify that util-linux package on your hard drive, all using a chrooted invocation of rpm. Do not forget to exit the chroot or the rpm installation will fail.

# chroot /mnt/sysimage
# rpm -qf /bin/mount
# rpm -V util-linux
# exit

d. rpm should report that the /bin/mount executable has been modified. Reinstall the util-linux RPM from your installation tree (which has been NFS mounted under /mnt/source).

# cd /mnt/source/Server

# rpm -ivh --force --root /mnt/sysimage util-linux*

Note that the util-linux package was installed (the hash marks indicate this), although you may see some errors at the end of the process. As it turns out, these are harmless errors, although in a production environment, you would want to test this out fully.

e. Now exit your rescue shell. Note that the rescue environment will unmount any partitions that you mounted.

Sequence 3: Troubleshooting Practice

System Setup: 1. Turn off iptables and mount the /var/ftp/pub directory from server1 if it is not currently mounted.

service iptables stop
chkconfig iptables off
mkdir /mnt/server1
mount server1:/var/ftp/pub /mnt/server1

2. Install the Troubleshooting Practice RPM:

rpm -ihv /mnt/server1/gls/RPMS/rhce-ts-*

3. Ensure that your computer is configured as closely as possible to the following specifications:

• Authenticate users from your local /etc/passwd file. That is, do not run any network authentication scheme such as NIS or LDAP.

• Use 192.168.0.254 (server1.example.com) as your name server.

• Confirm that /usr/local/bin is part of your PATH environment variable.

The network problems assume that you remember your network information. Your network information is as follows:

IP: 192.168.0.X
SUBNET: 255.255.255.0
GATEWAY: 192.168.0.254
DNS: 192.168.0.254

The following items are required for some, but not all, troubleshooting problems. You may still do most problems if some of these items are missing.

• Change to runlevel 3, not runlevel 5. Confirm that the X server is not running (no startx). Only the local problems require this.

• Confirm that /home is a separate filesystem from the root filesystem and is local to the system (not an NFS mounted filesystem).

Instructions:

1. The Troubleshooting Practice problems come in three parts, each invoked by a separate command. The sections, commands, and number of problems in each section vary; therefore, run command count , to determine the number of problems for each
troubleshooting command:

• For Local: tslocal count
• For Networking: tsnetwork count
• For Booting: tsboot count

2. Invoke the first local problem by running:

# tslocal 1

This command will set up the problem and will explain the goal. The goal will be stored in the file /etc/ts for later reference. Spend three to eight minutes trying to solve the problem.

3. If you have not yet solved the problem, you may need a hint. Hints can be displayed by
running the tshint command:

# tshint local 1 1

This will display the first hint for the first tslocal problem. Continue to invoke hints until you get enough information to solve the problem or until you run out of hints:

tshint local 1 2
tshint local 1 3
[ and so on ...]

The tshint command will tell you when you have reached the end of the hints. Again, do not spend more than five to ten additional minutes on this problem.

If a problem requires that you attempt to resolve it in rescue mode, to access the hints, you will need to add a directory to the path:

export PATH=$PATH:/mnt/sysimage/user/local/bin

4. Whether or not you have solved the problem, run the tslesson command:

# tslesson local 1

This command will tell the lessons intended to be taught by the problem. Some tslesson messages also give step-by-step instructions on how to approach a particular problem.

5. If, after reading the hints and the lesson, you are unable to solve the problem, call the instructor for assistance.

6. Proceed with the remaining problems in the same way. For example, tsnetwork 1 sets up the first network problem and tshint network 1 1 shows the first hint for the first network problem.

RH133读书笔记(11)-Lab 11 System Rescue and Troubleshooting的更多相关文章

  1. RH133读书 笔记(4) - Lab 4 System Services

    Lab 4 System Services Goal: Develop skills using system administration tools and setting up and admi ...

  2. RH033读书笔记(10)-Lab 11 Process Control

    Lab 11 Process Control Sequence 1: Job Control 1. [student@stationX ~]$ su - 2. Begin some jobs in t ...

  3. RH253读书笔记(2)-Lab 2 System Resource Access Controls

    Lab 2 System Resource Access Controls Goal: To become familiar with system resource access controls. ...

  4. RH253读书笔记(1)-Lab 1 System Monitoring

    Lab 1 System Monitoring Goal: To build skills to better assess system resources, performance and sec ...

  5. RH133读书笔记(1)-Lab 1 Managing Startup

    Lab 1 Managing Startup Goal: To familiarize yourself with the startup process System Setup: A system ...

  6. RH133读书笔记(2)-Lab 2 Working with packages

    Lab 2 Working with packages Goal: To gain working experience with package management System Setup: A ...

  7. RH133读书 笔记(5) - Lab 5 User and Group Administration

    Lab 5 User and Group Administration Goal: To build skills for user and group administration. Estimat ...

  8. RH133读书 笔记(3) - Lab 3 Configuring the kernel

    Lab 3 Configuring the kernel Goal: Develop skills tuning the /proc filesystem. Gain some experience ...

  9. RH133读书笔记(6) - Lab 6 Adding New Filesystems to the Filesystem Tree

    Lab 6 Adding New Filesystems to the Filesystem Tree Goal: Develop skills and knowlege related to par ...

  10. RH133读书笔记(9)-Lab 9 Installation and System-Initialization

    Lab 9 Installation and System-Initialization Goal: Successfully install Red Hat Enterprise Linux. Sy ...

随机推荐

  1. 怎样从host之外连接到docker container

    启动docker的时候的指令使用 sudo docker -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock -d & 这样就能使dock ...

  2. 在web浏览器中判断app是否安装并直接打开

    最近公司App产品在运营推广上有一个需求,就是要求可以让用户在访问我们的推广网页时,就可以判断出这个用户手机上是否安装了我们的App,如果安装了则可以直接在网页上打开,否则就引导用户前往下载.从而形成 ...

  3. eclipse安装ADT后在windows菜单下找不到android SDK and AVD Manager选项的解决办法

    在eclipse中点击window→Customize Perspective→Command Groups availability→Available command groups下勾选Andro ...

  4. java注解(一)

    虽然平时有使用注解,不过没有深入了解,今天无聊,重新从基础深入了解整理下: java注解是附加在代码中的一些元信息,用于一些工具在编译.运行时进行解析和使用,起到说明.配置的功能.     注解不会也 ...

  5. robot framework 使用四:分层设计和截图以及注意事项

    再说一下眼下的主要环境信息和版本号: 操作系统:win7 64位 python版本号:2.7.6 RIDE版本号:1.2.3 selenium2library:1.5.0 selenium:2.40. ...

  6. windows phone (20) Image元素

    原文:windows phone (20) Image元素 之前有说道wp目前支持的图片格式为png和jpeg ,我们可以通过设置Source属性设置图片源,下面要说的是Iamge元素的部分属性,这就 ...

  7. Fitnesse用系列三

    动态决策表 动态决策表是新出,版本号到今年年初还没有了.我看了看文档和演示文稿样本,其效果是作为一种辅助通用决策表.它不是easy匹配的名称和发射.但假设只有一个或两个参数.不管名字怎么都找不到,这并 ...

  8. Android进程间通信(IPC)机制Binder简介和学习计划

    在Android系统,每个应用程序是由多个Activity和Service部件,这些Activity和Service有可能在相同的处理被执行,此外,还可以在不同的过程中进行. 然后.不是在同一个过程A ...

  9. java自学者的福音

    谈到自学对于程序员来说并不陌生,自从我们离开校门就开始了自学之路.这一路上绝大部分都是 百步止于九十 步, 不是因为他们不够坚持,而是没有找到学习的方法和资源.当然这一路上我也走得很辛苦,刚毕业后自学 ...

  10. web网站架构

    浅谈web网站架构演变过程   前言 我们以javaweb为例,来搭建一个简单的电商系统,看看这个系统可以如何一步步演变.   该系统具备的功能:   用户模块:用户注册和管理 商品模块:商品展示和管 ...