- Advertisement -
VPS House Servers
VPS House Servers
VPS House Servers

The Linux system boots so fast that most of the output scrolls by too quickly to read the text (showing services being started) sent to the console. Therefore observing boot issues/errors becomes a little of a challenge for us.

In this article, we will briefly explain the different stages in a Linux system boot process, then learn how to establish and get to the bottom of boot issues: in terms files to look into or commands to view system boot messages.

Summary Of Linux Boot Process

In summary, once we press the Power On button, the BIOS (Basic Input Output System) a program integrated in a motherboard performs a POST (Power on Self Test) – where hardware such as disks, RAM (Random Access Memory), keyboard, etc are scanned. In case of an error (missing/malfunctioning hardware), it is reported on the screen.

During POST, the BIOS also looks for the boot device, the disk to stat up from (usually the first hard disk, however we may configure it to be a DVD, USB, Network Card etc instead).

Then the system will connect to the disk and search for the Master Boot Record (512 bytes in size) which stores the boot loader (446 bytes in size) and the rest of the space stores info about disk partitions (four maximum) and the MBR itself.

The boot loader will identify and point to, as well as load the Kernel and the initrd file (initialization ram disk – provides the kernel access to the mounted root filesystem and modules/drivers stored in /lib directory), which are generally stored in the /boot directory of the filesystem.

After the kernel is loaded, it executes init (or systemd on newer Linux distros), the first process with PID 1, which in turn starts all other processes on the system. It is also the last process to be executed on system shutdown.

How to Find Out Linux Boot Issues or Error Messages

As we mentioned before, the Linux boot processes happens rapidly that we can’t even clearly read most of the output sent to the console.

- Advertisement -
VPS House Cloud Servers
VPS House Cloud Servers
VPS House Cloud Servers

So taking note of boot issues/errors calls for a system administrator to look into certain important files in conjunction with particular commands. And these include:

/var/log/boot.log – Logs System Boot Messages

This is probably the first file you want to look into, to view all that unfolded during the system boot.

Rather than trying so hard to follow the output on the screen during boot, we can view this file after the boot process has completed to assist us in determining and resolving boot issues/errors.

We use the cat command for that purpose as follows (below is a sample of this file):

From the output above, we can see that there is a boot issues indicated by the lines below.

Issue: Problem with the swap partition; the system either failed to read the swap file/device/partition or it’s not present.

Let’s check if the system is using swap space with free command.

We can resolve this issue, by creating a swap space in Linux.

Note: The content of this file is cleared at system shutdown: new data is stored in it on a new boot.

/var/log/messages – General System Logs

This file stores general system messages, including the messages that are logged during system boot.

To view it, type:

Because this file may be relatively lengthy, we can view it in pages use the more command (which even shows a percentage) like this.

The contents of /var/log/messages unlike the previous file is not cleared shutdown because it does not only contain boot messages but messages concerning other system activities as well. So older files are compressed and kept on the system for later inspection as shown below.

dmesg – Shows Kernel Messages

The dmesg command can show operations once the boot process has completed, such as command line options passed to the kernel; hardware components detected, events when a new USB device is added, or errors like NIC (Network Interface Card) failure and the drivers report no link activity detected on the network and so much more.

journalctl – Query Contents of Systemd Journal

This is useful in most current Linux distros using systemd: the newest system and service manager. Under it, system logging is done via the journal component – a centralized location for all messages logged by different components.

These messages include kernel and boot messages; messages from syslog or various services. We can use it to review boot messages and establish boot issues by reading through the output and identifying lines of interest (errors pointed out by red lines depending on terminal text color settings).

The above is a sample of the command output showing an error we already identified by viewing /var/log/boot.log: the swap partition error. To view more output lines, simply press [Enter] button.


- Advertisement -

There are no comments yet

  • Hello, guest