Skip to content

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:

journalctl -b

This command displays logs from the last boot. To focus on critical errors, filter with --since and --until:

journalctl -b --since "07:00:00" --until "07:10:00"

Look for entries with ERR, CRIT, or PANIC severity. For example, a failed service might show:

Failed to start Network Manager: Unit network-manager.service not found.

Checking Service Status and Dependencies

If a service fails to start, use systemctl to investigate its status:

systemctl list-units --state=failed

This lists all failed units. For detailed diagnostics, check the status of a specific service:

systemctl status <service-name>

For example, a failed networking service might reveal:

Failed with result 'exit-code'. See system journal for details.

Use journalctl again with the service name to drill down:

journalctl -u <service-name>

Analyzing Unit Files and Dependencies

Corrupted or misconfigured unit files can cause boot failures. Inspect a service's unit file with:

systemctl cat <service-name>

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:

systemctl list-dependencies <service-name>

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:

dmesg | grep -i error

This can reveal issues like missing kernel modules or hardware detection errors. For initramfs-related problems, rebuild it with:

mkinitramfs -o /boot/initramfs-linux.img

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:

mount /dev/sdXn /mnt
chroot /mnt

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) or dnf reinstall <package> (Fedora).
  • Configuration Errors: Check /etc/systemd/system/*.service files for syntax errors with systemctl daemon-reload.
  • Conflicting Services: Resolve conflicts by disabling redundant services with systemctl disable <service>.

Key takeaways

  • Use journalctl -b to analyze boot logs and identify critical errors.
  • Check failed services with systemctl list-units --state=failed and inspect their logs.
  • Validate unit files for syntax and dependency issues.
  • Combine dmesg and journalctl to diagnose kernel or initramfs-related failures.
  • Boot into rescue mode to repair systems that fail to start normally.