8

How can I know what keys will invoke the magic SysRq key? Provided I am in front of a Linux machine which is not frozen (yet). I need something easier than trying all common combinations of magic SysRq key to discover if it's working.

8

The magic SysRq key itself is AltSysRq or AltPrint Screen on PCs, which is in turn combined with a third key (letter), indicating some specific action.

The short version is that, at a console, AltSysRqSpace will display the available shortcuts (thanks to Josip Rodin for pointing that out).

The magic SysRq key, if enabled, is controlled by /proc/sys/kernel/sysrq; you can determine if it's enabled and what functions are allowed by running

cat /proc/sys/kernel/sysrq

If this complains that there's no such file or directory, then magic SysRq isn't enabled at all. Otherwise it will show a number which determines the available functions:

  • 0: disable SysRq completely
  • 1: enable all functions
  • any other value is a bitmask of allowed functions:
    • 2: control console logging level
    • 4: control keyboard
    • 8: process debug dumping
    • 16: sync
    • 32: read-only remounts
    • 64: process signalling
    • 128: reboot/power-off
    • 256: nicing of all RT tasks

If the system is operational as far as having a working root shell, you can also invoke a magic SysRq function by writing its letter to /proc/sysrq-trigger; e.g.

echo s > /proc/sysrq-trigger

will perform an emergency sync.

This is all detailed in the kernel documentation.

  • link is not working – Prvt_Yadv May 7 '18 at 8:12

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.