Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

How to Analyze System Boot Logs in Linux

Published

LinuxSystem Administration

System boot logs provide a comprehensive record of the Linux startup sequence. By examining these logs, you gain insight into hardware detection, driver initialization, service startup, and any errors or delays that occur from power-on to your login screen. Effective analysis of boot logs is essential for troubleshooting, performance tuning, and maintaining the overall health of your systems. This in-depth guide covers where to find boot logs, how to interpret entries, practical troubleshooting techniques, and best practices for both manual and automated analysis.

Prerequisites

  • Access to a Linux system’s terminal
  • Administrative (sudo) privileges for reading system logs
  • Familiarity with basic command-line tools
  • Understanding of your Linux distribution’s init system (systemd, SysVinit, or Upstart)

Overview of the Linux Boot Process

The Linux boot process involves several distinct stages:

  • BIOS/UEFI Initialization: The firmware tests hardware and loads the bootloader from disk.
  • Bootloader Stage: The bootloader (such as GRUB) loads the kernel and, if configured, an initial RAM filesystem (initramfs).
  • Kernel Startup: The kernel initializes hardware, mounts the root filesystem, and starts the init system.
  • Init System Launch: The init system (systemd, SysVinit, or Upstart) starts user-space services, mounts filesystems, and configures the environment.
  • User Login: The system displays a login prompt or graphical environment.

Each stage generates messages that are logged in various locations. By reviewing these logs, you can pinpoint performance bottlenecks, configuration errors, or hardware issues.

Where to Find Boot Logs

systemd-based Systems

Most modern Linux distributions-including Ubuntu (16.04+), Debian (8+), CentOS (7+), Fedora (15+), and Arch Linux-use systemd as the init system. systemd maintains a binary log called the journal.

Use journalctl to access, filter, and analyze these logs.

Traditional Log Files

Older or non-systemd distributions may rely on classic log files written in /var/log/:

  • /var/log/boot.log – Boot process output
  • /var/log/messages or /var/log/syslog – Daemon, kernel, and general system events
  • /var/log/dmesg – Kernel boot messages
  • /var/log/rc.log – Service startup (in some distributions)

The Kernel Ring Buffer: Use dmesg to display kernel messages recorded during and after boot. Some messages are overwritten as the buffer fills, so review them soon after startup.

Analyzing Boot Logs with systemd (journalctl)

Viewing Current Boot Logs

To display all messages from the current boot:

$ journalctl -b

This provides a chronological view of kernel, init, and service messages.

Examining Previous Boots

List previous boots, each with a unique boot ID and index:

$ journalctl --list-boots

Display logs from the previous boot (index -1):

$ journalctl -b -1

Filtering Log Levels

Show only warnings and errors:

$ journalctl -b -p warning
$ journalctl -b -p err

Log priorities, in order of severity:
emerg, alert, crit, err, warning, notice, info, debug

Focusing on a Specific Service or Unit

Display logs for a single service (such as NetworkManager):

$ journalctl -u NetworkManager

Or, combine boot and service filtering:

$ journalctl -b -u sshd

Searching for Keywords

Find messages related to a specific term (such as “failed”):

$ journalctl -b | grep -i failed

Using dmesg and Classic Log Files

Kernel Messages with dmesg

dmesg displays kernel messages, which are vital for analyzing hardware initialization and driver loading.

$ dmesg

Filter for errors or warnings:

$ dmesg | grep -i error
$ dmesg | grep -i fail
$ dmesg | grep -i warn

Reviewing /var/log/boot.log and Other Files

View the first or last 100 lines:

$ sudo head -n 100 /var/log/boot.log
$ sudo tail -n 100 /var/log/boot.log

Search for errors:

$ grep -i error /var/log/boot.log

Persistent Logging for systemd

By default, systemd’s journal may store logs in memory. To enable persistent logging:

$ sudo mkdir -p /var/log/journal
$ sudo systemctl restart systemd-journald

Understanding Boot Log Output

Common Message Types

  • Started/OK: Service or unit started successfully.
  • FAILED: Service or unit failed to start.
  • Dependency Issues: Services waiting for other dependencies.
  • Timeouts: Services taking too long to start.
  • Kernel Panics or OOPS: Indicate severe errors in kernel or drivers.
  • Hardware Errors: Problems with devices, drivers, or storage.

Typical Boot Log Example:

[    1.234567] systemd[1]: Starting Network Service...
[    2.012345] systemd[1]: Started Network Service.
[    2.678910] systemd[1]: Failed to start Bluetooth service.
[    3.135790] EXT4-fs (sda1): mounted filesystem with ordered data mode.

Diagnosing Slow Boots

Analyzing Boot Time

View total boot time:

$ systemd-analyze
  Output example: Startup finished in 2.345s (kernel) + 8.123s (userspace) = 10.468s graphical.target reached after 9.999s in userspace.

List services by startup duration:

$ systemd-analyze blame

The output ranks services by time taken to start, with the slowest at the top.

Visualize service dependencies and delays:

$ systemd-analyze critical-chain

Common Causes of Slow Boot

  • Hardware detection/initialization problems
  • Filesystem checks on large or unclean disks
  • Delays waiting for network or remote filesystems (NFS)
  • Services stuck or failing to start

Remedies

  • Disable unnecessary services:
    $ sudo systemctl disable servicename
  • Mask misbehaving or unused services:
    $ sudo systemctl mask servicename
  • Optimize hardware settings in BIOS/UEFI
  • Investigate and resolve hardware errors

Troubleshooting Service Failures

Identifying Failed Services

List failed units:

$ systemctl --failed

Examine logs for a failed service:

$ journalctl -u servicename
 Or, for a specific boot:
$ journalctl -b -u servicename

Check for dependency or configuration errors. Read the error and warning messages leading up to the failure.

Hardware and Driver Issues

Detecting Problems

Kernel logs (dmesg or journalctl -k) often contain detailed information about hardware initialization.

Look for lines mentioning failed device detection, missing firmware, or driver errors.

Examples:

[    0.567890] ata1: failed to identify (I/O error, err_mask=0x1)
[    1.234567] iwlwifi 0000:03:00.0: Firmware not running - cannot start

Solutions

  • Update the kernel or device drivers.
  • Ensure firmware files are present and up to date.
  • Test and replace failing hardware components as needed.

Analyzing Security and Audit Messages

Boot logs may also include evidence of unauthorized changes, disabled security features, or failed logins.

Look for unexpected service starts, SELinux/AppArmor denials, or sudo failures.

Monitor for new users, changed permissions, or altered binaries.

Best Practices for Boot Log Analysis

  • Regular Monitoring: Review boot logs after updates, hardware changes, or unexplained crashes.
  • Persistent Logging: Enable persistent logs in systemd for historical analysis.
  • Automate Monitoring: Use log monitoring tools (Logwatch, rsyslog, ELK Stack) to alert on critical boot-time errors.
  • Document Changes: Keep records of system modifications to correlate with new messages or errors.
  • Backup Logs: Archive logs before and after major changes or troubleshooting sessions.
  • Limit Log Size: Configure log rotation to prevent disk space exhaustion.

Advanced Analysis Techniques

Custom Filters and Scripts

You can write scripts to extract, summarize, or alert on specific boot log entries. Example: Extract all critical errors from the last boot:

$ journalctl -b -p crit

Graphical Tools

Some distributions and desktop environments offer graphical log viewers (e.g., GNOME Logs) for easier inspection and filtering.

Remote Log Collection

Aggregate boot logs from multiple systems using centralized logging solutions like Graylog, ELK, or rsyslog, which facilitates trend analysis and rapid incident response in large environments.

Common Boot Log Issues and Remedies

  • “Failed to Mount /” or “Failed to Mount /home”
    Possible disk, partition, or filesystem errors. Boot into rescue mode, check filesystems with fsck, and review /etc/fstab for misconfigurations.
  • “A Start Job Is Running for…”
    Service or device is waiting for a dependency or hardware event. Review logs for timeouts, hardware errors, or missing devices.
  • “Dependency Failed…”
    One service cannot start because another (required) service failed. Investigate the root cause by tracing dependencies in logs and with systemctl list-dependencies servicename.
  • Kernel Panic or OOPS
    Severe hardware, driver, or kernel bug. Examine logs and update or roll back the kernel as needed.

Example Workflow: Diagnosing a Slow Boot

  • Run systemd-analyze and systemd-analyze blame to identify delays.
  • Use journalctl -b to review messages during the delayed period.
  • Filter for errors and warnings.
  • Disable or optimize services responsible for slow startup.
  • Reboot and compare boot times.

Conclusion

Mastering boot log analysis empowers you to maintain efficient, reliable, and secure Linux systems. By using tools such as journalctl, dmesg, and traditional log files, you can quickly identify the root cause of boot delays, hardware problems, and service failures. Implement systematic log review and automated monitoring to stay ahead of issues and ensure smooth system operation.

[!NOTE] For complex or persistent boot issues, consult your distribution’s documentation, hardware vendor resources, or seek help from the open-source community.

Related guides

Account services are unavailable until the production backend is configured.