🔧 What is the Magic SysRq Key?

  • It’s a kernel-level backdoor for system recovery, debugging, and emergency control.

  • SysRq = System Request. It’s built into the Linux kernel.

  • It allows you to send raw commands directly to the kernel, bypassing userland entirely.

  • Works even when:

    • X server is frozen

    • TTYs are locked

    • Mouse/keyboard don’t respond

    • Most of userspace is unresponsive

🧠 It does not require any running process — it interacts with the kernel directly.


⌨️ Where Is the SysRq Key?

  • On most keyboards, it’s shared with the Print Screen key.

  • To use it, you usually hold:

Alt + SysRq (aka PrtSc) + [Command key]
  • On laptops you might also need Fn to access it.

🧪 How It Works

SysRq commands are sent via:

Alt + SysRq + [command character]

The kernel listens for these key combos and performs hardcoded actions. It works as long as:

  • The kernel is not totally dead (e.g., a hardware hang or kernel panic might block it).

  • /proc/sys/kernel/sysrq is enabled.


✅ What is REISUO?

It’s a safe shutdown sequence using Magic SysRq:

KeyMeaningAction
RRawTake back control from userland (e.g., X)
ETerminateSend SIGTERM to all processes
IKillSend SIGKILL to all processes
SSyncFlush all RAM data to disk
UUnmountRemount filesystems as read-only
OOffPower off (or use B for reboot)

💡 It’s like a manual controlled shutdown step-by-step.

Each step gives the system time to clean up before the next. This avoids corruption.


🔐 Is It Enabled?

Check:

 
  • 0 = disabled

  • 1 = fully enabled

  • Other numbers = partially enabled (bitmask)

Enable it:

 

Make permanent:

 

🔍 What Are Other SysRq Commands?

Here are some useful ones:

KeyAction
RSwitch keyboard from raw to XLATE (fixes input issues)
ESend SIGTERM to all processes
ISend SIGKILL to all processes
SSync all mounted filesystems
URemount all filesystems read-only
OShut down
BReboot immediately (no unmount/sync!)
KKill all processes on the current TTY (like a local panic)
MDump memory info to console
TDump process list
PDump current registers and flags
GTrigger crash dump if configured

🧠 When Should You Use It?

Use Magic SysRq when:

  • System is hard-locked or frozen

  • You cannot access TTY (Ctrl+Alt+F3, etc.)

  • SSH isn’t working

  • You want to force a clean shutdown without power cycling

Avoid just holding the power button, which risks data loss.