Common troubleshooting methods for Linux systems

  

Common troubleshooting methods for Linux systems
Under the Windows system, when some system failure occurs, we will use some common remedy measures to repair the system. There are some common solutions in Linux system. The fault measures are also convenient to use.
First of all, we need to set up a rescue disk set, including two boot disks and rootdisk floppy disks, which can provide a separate boot and run full Linux system support. If you are a system administrator, then this is definitely your daily maintenance tool. The first disk of the rescue disk group stores the Linux system bootable kernel program system, and the second disk in the rescue disk group has a complete Linux system, including the "root" file system.
Using the rescue disk group maintenance system is relatively simple to operate. When starting the system, you need to use these two disks to start the system, so you can enter the emergency mode, then we use the "root" account. However, in order to access the files already on the hard disk, we need to manually install the file system of the hard disk. The root directory of the system now refers to the root directory on the rescue disk. In order to be able to access files in the hard disk file system, you must first install the files into a directory that you specify. Thus, if the file system on the hard disk is installed in the /mnt directory, the path to the original /etc/passwd file on the hard disk is /mnt/etc/passwd. For example, use the following command to install the ext2fs type Linux filesystem on the /dev/hda2 disk in the /mnt directory: # monut -t ext2/dev/hda2/mnt.
The most common mistake we make is that we have accidentally deleted some of the more important files and can't recover them directly. However, there is a corresponding file in the rescue disk group, we can find this file from the rescue disk group and copy it to the hard disk. For example, if the file /bin/login is deleted, the system will not be able to enter the login interface normally. We can start the system with the rescue disk group first, install the hard disk file system to the /mnt directory, and then use the following command.
#cp -a /bin/login /mnt/bin
The “-a” option is used to tell “cp” to maintain file access when copying files. Of course, if the deleted basic file is not in the rescue disk set, this method cannot be used. But if you have done a backup of the system before, you can use the previous backup to recover.
It is also common for file systems to be corrupted. If you are using a file system of type “ext2fs”, we can run the “e2fsck” command from the floppy disk to repair the damaged file system. For other types of file systems, you can use the corresponding “fsck” command. A common cause of file system corruption is the file system's "head" (that is, "superblock") corruption, which contains information such as the state, size, and free disk blocks of the file system. If the file system's "header" is damaged, the system may not recognize the file system at all, and thus it cannot be installed. Even if the "e2fsck" command is used, the problem cannot be handled. However, the "ext2fs" type of file system backs up the contents of the "superblock" and stores it in the driver's block group boundary. You can use the following command to tell “e2fsck” to use the backup of the super block:
# e2fsck -b 8193 <partition>
where “
If you accidentally destroy the system function library file, or destroy Symbolic links in the /lib directory will cause commands that depend on these libraries to fail to execute properly. The easiest solution is to reboot the system with the rescue disk set, install the hard disk file system in the /mnt directory, and then repair the libraries in the /mnt/lib directory.
If the super user forgets the password, he or she can't enter the system, and can't manage and use the system. The rescue disk set can solve the problem. If the password may have been modified by the hacker, the system administrator cannot enter the system normally. That is, the Linux system completely loses control, so the system should be regained control as soon as possible. The general solution is to format the hard drive to reinstall the system, but this is a bit of a fuss. Prepare two floppy disks for bootdisk and rootdisk, boot from the floppy drive, boot to the <quo;root” disk and the “shell” prompt appears. Partition the Linux root directory to the /mnt directory. For example, if your Linux is on the first partition of the hard disk, enter mount /dev/hda1 /mnt in the command line, then enter the mnt directory and place the etc/passwd file. Rename, type mv /mnt/etc/passwd /mnt/etc/passwd.bak; then use the command cp /etc/passwd /mnt/etc/passwd to copy the /etc/passwd file on the floppy disk to the hard disk. “etc” directory, this will be restarted by the hard disk, you will not ask for the super password when you log in; finally use the mv/etc/passwd.bak passwd command to change the passwd file back, and then run the passwd command to reset the password. . System administrators should change passwords from time to time to prevent long-term use of a number and be stolen by others.
When using a Linux system on a personal computer, Linux and MS Windows 9x or MS Windows NT are usually coexisting. Due to the installation of other operating systems, the original Linux system will not start properly. This is mainly because these operating systems default to no other operating system on the computer, thus rewriting the hard disk's master boot record (MBR), flushing out the Linux LiLo system bootloader.
If there is a rescue disk set, of course, it is very simple, you can use the first boot disk to boot the hard disk Linux system, re-run the LiLo command, you can write the LiLo system boot program back to the hard disk master boot record, restart the machine can. But if you don't make a system boot disk, how can you restore the Linux system on your hard disk without a rescue disk set? In this case, if you know the exact installation partition of the Linux system on the hard disk, and there is a loadlin program, you can return to the Linux system. The loadlin program is a program that runs under DOS. It can run Linux directly from DOS. This program is available in the DOSutil/directory of the Red Hat Linux 6.0 CD. In addition to this, you need an image file for the Linux boot kernel. This file --vmlinuz is available in the images/directory of the Red Hat linux 6.0 CD. For example, under Windows 98, enter the single-user mode of DOS, and then run the following loadlin command to re-enter the Linux system:
loadlin vmlinuz root=/dev/hda8
where “/dev/Hda8” is the hard disk partition location where the Linux system's "root" file system is located. After the command is executed, the Linux system is booted with “root” and after running the LiLo command, you can reload LiLo into the MBR, and you can return to the state where multiple operating systems were used together.
Maybe you are not a system administrator, but with the increasing configuration of personal computers, installing Linux on your own computer is nothing new. Suppose we have both Windows and Linux operating systems on our computer. How do I start Linux? Do you need to restart your computer every time, booting through LiLo? In fact, if we are in DOS, there is a simple and quick way to start Linux, that is Load Linux. “loadlin.exe” is an executable program under DOS, it can start Linux quickly in a pure DOS environment, and there is no need to restart the computer, usually we can find this program in the /kernels directory of the CD. If you don't know where this program is placed on the installation disk, you can use the “find -name loadlin*” command to find it. Once you find it, copy it to the DOS partition and copy the Linux kernel file you are using. You can copy directly from the CD through Windows, or use the mcopy command to copy the file to the DOS partition in the Linux environment; then write a Linux.bat batch file with the following contents:
c:loadlin c:vmlinuz root =/dev/hda1 ro
We assume that the two kernel files loadlin.exe and vmlinuz are in the root directory of the c drive, and root is the root device of the Linux, and Linux is in the first partition of the hard disk, so the device name is /dev. /hda1,ro means readonly. Later, when you want to start Linux under DOS, you can run Linux.bat. This makes Linux fast and efficient, greatly reducing the amount of time waiting for the system to self-test.
If we run Linux in Xwindows state, due to hardware problems or improper operation, sometimes it may cause the system to suddenly lose response, which is a common crash phenomenon, in fact, the system There is no crash. We can use two common methods to eliminate this phenomenon: First, use the composite key Ctrl+Alt+Backspace on the keyboard to close the currently running task; second, first press and hold Ctrl+Alt+F2 on the keyboard. Composite key, let the system switch to another console, then log in to the system, then execute #ps -ax

Copyright © Windows knowledge All Rights Reserved