Linux: Print all messages to primary console *and* secondary console (monitor/KVM)

consolefsckipmilinuxremote-access

I run Linux (Red Hat-based, CentOS, SL, versions 5 & 6) on a variety of Supermicro and other whitebox servers. Some have IPMI, some do not.

Some of these systems are attached to a Keyboard/monitor (KVM) console switch. Other systems are attached to a remote serial console. And newer servers are hooked into IPMI, and are available via either KVM-over-LAN Console Redirection or Serial over LAN (SOL).

With all of these methods we'd like to see consistent output on all of the serial console and on the KVM screens. For example, we want the ability to interact with the system from startup to shutdown, and we want to see the entire boot sequence. This includes seeing any messages printed by, and interacting with:

  1. The BIOS (This is handled by the BIOS console redirection in many modern BIOSes, and is independent from the Operating System)
  2. The bootloader (Grub 0.97, in this case)
  3. See messages printed by the kernel
  4. See messages printed by fsck, such as during lengthy fscks of large filesystems. On a system with a serial console, sometimes fsck is sitting there doing nothing, waiting for a Sysadmin to type in a password. But the sysadmin may not see this password prompt unless we happen to remember to log into the serial console.
  5. See messages printed by programs during the startup session
    • (e.g. Starting sshd: [ FAILED ] typo in sshd_config on line 171)
  6. The login: prompt , and allow me to log into the system.

I've tried a few methods, but it seems that no matter what I put in grub.conf, some messages are printed to either the monitor or the serial console, but not both.

Is it possible to tell the bootloader, Linux kernel, OS, etc. to print all messages to the attached monitor and too the serial console?

Best Answer

I've tried a few methods, but it seems that no matter what I put in grub.conf, some messages are printed to either the monitor or the serial console, but not both.

In theory, you can use multiple console= options in the grub.conf to make the Linux kernel output to all console when possible, something like this:

title CentOS (2.6.18-194.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb console=tty0 console=ttyS0,9600n8 
    initrd /initrd-2.6.18-194.el5.img

But in fact, according to the Serial Console HOWTO, messages from init and syslog only appear on the last listed console device.