Troubleshooting of common Linux systems
Troubleshooting of common Linux system faults:
1. Identify fault characteristics of the problem
2. Fault Reproduction
3. Use tools to collect further information to identify the root cause of the fault
4. Eliminate the impossible reasons
5. Locate the fault:
Start with a simple question
Try only one method at a time
Basic principle: Back up the original file
Use tools whenever possible
Possible faults:
1. The administrator password is missing.
2. The system cannot be started normally.
Grub corruption (MBR corruption, grub configuration file loss)
System initialization failure (a file system cannot be mounted normally, drive problems, etc)
Caused by rc. sysinit, the rc. sysinit script is not loaded as long as the grub editing mode is enabled.
Some service faults
The user cannot log on (the shell corresponding to the user is corrupted, mingetty)
3. The command cannot be run.
4. Unable to continue the compilation process (basic components are missing in the development environment)
Example: Damage MBR.
First back up MBR dd if =/dev/sda of =/root/mbr. backup count = 1 bs = 512
Damaged: dd if =/dev/sda/zero 0f =/dev/sda count = 1 bs = 200
Sync
Shutdown-r now
MBR damage solution:
1. Repair by other hosts
2. Use emergency rescue mode
A. boot. iso only provides the boot interface, so you must also provide the installation environment.
B. Use a complete system installation disk (Sound System Disk)
Enter the command boot: linux rescue
The root file system will be mounted to/mnt/sysimage, and may be mounted in read-only mode. You need to re-mount it to read/write mode.
Because the Referenced File System does not have rc. syinit and rc. sysinit has udevs used to create device files, you need to manually create the device file mknod.
Run the grub command after entering emergency mode.
Findhd ()/then tab to complete if the vimlinuz and initrd files are found
Root hd (0, 0)
Setup hd (0)
Exit
Sync
Reboot
Grub configuration file loss:
Grub> root (hd0, 0)
Grub> kernel/vmlinuz-version ro root =/dev/vo10/root/rhgb quiet
Grub> initrd/initrd-version must match the kernel version
Gurb> boot
Create grub. conf manually
Default = 0
Timeout = 10
Title RHEL 1, 5.8
Root (hd0, 0)
Kernel/vmlinuz-version ro root =/dev/vo10/root quiet
Initrd/
First remove/boot/grub mv/boot/grub. conf/root/
Sync
Shutdown-r now
Kernel panic: kernel panic
Other faults:
Set the default level to 0 or 6 --> enter single-user mode and edit the inittab File
If/etc/rc. d/rc3.d is deleted, an error will be reported when it reaches Level 3. --> repair in Single User Mode
Failed to start a service due to a service fault --> press I when the system is started, start interactive mode, and choose not to start sendmail service.
The rc. d/rc. local script has a syntax error or logic error --> enter the single-user mode. The single-user mode does not start.
Rc. local boot is required. It is often used to add some scripts in it for execution after startup.
/Bin/bash is deleted --> Enter Emergency rescue mode (attach a CD) --> enter the command boot: linux rescue
--> The real root of ls/mnt/sysimg is in this directory.
--> Ls/dev found an hdc.
--> Mkdir/media cannot be directly mounted to/mnt because/mnt/sysimg
--> Mout/dev/hdc/media does not have cdrom hdc, just like when cdrom
--> Cd/media
--> Ls
--> Cd/server
--> Ls | grep bash
--> Rpm-ivh -- replacepkgs bash-version: it is installed in the current small system.
--> Rpm-ivh -- replacepkgs -- root/mnt/sysimg bash-version specified
Chroot/mnt/sysimg
Mingetty is deleted --> mingetty is not required to enter single-user mode, but the network function is not enabled. manually enable the network function and download mingetty from the server.
This article permanently updates the link address: