Boot Failures
Diagnosing Boot Failures with Systemd¶
Boot failures in Linux systems often stem from systemd services failing to start during the initramfs or kernel boot process. Systemd provides robust tools to diagnose these issues, primarily through journal logs and service status checks. This section guides you through systematic troubleshooting steps to identify and resolve root causes.
Accessing Journal Logs for Boot Analysis¶
The systemd journal is the primary source of information for boot failures. Use journalctl to inspect logs from the current or previous boot:
This command displays logs from the last boot. To focus on critical errors, filter with --since and --until:
Look for entries with ERR, CRIT, or PANIC severity. For example, a failed service might show:
Checking Service Status and Dependencies¶
If a service fails to start, use systemctl to investigate its status:
This lists all failed units. For detailed diagnostics, check the status of a specific service:
For example, a failed networking service might reveal:
Use journalctl again with the service name to drill down:
Analyzing Unit Files and Dependencies¶
Corrupted or misconfigured unit files can cause boot failures. Inspect a service's unit file with:
Check for syntax errors, incorrect paths, or missing dependencies. For example, a typo in a ExecStart path might prevent the service from launching.
Verify dependencies using systemctl:
Ensure all required services are enabled and configured correctly.
Checking Kernel and Initramfs Messages¶
Some boot failures originate from the kernel or initramfs. Use dmesg to inspect kernel ring buffer messages:
This can reveal issues like missing kernel modules or hardware detection errors. For initramfs-related problems, rebuild it with:
Troubleshooting with Rescue Mode¶
If the system fails to boot entirely, boot into rescue mode using a Live CD or GRUB's rescue option. Mount the root filesystem and chroot into it:
From here, you can manually inspect logs, repair configuration files, or reconfigure services.
Common Pitfalls and Solutions¶
- Missing Dependencies: Ensure all required packages are installed. Use
apt --fix-broken install(Debian/Ubuntu) ordnf reinstall <package>(Fedora). - Configuration Errors: Check
/etc/systemd/system/*.servicefiles for syntax errors withsystemctl daemon-reload. - Conflicting Services: Resolve conflicts by disabling redundant services with
systemctl disable <service>.
Key takeaways¶
- Use
journalctl -bto analyze boot logs and identify critical errors. - Check failed services with
systemctl list-units --state=failedand inspect their logs. - Validate unit files for syntax and dependency issues.
- Combine
dmesgandjournalctlto diagnose kernel or initramfs-related failures. - Boot into rescue mode to repair systems that fail to start normally.