R.A. Epigonos et al.

[linux] 起動時のカーネル及びinitシステムメッセージをコンソールに表示。

画面とシリアルコンソールが両方使える環境で、それらの両方にカーネルおよびinitシステムメッセージを表示したい。

まずは状況調査。さくらVPSのDebianシステムでは以下のような設定ファイル。console=tty0 console=ttyS0,115200n8r のようにした場合、カーネルメッセージはtty0 (画面)とttyS0 (シリアルコンソール)の両方に表示されるが、initシステムメッセージは tty0 (画面) だけに表示される。ここで、

$ grep --invert-match --regexp '^$' --regexp '#' /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8r"
GRUB_CMDLINE_LINUX=""

カーネルバッファにメッセージを送信して、dmesg で表示する。tty0には表示されるが、ttyS0には表示されない。

# echo 'send message to kernel, now!' > /dev/kmsg
$ dmesg --notime --decode | tail --lines 1
user  :warn  : send message to kernel, now!

ログデーモンにメッセージを送信して、表示する。メッセージ送信は root 権限がいらない。tty0にもttyS0にも表示されない。

$ logger --tag test 'send message to syslogd, now!'
# tail --lines 1 /var/log/syslog
*** ** **:**:** **************** test: send message to syslogd, now!
ステップ tty0 ttyS0
画面 シリアルコンソール
起動時 SeaBIOS と gPXE ブートメッセージ OK NG
GRUB 画面表示 OK NG
カーネルメッセージ OK OK
init システム (systemd) メッセージ ([OK], fsck) NG OK
ログインプロンプト OK OK
終了時 init システム (systemd) メッセージ ([OK], fsck) NG OK
カーネルメッセージ OK OK

リファレンス

  1. Configure Linux kernel
  2. System and Administrative Commands
  3. grub serial console kernel message - Google 検索
  4. systemd message serial console - Google 検索
  5. How to get systemd boot messages on serial console and screen?
  6. How to get kernel messages on serial console on a systemd system? - Unix & Linux Stack Exchange
  7. RFE: automatically send boot messages to multiple console= · Issue #2079 · systemd/systemd · GitHub
  8. linux - How to add message that will be read with dmesg? - Server Fault

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2008-02-18T11:20:05+09:00
  2. Modified: 2008-02-18T11:20:05+09:00
  3. Generated: 2023-08-27T23:09:11+09:00