How to change the verbosity of debug logs during booting CentOS / RHEL 7?

Removing the rhgb and the quiet kernel command-line parameters, either by editing the /boot/grub/grub.conf file or by using the grub editing mode during boot. Replace these parameters with loglevel and systemd.log_level=debug parameter. This change is generally sufficient to provide as much data as is needed to debug a boot failure.

 

The option rhgb is used for graphical boot-up and the quiet option eliminates most of the boot messages.

 

what loglevels are available

 

Removing rhgb quiet attributes, increases the verbosity of the boot messages. But if you want to fine-tune the level of verbosity you have to use the below loglevels.

 

loglevel = All Kernel Messages with a loglevel smaller than the console loglevel will be printed to the console. It can also be changed with klogd or other programs. The loglevels are defined as follows:

0 (KERN_EMERG) system is unusable
1 (KERN_ALERT) action must be taken immediately
2 (KERN_CRIT) critical conditions
3 (KERN_ERR) error conditions
4 (KERN_WARNING) warning conditions
5 (KERN_NOTICE) normal but significant condition
6 (KERN_INFO) informational
7 (KERN_DEBUG) debug-level messages

 

NOTE: By removing the rhgb quiet attributes increase the verbosity of the boot logs but with the help of loglevel= attribute you can have complete control over what exact level of logs you want to see during boot.

 

Change verbosity of booting logs from GRUB command line

 

We can change the GRUB parameters during the boot from the GRUB command line. Note that this is not permanent and usually the preferred way to do.

 

1. To do this, restart the system and when the GRUB splash screen comes. Select/highlight the kernel you wish to boot using the up/down arrow keys. In my case, I have only one kernel to select

 

2. Press the e key to edit the entry. Select/highlight the line starting with the word kernel.

 

3. Press the e key to edit the line. Remove the arguments rhgb quiet and add the arguments loglevel=7 and systemd.log_level=debug instead to change the verbosity to highest level. Press CTRL+x to accept the changes and boot the system. You should see a lot of logs on you screen now.

 

Increase verbosity of boot messages persistently across reboots

 

Edit the file /etc/default/grub and remove the rhgb and quiet arguments from the kernel lines and and the parameters loglevel=7 and systemd.log_level=debug instead. It is not recommended to edit the /boot/grub2/grub.cf file directly. Instead you can use the grub2-mkconfig command to generate grub.cfg. This command uses the template scripts in /etc/grub.d and menu-configuration settings taken from /etc/default/grub when generating grub.cfg.

 

Before (/etc/default/grub) :

linux16 /vmlinuz-3.10.0-514.el7.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet LANG=en_US.UTF-8 

 

After (/etc/default/grub):

linux16 /vmlinuz-3.10.0-514.el7.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap LANG=en_US.UTF-8 loglevel=7 systemd.log_level=debug 

 

Afterwards run below command:

# grub2-mkconfig -o /boot/grub2/grub.cfg 

 

And reboot the box to see more useful messages during boot and as well systemd debug messages. Once these options have been removed from the grub.conf, during future restarts the rhgb progress screen will be disabled, and the verbose boot messages will be displayed.

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)