linux startup failure failure analysis and repair

Preface

  It is inevitable that we will encounter the situation that the server fails to start one day when we use the Linux server. When we encounter this kind of problem, we need to know how to find the cause of the inability to start, and thus solve the problem. This article will list the most common linux startup problems.

problem analysis

hardware problem:

  The hardware is nothing more than a motherboard, cpu, memory, hard disk, power supply and other onboard devices.
Common troubleshooting methods can be divided into:

①Check from the motherboard: The server motherboard has its own test card, and an error code will be displayed if it fails to boot normally.
②Memory: generally dual-channel, four-channel. Most of the servers are dual-socket CPU memory. The memory is divided into type AB sockets. For example, a total of 24 memory sockets A1-A12 form a group of B2-B12. A1 should be inserted one by one and the other should be inserted on B2. Or the memory is loose and not plugged in properly. Wipe the gold finger of the memory module and reinsert the
hard disk: The hard disk is generally inserted into the array card. If the hard disk is not recognized, it must be set in the array card. The specific operation can be Baidu array card models
④cpu: this is generally not bad, this is the most stable on the server hardware can simply be ignored.
⑤Power supply: There is no response at startup, the cooling fan will not move, and the usb has no output power supply. This cannot be repaired, only replaced.

system issue:

①Problem with the boot partition: MBR partition is damaged or lost
②The grup on which the startup depends is damaged
③The file system is damaged, or other partitions are damaged
④Forgot the login password
⑤It should be a file error that can not start

Before solving the problem, we first understand the boot process of Linux, which will help us to determine where we are, or at which step the problem occurred.
The boot process of linux is roughly divided into 4 steps. The
first step is
bios hardware self-check (the longest time-consuming)
hardware troubleshooting, which can be finished in about a minute or two. The end sign: see the group interface

Step 2
Start the boot manager: cetos6 is GRUB centos7 is
the files included in the boot of the GRUB2 system, select which kernel to enter after booting

The third step:
Kernel and mirror file system loading
①Determine the boot partition (mostly the first partition)
②Load the kernel file (supported by hardware) scheduling algorithm cpu memory management
③Mirror file system (get device driver support, identify disk, File system configuration, etc.)
Step 4
System initialization and file loading
①The first process
centos6 is init(the startup speed is slow, only serial startup, etc.)
centos7 is ②System systemd
initialization (host name, network support, clock support, logic coupons) Support)
centos6 sysinit script completes initialization
centos7 systemd to load the service unit
③Enter the run level, for example, the F8 security mode of windos
centos6 has this level,
centos7 or 8 does not have the run level, directly define the mode mod, either graphics mode or character mode ④start the
system Network card, load nfs, start ssh terminal, start httpd, etc.

2. Solution:

1. The rescue mode of the system

1. Enter the emergency mode, select the boot item in the biso, and set the CD or USB as the first boot item, provided that the USB or CD has the same version of the system. I take the CD as an example here. Restart after selection.
Insert picture description here
2. Enter the rescue mode.
Please note that the system kernel of the rescue mode you entered is on the CD-ROM or CD-ROM instead of entering our damaged system. The damaged hard disk is mounted through the CD-ROM system to perform file operations. (Similar to the pe disk of windos).
cenros6 select Rescue installed ysytem to enter rescue mode
centos7 select Troubleshooting to enter rescue mode

Insert picture description here
Insert picture description here
3. Choose the language English, here is basically just the next step, one of which is Setup Networking whether to open the network, here pay attention to select no and not open it.
Insert picture description here

  1. Enter the emergency shell, chroot /mnt/sysyimage, enter the hard disk of our faulty system, and you can perform file operations. Such as modifying the configuration file.
    Insert picture description here
  2. After the modification is completed, exit, enter the bios and change back to the hard disk boot mode.
2. Frequently encountered system startup problems

1. MBR damage repair
Insert picture description here
When the boot sector is damaged, it will not be able to start
① virus damage.
②The hard disk is damaged
③When dual systems are installed.
Simulated destruction: Use the copy dd command to erase the first 446 bytes. The instructions are as follows
dd if=/sev/zero of=/sev/sda bs=1 count=446
. Check after erasing.
hexdump -C -n 512 /dev/sda
Insert picture description here
Solution:
cenros7:
grub2 -install /dev/sdaWrite the linux system program to the root boot loader to restore
centos6:
grub -install /dev/sdaWrite the linux system program to the root It can be restored under boot loader

2. Other partitions are damaged, or the file system is damaged:

Solution:

Fsck -y /dev/sda2

Fsck -y /dev/sda3

Fsck -y /dev/sda4

3. Forget the root password:
Solution:

chroot /mnt/sysimage/

echo "000000" | passwd --stdin root 或 passwd root

exit

reboot

4. The system cannot be started due to file errors.
Solution: Enter
the original file into the same path and give permission.

================================================= ================================================= ================================================= ================================================= ================================================= =============================================
Hard browsing and watching, if right You are helpful, please like it (σ゚∀゚)σ…:*☆

Guess you like

Origin blog.csdn.net/qq_26129413/article/details/112131931