Several common reasons and solutions for Linux unable to start

Time:2021-10-26

causeLinux cannot startThere are many reasons. The following Liang Xu Xiaobian will elaborate on several common reasons and solutions, hoping to help you.

Linux学习

  1. Improper file system configuration, such as / etc / inittab file and / etc / fstab file, leads to system failure and failure to start.
  2. Illegal shutdown leads to the destruction of the root file system, that is, the destruction of the Linux root partition, and the system cannot start normally.
  3. Hardware failure, such as problems with motherboard, power supply and hard disk, makes Linux unable to start. The system boot program has problems, such as grub loss or damage, which makes the system unable to boot.

From these common faults, it can be seen that there are two main reasons why the system cannot start, namely, hardware and operating system. The hardware problems can be solved only by replacing the hardware equipment. For the problems of the operating system, although the problems may vary widely, in most cases, the system can be recovered by a relatively simple and unified method.

Next, we will give some common and common methods to solve the above problems.

1. The / etc / fstab file is missing, causing the system to fail to start

/The etc / fstab file stores information about the file system in the system. If the file is configured correctly, the system will read the file and automatically mount each partition of Linux when Linux starts; If the configuration of this file is wrong or missing, the system will not start. The specific fault phenomenon will appear starting system / logger when detecting the mount partition. After that, the system will stop starting.

To solve this problem, the first idea is to find a way to recover the information of the / etc / fstab file. If this file is recovered, the system can automatically mount each partition and start normally. Many readers may first think of switching the system to single user mode, then manually mounting the partition, and finally rebuilding the / etc / fstab file in combination with the system information.

However, this method is not feasible because the fatab file is lost, so Linux cannot mount any partition. Even if Linux can switch to single user, the system is only a read-only file system and cannot write any information to the disk.

Note that when the system is normal, the contents in the / etc / fstab file should be documented. Of course, some important configuration information in the system should also be recorded in the document, so that the correct configuration of the system can be easily known when the system is normal.

2. The root file system is corrupted, causing the system to fail to start

Ext3 file system is widely used under Linux. Ext 3 is a log file system with logging function, which can carry out simple fault tolerance and recovery. However, in an ext 3 file system with high load reading and writing, if a power failure occurs suddenly, the internal structure of the file system is likely to be inconsistent, resulting in the destruction of the file system.

When Linux starts, it will automatically analyze and check the system partition. If a simple error is found in the file system, it will be repaired automatically; If the file system is seriously damaged and the system cannot complete the repair, it will automatically enter the single user mode or an interactive interface will appear to prompt the user to repair manually. The prompt code is as follows:

checking root filesystem
/dev/sdb5 contains a file system with errors, check forced
/dev/sdb5:
Unattached inode 68338812
/dev/sdb5: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
(i.e., without -a or -p options)
FAILED
/contains a file system with errors check forced
an eror occurred during the file system check
****dropping you to a Shell;the system will reboot
****when you leave the Shell
Press enter for maintenance
(or type Control-D to continue):
give root password for maintenance

It can be seen from this error that there is a problem with the file system in the root partition of the system. The system cannot be repaired automatically at startup, and then enters an interactive interface to prompt the user to repair the system.

The probability of this problem is very high. The main reason for this problem is that the system suddenly loses power, resulting in inconsistent file system structure. Generally, the solution to this problem is to use the fsck command for forced repair.

According to the above error prompt, the system will restart automatically after pressing the control + D shortcut key. Enter the root password and enter the system repair mode. In the repair mode, you can execute the fsck command. The specific operation process commands are as follows:

[[email protected] /]#umount /dev/sdb5
[[email protected] /]#fsck .ext 3 -y /dev/sdb5
e2fsck 1.39 (29-May-2006)
/ contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Inode 6833812 ref count is 2, should be 1. Fix? yes
Unattached inode 6833812
Connect to /lost+found? yes
Inode 6833812 ref count is 2, should be 1. Fix? yes
Pass 5: Checking group summary information
Block bitmap differences: -(519–529) -9273
Fix? yes

3. Boot and file system troubleshooting

If Linux cannot be started normally, the troubleshooting steps are as follows:

  1. Check whether there is a problem with the boot manager. Grub is used as the default boot manager in rhel4 or above (including Oracle Linux).

  2. If there is no problem with the boot manager, check whether the correct kernel is loaded.

  3. If a panic error occurs during startup, the root directory is not mounted successfully. At this time, check the configuration in the / SBIN / init and / etc / inittab system files for errors, and check the root directory for damage.

    Although the above steps seem very simple, there are often differences between ideal and reality, and it is not so simple to do it. However, Linux is a very robust operating system, and there are few accidents in the normal working state. It is reasonable to have an accident occasionally. At this time, it reflects the importance of being a system administrator.

    File system failure is usually caused by file damage caused by system crash (such as sudden power failure) or abnormal shutdown. When a file system fails, the steps for file system repair are as follows:

    • Unmount the problematic file system using the umount command.
    • Use the fsck – y command to test and repair the file system.
    • After the file system is repaired successfully, use the mount command to mount the file system again.

    Next, we will demonstrate the above operation of repairing file system faults through examples. In Figure 1, DF command lists the file systems mounted on the current system.

    [example 1] view the mount command. The command is as follows:

    [[email protected] ~ ]# df -h

    [example 2] use of umount / oradata command. The command is as follows:

    [[email protected] ~ ]# umount /oradata

After the umount / oradata command is executed, the system will not give any information, so we need to use the DF command to re list all the suspended file systems on the current system to confirm that the / oradata file system has been uninstalled.

After confirming that the / oradata file system has been successfully unmounted, you can use the fsck command with the – y option in example 3 to detect and repair the / dev / md0 file system.

[example 3] fsck -y / dev / md0 repairs the system. The command is as follows:

[[email protected] ~ ]# fsck -y /dev/md0

When you enter this command, you can confirm that the / dev / md0 file system has been repaired successfully. Next, we can use the mount command in example 4 to remount the file / dev / md0 to the / oradata directory.

[example 4] complete the repair operation. The command is as follows:

[[email protected] ~ ]# mount /dev/md0 /oradata

Through the above command, you can complete the repair of the file system.

The above isLiangxu tutorial networkShared several common reasons and solutions for Linux failure to start.

This article is composed of blog one article multi posting platformOpenWriterelease!