Solution to common Linux faults

Source: Internet
Author: User

In Windows, when the system fails, we will use some common remedial measures to fix the system, in Linux, there are also some commonly used measures to solve common faults, which is convenient to use.

First, we need to create an emergency disk group, including preparing two floppy disks, bootdisk and rootdisk, which can provide support for independent startup and running of a complete Linux system. If you are a system administrator, this must be an essential tool for daily maintenance. The first disk in the emergency drive Group stores the Linux kernel program system that can be started. The second disk in the emergency drive group has a complete Linux system, this includes the "root" file system.

It is relatively easy to operate the system using the emergency disc group. When starting the system, you need to use these two disks to start the system, so that you can enter the emergency mode. At this time, we use the "root" account. However, in order to access the existing files on the hard disk, We need to manually install the hard disk file system. The root directory of the system refers to the root directory on the First Aid Board. To access files in the hard drive file system, you must first install the files in a specified directory. In this way, if the file system on the hard disk is installed in the/mnt directory, the path of the original/etc/passwd file on the hard disk is/mnt/etc/passwd. For example, run the following command to install the ext2fs Linux File System on the/dev/hda2 disk in the/mnt Directory: # monut-t ext2/dev/hda2/mnt.

The most common mistake we make may be that we accidentally deleted some important files and cannot directly restore them. However, if there is a file in the First Aid disk group, we can find the file from the First Aid 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 access the logon interface normally, so we can start the system with an emergency disk group, install the hard disk file system in the/mnt directory and run the following command:

#cp -a /bin/login /mnt/bin

The "-a" option is used to tell "cp" to maintain the object access permission when copying files. Of course, this method cannot be used if the basic file to be deleted is not in the first aid disk group. However, if you have performed the system backup before, you can use the previous backup to restore the system.

File System destruction is also common. If you are using an ext2fs file system, you can run the "e2fsck" command on a 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 damage is that the file system's "Header" (that is, "super block") is damaged. It contains information such as the status, size, and idle disk block of the file system. If a file system's "Header" is damaged, the system may not recognize the file system at all, so that it cannot be installed, this issue cannot be handled even if the "e2fsck" command is used. However, the file system of the "ext2fs" type backs up the content of the "super block" and stores it at the boundary of the block group of the driver. Run the following command to tell e2fsck to use a super block backup:

# e2fsck -b 8193 <partition>

If the system function library file is accidentally damaged or the symbolic link in the/lib directory is damaged, the commands dependent on these libraries cannot be executed normally. The simplest solution is to restart the system with an emergency disk group, install the hard disk file system in the/mnt directory, and fix the library in the/mnt/lib directory.

If a Super User forgets his or her password, he or she cannot access the system or manage and use the system. The problem can be solved by using an emergency disk group. If the password may have been modified by a hacker, the system administrator may not be able to access the system normally. That is to say, the Linux system is completely out of control, so the system control should be obtained as soon as possible. The general solution is to format the hard disk and reinstall the system. Prepare two floppy disks, bootdisk and rootdisk, start from the soft drive, start to the "root" disk, and a "shell" prompt appears. Mount the Linux root directory to the/mnt directory. For example, if your Linux is in the first partition of the hard disk, enter mount/dev/hda1/mnt in the command line, enter the mnt directory, change the name of the etc/passwd file, and enter mv/mnt/etc/passwd. then run the command cp/etc/passwd/mnt/etc/passwd to copy the/etc/passwd file on the floppy disk to the "etc" directory on the hard disk, in this way, the hard disk is restarted, and the super password will not be asked during logon. The mv/etc/passwd will be used. the bak passwd command changes the passwd file back, and then runs the passwd command to reset the password. The system administrator should change the password from time to prevent unauthorized use of a number for a long time.

When a personal computer uses a Linux system, it usually coexist in Linux and MS Windows 9x or MS Windows NT. Because other operating systems are installed, the original Linux system may not start properly. This is mainly because, by default, these operating systems are no other operating systems in the computer, so the Master Boot Record (MBR) of the hard disk is rewritten, And the Linux LiLo boot program is washed out.

If there is an emergency disk group, of course it is very simple. You can use the first boot disk to start the Linux System of the hard disk and run the LiLo command again to write the LiLo system boot program back to the Master Boot Record of the hard disk, restart the machine. But if you have not created a system boot disk, how can you restore the Linux system on the hard disk without an emergency disk group? 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 again. Loadlin is a program running in DOS. It can be used to directly start Linux from DOS. This program is available in the DOSutil/directory of the Red Hat Linux 6.0 CD. In addition, a Linux kernel startup image file is required. The file vmlinuz is available in the images/directory of the Red Hat linux 6.0 CD. For example, in Windows 98, enter the DOS single-user mode, and then run the following loadlin command to re-enter the Linux system:

loadlin vmlinuz root=/dev/hda8

"/Dev/hda8" is the hard disk partition location of the Linux system's "root" file system. After the command is executed, guide the Linux system to log on with "root" and run the LiLo command. Then you can reload LiLo into MBR, now, you can go back to the status where multiple operating systems were used in the past.

Maybe you are not a system administrator, but with the increasing configuration of personal computers, installing Linux on your computer is not a new thing. Suppose we have two Windows and Linux operating systems installed on our computer, how should we start Linux? Do you need to restart the computer every time and boot through LiLo? In fact, if we use DOS, there is a simple and fast way to start Linux, that is, Load Linux. “Loadlin.exe "is an executable program in DOS. It can quickly start Linux in a pure DOS environment without restarting the computer, we can find this program in the/kernels directory of the CD. If you do not know where the program is stored on the installation disk, you can use the "find-name loadlin *" command to find it. Copy it to the DOS partition and copy the Linux Kernel File you are using. You can copy files directly from the CD in Windows, or use the mcopy command in Linux to copy the files to the DOS partition. Then, write a Linux. bat batch file with the following content:

c:loadlin c:vmlinuz root=/dev/hda1 ro

In this example, we assume that both the loadlin.exe and vmlinuz kernel files are in the c root directory, while the root is the Linux root device and Linux is in the first partition of the hard disk. Therefore, the device name is/dev/hda1 and ro indicates readonly. In the future, you can run Linux. bat to start Linux in DOS. In this way, Linux is started quickly and efficiently, greatly reducing the waiting time during system self-check.

If we run Linux in Xwindows, the system may suddenly lose response due to hardware problems or improper operations, this is also a common phenomenon of crashes. In fact, the system does not crash at this time. 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, press Ctrl + Alt + F2 on the keyboard to switch the system to another console, log on to the system, and run the # ps-ax | grep startx command, this will list the process ID (PID) of your Xserver, and then enter the following command in the command line to eliminate the crash phenomenon in Xwindows: # kill-9 PID_Number, finally, the original platform is returned through the Alt + F1 compound key.

There are still many common errors and solutions. Here we only mention some of them. If you still need to add or want to correct them in this article, we would like to raise them together.


  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.