cat /proc/kmsg
is convenient way to follow kernel messages. But the output is unreliable. Example:
< eoyfl-o-ilF ilaltssI hwflssesJ a hwbctaealatv-psL hwmmr-sg()nc-l-TtssN oeOfso-eitr()so-l-iesQ na ycso-aksae()Umutfref()so-lce-ak()Wiet_e_yr upfrc-ufrZ <6>[640655.817496] SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-tasks(I) thaw-filesystems(J) saK show-backtrace-all-active-cpus(L) show-memory-usage(M) nice-all-RT-tasks(N) powerOff show-registers(P) show-all-timers(Q) unRaw Sync show-task-states(T) Unmount force-fb(V) show-blocked-tasks(W) Write_to_dev_sysrq dump-ftrace-buffer(Z)
(I pressed Alt+Sysrq+h thrice: first time it printed broken text without newline. Second time it printed correct text. Third time it has just exited (EOF).
What am I doing wrong? How to follow kernel messages (without dependence of various sysklogd and config files and tail -f
).
Alternatively, how to use klogd to just print messages (like cat /proc/kmsg
but correct) without any syslogs or klogd: Already running
)?
/dev/kmsg
interface has been implemented, which allows multiple processes to read the kernel log without corruption, andcat /dev/kmsg
will automatically follow new entries. (util-linux 2.22 also implementsdmesg --follow
.)