SoFunction
Updated on 2025-03-04

Troubleshooting methods for slow startup or unbootable Linux system

1. Hardware inspection

  • Confirm the hardware status:

    Check whether the hard disk, memory, CPU, etc. are normal, especially if there are bad channels on the hard disk (usingsmartctlDetection).

smartctl -a /dev/sdX
  • Unplug external devices:

    Remove excess external devices (such as USB devices) to exclude external hardware.

  • Check the hard disk interface:

    Confirm the interface mode of the hard disk in the BIOS/UEFI settings (such as AHCI).

2. GRUB stage

  • Check the GRUB configuration file:

    Press on the Startup menueEdit the startup item to confirm whether the boot parameters are correct (such as root partition, kernel version, etc.).

  • Boot log view:

    Added in GRUB at startupdebugorrescueMode, check whether the guidance is stuck in a certain link.

3. Single user mode startup

  • Enter single user mode:

    Edit the startup item in GRUB, addsingleorinit=/bin/bash

  • File system check:

    usefsckRepair potentially corrupted file systems.

fsck /dev/sdXn
  • Check disk mount issues:

    if/etc/fstabIn configuration errors may cause startup to hang. Suspicious mounts can be temporarily commented.

4. System service troubleshooting

  • View the startup log:

    usejournalctlCheck the system log and locate specific services that are slow or failed to start.

journalctl -b
  • Analysis startup time:

    usesystemd-analyzeCheck the total time to start.

systemd-analyze
  • usesystemd-analyze blameFind the longest-consuming service.

systemd-analyze blame
  • Disable useless services:

    Disable services that take too long or are unrelated.

systemctl  disable Service name

5. Core component inspection

  • Kernel module loading issues:

    Check whether the kernel module fails or conflicts (dmesgView kernel log).

  • Driver compatibility issues:

    Update or rollback the kernel, use a stable version.

  • Start parameter optimization:

    Optimize kernel startup parameters in GRUB configuration, e.g.quietnomodesetnosplashwait.

6. Network configuration

  • DNS or network hang:

    The network service configuration error may cause the startup to be stuck. Check/etc/and network service status.

  • Disable network service testing:

    Temporarily disable network-related services to check whether the startup is slow due to the network.

systemctldisable NetworkManager

7. File system and disk IO

  • Disk performance issues:useiotoporiostatCheck disk IO load.
    • Installation tool:
yum install sysstat -y
  • run:

iostat -x
  • Too many file fragments:

    Regularly clean temporary file directories/tmpand/var/tmp

8. Troubleshoot the startup script

  • View the startup process output:

    Remove the startup parametersquiet, let the kernel print the detailed startup log.

  • Step by step to enable the service:

    usesystemctlStart the service separately to troubleshoot which service causes the problem.

9. Log Analysis

  • Log file location:
    • Kernel log:/var/log/dmesg

    • System log:/var/log/messagesor/var/log/syslog

    • System startup log:journalctl -b

  • Key Error Troubleshooting:

    Search for errors or timeout keywords (e.g.errorfailedtimeout)。

grep -i"error" /var/log/messages

10. System recovery measures

  • Back up important data:

    Mount the disk and back up the data using LiveCD or rescue mode.

  • Reinstall the boot program:

    If GRUB is corrupted, you can reinstall it using the following command:

grub2-install /dev/sdX grub2-mkconfig -o /boot/grub2/
  • Rebuild initramfs:

    If initramfs is corrupted, you can regenerate:

dracut -f

11. Optimization suggestions

  • Simplify the startup service:

    Turn off useless services and optimize boot speed.

  • Regularly clean the system:

    Clean old logs and cache files and free up disk space.

  • Upgrade or rollback system components:

    Use stable versions of kernel, drivers, and critical services.

The above is the detailed information on the troubleshooting method for slow startup or unstarting Linux system. For more information about slow startup or unstarting Linux, please follow my other related articles!