1

I am working on BeagleboneBlack based custom board,
Recently I was debugging system hang issues, I had access to debug console using minicom, And I could enable log using key combination Ctrl+A, F `.

However all production devices won't have debug console. I won't be able to connect it to through minicom, However I will get access through ssh connection.

Now, I wanted to know if there is any way to send SysRq keys over ssh connection,

In normal working of device, if I use echo h > /proc/sysrq-trigger output is printed on the debug(or serial) console(minicom) and not on ssh.:( ,
is there any way to get this output to ssh terminal ?

I know what I am asking is somewhat like impossible as, if system locks-up ssh connection won't be alive. But just in case if connection is alive then I want to know if there is any way to send SysRq keys.

  • SysRq is actually a hardware interrupt. No local keyboard -> no SysRq. – Satō Katsura Aug 9 '16 at 7:47
  • I was under impression that if you can send break somehow, it would be possible to trigger SysRq. – AnkurTank Aug 9 '16 at 8:55
  • break has to do with the current line discipline. SysRq, like I said, is a hardware interrupt. Now, whether it's possible to send a control sequence over a serial line that has the same effect as SysRq, I don't know (I'm not that familiar with Linux). – Satō Katsura Aug 9 '16 at 9:01
3

You can't directly get the response to be shown to the ssh terminal, but the kernel's output is recorded in dmesg (and usually /var/log/messages too); so you can echo h > /proc/sysrq-trigger; dmesg | tail to see what was printed.

2

The SysRq direct function only works on the console.

On a standard "VGA" console this is the literal key SysRq (sometimes marked Print Screen) in conjunction with Alt and "command".

On a serial console this can be accessed via the BREAK signal.

However, over SSH there is no direct access to SysRq and you have to use the /proc/sysrq-trigger file instead.

The kernel documentation goes into more detail on SysRq and how different key combinations work on different platforms: https://www.kernel.org/doc/Documentation/sysrq.txt

Since SysRq output is generated by the kernel it goes into the ring buffer. This can be read by dmesg.

Also, depending on how you have set up your OS, syslog or rsyslog can direct kernel output to a file eg for rsyslog

$ModLoad imklog
kern.*    -/var/log/kernel

systemd based systems can expose this log via the journalctl command.

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.