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 (using
smartctl
Detection).
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 menu
e
Edit 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 startup
debug
orrescue
Mode, 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, add
single
orinit=/bin/bash
。 -
File system check:
use
fsck
Repair potentially corrupted file systems.
fsck /dev/sdXn
-
Check disk mount issues:
if
/etc/fstab
In configuration errors may cause startup to hang. Suspicious mounts can be temporarily commented.
4. System service troubleshooting
-
View the startup log:
use
journalctl
Check the system log and locate specific services that are slow or failed to start.
journalctl -b
-
Analysis startup time:
use
systemd-analyze
Check the total time to start.
systemd-analyze
use
systemd-analyze blame
Find 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 (
dmesg
View 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.
quiet
、nomodeset
、nosplash
wait.
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:use
iotop
oriostat
Check disk IO load.- Installation tool:
yum install sysstat -y
run:
iostat -x
-
Too many file fragments:
Regularly clean temporary file directories
/tmp
and/var/tmp
。
8. Troubleshoot the startup script
-
View the startup process output:
Remove the startup parameters
quiet
, let the kernel print the detailed startup log. -
Step by step to enable the service:
use
systemctl
Start 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/messages
or/var/log/syslog
System startup log:
journalctl -b
-
Key Error Troubleshooting:
Search for errors or timeout keywords (e.g.
error
、failed
、timeout
)。
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!