Inspect bootloader logs in dmesg
In the previous steps, we looked at the GRUB configuration files. Now, let's examine the messages generated by the kernel during the boot process. These messages are stored in a buffer and can be viewed using the dmesg
command.
dmesg
(diagnostic message buffer) is a command that prints the message buffer of the kernel. It contains information about hardware devices, device drivers, and other kernel-related messages that are generated during system startup. This is a valuable tool for troubleshooting boot issues.
Type the following command in your terminal and press Enter:
dmesg
This will output a large amount of text, showing all the kernel messages since the system started. The output can be overwhelming, so it's common to filter it or pipe it to a pager like less
to view it screen by screen.
To see messages specifically related to the bootloader or early boot process, you can often look for keywords like "GRUB", "boot", or "kernel command line".
Let's try filtering the output using grep
to find lines containing "Command line":
dmesg | grep "Command line"
The |
symbol is called a pipe. It takes the output of the command on the left (dmesg
) and sends it as input to the command on the right (grep
). grep
is a powerful tool for searching text patterns. In this case, we are searching for lines that contain the phrase "Command line".
You should see output similar to this, showing the kernel command line parameters passed by the bootloader:
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-... root=UUID=... ro quiet splash
This line shows the kernel image being booted (/boot/vmlinuz-...
) and the kernel parameters (root=UUID=... ro quiet splash
). These parameters are often set in the /etc/default/grub
file we saw in the previous step.
Exploring dmesg
is essential for diagnosing problems that occur during the boot process, as it provides detailed information about what the kernel is doing from the very beginning.
Click Continue to complete this lab.