7 urgent troubleshooting methods for Linux common faults

  

1. Using a rescue disk set for maintenance A rescue disk set (also known as a boot/root disk group) is an essential tool for system administrators. Use it to start and run a complete Linux system independently. In fact, the second disk in the rescue disk group has a complete Linux system, including the root file system; the first disk holds the bootable kernel. Using a rescue disk set to maintain the system is simple. Just use these two disks to boot the system and enter the rescue mode, which is the root account. In order to access files on the hard disk, you need to manually install the hard disk file system. 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 Note: The root directory is now the root directory on the rescue disk. In order to access the files in the hard disk file system, you must first install it in a directory. 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. 2. Handling when the file system is corrupted When the file system is corrupted, if you are using an ext2fs file system, you can run the e2fsck command from the floppy disk to correct corrupted data in the file system. For other types of file systems, the corresponding fsck command can be used. When checking the file system from a floppy disk, it is best not to use the mount command to install. Note: A common cause of file system corruption is that the superblock is corrupted. The superblock is the file system's "header". It contains information such as the state, size, and free disk blocks of the file system. If you damage a file system's super block (for example, accidentally write data directly to the file system's super block partition), then Linux may not recognize the file system at all, so you can't install it, even with the e2fsck command. I can't handle this problem either. 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 -b The 8193 option is used to display the backup data of the super block of 8193 blocks stored in the file system. 3. Recover lost files If you accidentally delete important files, you can also copy the corresponding files from the rescue disk to your hard disk. For example, if the file /bin/login is deleted, the system will not run to the login interface. You can use the rescue disk group to boot the system, install the hard disk file system to the /mnt directory, and then use the following command: #cp -a /The bin/login /mnt/bin “-a” option tells cp to keep file access when copying. Of course, if the deleted basic file is not in the "first aid disk group", this method cannot be used. If you have done a system backup before, then you can only use the previous backup to restore. 4. Handling when the library is destroyed If you accidentally destroy the system library file, or destroy the symbolic link in the /lib directory, then the commands that depend on these libraries will not be executed. The easiest solution is to boot 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. 5. Unable to log in to the system with the root account Due to the negligence of the system administrator or the system being compromised by the hacker, the system administrator may not be able to log in to the system with the root account. In the first case, it may be that the system administrator has forgotten the root password and can solve the problem with the rescue disk group. In the second case, since the password is likely to be modified by the hacker, the system administrator cannot enter the system, that is, the Linux system completely loses control, so the system should be regained control as soon as possible. After obtaining root privileges, you should also check the system for damage, in case it is hacked again. The main job that needs to be done is to reset the root password and gain control of the Linux operating system. First boot the system with the rescue disk set, then install the file system of the hard disk into the /mnt directory, edit the /mnt/etc/passwd file, and set a line of encrypted password fields corresponding to the root account, as shown below: root: :0:0:root:/root:bin/bash Note: If the system uses the shadow tool, you need to do the above operation on the file /etc/shadow so that the root login system does not require a password. This way, the root account has no password. When you restart the Linux system from the hard disk, you can log in with the root account (the system does not ask for a password). After entering the system, use the command passwd to set a new password. 6. The system can't start Generally, if the system administrator can't enter the system normally, you need to consider using the rescue disk group to enter the emergency mode to troubleshoot the system. But in the absence of a rescue disk set, the Linux system can not be started, what should I do? When using a Linux system on a personal computer, Linux and MS Windows 9X or MS Windows NT are usually coexisting. Due to the reinstallation of other operating systems, it often causes the original Linux to fail to start. This is mainly because these operating systems default to no other operating system on the computer, thus overwriting the hard disk's master boot record (MBR), overwriting the Linux LILO system bootloader. If there is a rescue disk group, it is very simple, 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's master boot record, and boot again. If you don't have a system boot disk, you can return to Linux if you know the exact installation partition of Linux on your hard disk and you have a loadlin program. Loadlin is a program under DOS. It can run Linux directly from DOS and quickly enter the Linux environment. This program is available in the dosutil directory of the Red Hat Linux 6.0 CD. In addition, you need a Linux boot kernel image file vmlinuz, which is available in the images directory of the Red Hat linux 6.0 CD. For example, under the Windows 98 system, enter the DOS single-user mode, and then run the following loadlin command, you can re-enter the Linux system: loadlin vmlinuz root=/dev/hda8 /dev/hda8 is the Linux root file system Hard disk partition location. After the command is executed, the Linux system is booted. After logging in as root, run the LILO command to reload LILO into the MBR and return to the state where multiple operating systems were used together. 7. Dealing with faults caused by abnormal shutdown If Linux does not shut down properly, it may result in the inability to enter the Linux KDE environment and only in the console environment, and there are constantly large blocks of English characters rolling up. After logging in as root, type the startx command and the error message "x server cannot connect" appears. At this time, you can type setup in the console, the system setting menu appears, select the “X window setting”, and then set the display type, refresh frequency, memory size, resolution, etc. according to the prompts. If everything is correct, the system will automatically start the X Windows system, everything will be OK! One thing to note is that when setting up with setup, there may be a large block of English characters scrolling up. Please don't panic, see the screen, continue to use the TAB key or the arrow keys, and you will immediately click on it.

Copyright © Windows knowledge All Rights Reserved