There are a large variety of questions floating around the 'net from people who want to watch the output of dmesg
in real time. All the suggestions and answers involve using dmesg -w
, tail
, journalctl -f
, configuring systemd and/or syslog to output dmesg info to a specific console, etc.
I'm stuck in an unusual situation: I too need to view dmesg (kernel debug) output in real time, but on a machine with frozen userspace. (See details below)
If I fire up a kernel with a very barebones init=/bin/bash
, Alt+SysRq+h will print the magic SysRq help text immediately, even though no syslog or similar process is running. This example proves that the kernel can print dmesg info straight onto the screen without any sort of help from userspace.
Unfortunately, a component of my Arch Linux system is eating messages printed by the kernel before they get to the screen, even though I have console=tty1 loglevel=9
in my kernel commandline. Pressing Alt+SysRq+h while at tty1 appears to do nothing until I manually go fishing with dmesg | tail
.
(Edit:) A comment suggested using setterm
to enable messages. I was surprised to see this caused no appreciable effect.
I'm guessing systemd's journald needs reconfiguring. I have no idea where to start.
Details/context:
My laptop (an old but still useful ThinkPad T400) sometimes arbitrarily decides to lock up on resume from suspend. ACPI wakeup works, resuming video and the backlight works, the keyboard works, switching between consoles (as long as I carefully avoid the one X is on) works, even scrolling up the tty works... but userspace remains frozen.
My understanding of sleep is that...
# echo mem > /sys/power/state
(...)
t400 kernel: Freezing user space processes ... (elapsed 0.047 seconds) done.
(...)
t400 kernel: smpboot: CPU 1 is now offline
<system is asleep>
<I open the lid!>
t400 kernel: ACPI: Low-level resume complete
(...)
t400 kernel: Restarting tasks ... done.
(...)
# echo ohi
ohi
# _
...for quite a large amount of the sleep->resume process, userspace/tasks are frozen so nothing interferes with the suspend->sleep->wakeup->resume cycle.