1

I use Mint 19.2, and I try to see CPU backtrace by the following process.

    $ sudo -s
    # sysctl -w kernel.sysrq=1
    # echo l > /proc/sysrq-trigger

But, nothing happened. I researched more online and I tried the following input key check, and the response for the command was this.

    # dmesg | grep -i sysrq
    [18494.528450] sysrq: SysRq : Show backtrace of all active CPUs
    [18494.528496]  sysrq_handle_showallcpus+0x17/0x20
    [18494.528499]  __handle_sysrq+0x9f/0x170
    [18494.528502]  sysrq_filter+0x98/0x3e0

Even when I tried echo h > /proc/sysrq-trigger, the result woundn't be displayed, either. But, dmesg | grep -i sysrq replied:

[21964.365327] sysrq: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) force-fb(V) show-blocked-tasks(w) dump-ftrace-buffer(z)
enter code here

By these dmesg responses, I believe the OS, at least, recognizes a letter from echo command as a SysRq input.

How can I have the OS display a result of echo l > /proc/sysrq-trigger on the current terminal?

  • Just to be clear, what do you mean by "the current terminal"? A text-mode Linux console (ttyX)? Or a graphical terminal emulator window such as XTerm, Gnome Terminal, Konsole? – TooTea Aug 15 at 9:54
  • @TooTea, Thanks for the comment. I found I was looking for an output in totally wrong format. I thought the output would be shown in GNOME terminal... – buck_banzai 23 hours ago
0

The kernel will only display messages on the console and to the kernel message buffer, which is usually logged by syslog with facility 'kernel' and which can also be read by using dmesg.

The kernel has no concept of "the current terminal", so what you want is not possible.

  • Oh, I see. That is why... I totally understand now. I was expecting the result would be on GNOME, and I learned it was a totally wrong intention. Thanks for the explanation :) – buck_banzai 23 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.