Monday, March 16, 2020

How to completely disable boot or startup messages?



Yes, there are situations where we’d get to see such requirements. So, a system should not show any boot or kernel or any messages whatsoever when booting and it should simply trigger/show the final GUI or CLI login screen. That is right. Sometimes it would be required to create such a system. In most recent versions of systemd based systems this could be achieved by nullifying systemd boot logs along with other options. Lets see how to get this done.


Demo Setup 

System Type: Virtual system running on Oracle VirtualBox.
System release: CentOS8.1
Systemd version: systemd239



A little information about bootup messages 

Let’s understand the different types of messages/information that we get to see when a system boots up in a standard setup. This could be  broadly classified into the following categories: 

→ GRUB messages
→ systemd messages
→ rsyslogd (system logger daemon) messages
→ plymouth messages


GRUB Messages

The GRUB and its related messages/information are seen initially after the stage1 bootloader phase. These messages are normally displayed/shown in a standard/default configuration based system. Its purpose is to help a user to interrupt this stage2 loading phase and pass any parameters required to boot the system. Mainly, I found the below GRUB parameters are enough to suppress these messages: 

GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT_QUIET=true

GRUB_TIMEOUT: This is the counter in seconds for which the system waits for and then continues with default selection. If any key is pressed in this timeframe then the system halts and shows up the available/installed kernel versions. Also, this allows a user to pass additional parameters which could override the actual configuration when booting. The default grub_timeout is '5'. This could be set to '0' to boot immediately without displaying the menu, or to '-1' to wait indefinitely.

GRUB_TIMEOUT_STYLE: If this option is unset or set to ‘menu’, then GRUB will display the menu and then wait for the timeout set by ‘GRUB_TIMEOUT’ to expire before booting the default entry. Pressing a key interrupts the timeout. If this option is set to ‘countdown’ or ‘hidden’, then, before displaying the menu, GRUB will wait for the timeout set by ‘GRUB_TIMEOUT’ to expire.

GRUB_HIDDEN_TIMEOUT_QUIET: In conjunction with ‘GRUB_HIDDEN_TIMEOUT’, set this to ‘true’ to suppress the verbose countdown while waiting for a key to be pressed before displaying the menu.


systemd messages

In order to suppress the systemd logs while system is booting the following parameters could be used:

systemd.log_level=0 systemd.show_status=0


rsyslogd messages

To suppress the syslogd related messages while system is booting, set the below parameter:

--log-level=0

plymouth messages

Plymouth is a graphical boot system and logger which makes use of the kernel-based mode setting (KMS) and Direct Rendering Manager (DRM). Plymouth also handles user interaction during boot. To suppress the plymouth related messages while booting, the following parameter could be added to grub configuration file: 

rd.plymouth=0 plymouth.enable=0


Let’s configure /etc/default/grub now 

Now, we need to add all these parameters in ‘/etc/default/grub’ file. This has to be added to the line “GRUB_CMDLINE_LINUX_DEFAULT”. In addition, I need to add GRUB_TIMEOUT arguments as well. Let's go ahead and make the changes and see how it works.

→ file before configuration changes:


→ file after configuration changes:



So, basically I’ve added these lines additionally to the original ‘/etc/default/grub’ file:

GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT_QUIET=true

GRUB_CMDLINE_LINUX_DEFAULT="rhgb quiet rd.plymouth=0 plymouth.enable=0 --log-level=0 systemd.log_level=0 systemd.show_status=0"

NOTE: If “rhgb quiet” was not there in the “GRUB_CMDLINE_LINUX” then need to get this also added to the default line as shown above. It is always a good practice to make a backup of configuration files before making any changes so that it could be referred and reverted if something doesn’t work as expected. 

Once those changes are set as defined, need to run the command “grub2-mkconfig” to get the changes incorporated into the “grub.cfg” file as shown below: 



Also, verify if the changes are set in the default boot stanza of “grub.cfg” by executing a grep command as dictated. 

Now, we are all set. So, lets reboot the system and test. The system after reboot would not show-up any messages whatsoever on boot and would silently come up to the login screen. 


Please remember that this way of making a system to boot does work as long as there are no issues in booting, but if there are any corruptions then the system would not show up any messages. So, in such cases the user needs to get into rescue mode to fix any such issues.

References: https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html

No comments: