17.17.2.2. SysRq

We cannot test these actual shortcuts on QEMU since the host captures them at a lower level, but from:

./qemu-monitor

we can for example crash the system with:

sendkey alt-sysrq-c

Same but boring because no magic key:

echo c > /proc/sysrq-trigger

Implemented in:

drivers/tty/sysrq.c

On your host, on modern systems that don’t have the SysRq key you can do:

Alt-PrtSc-space

which prints a message to dmesg of type:

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) show-blocked-tasks(w) dump-ftrace-buffer(z)

Individual SysRq can be enabled or disabled with the bitmask:

/proc/sys/kernel/sysrq

The bitmask is documented at:

less linux/Documentation/admin-guide/sysrq.rst