SysRq

When a sysrq command is triggered, the kernel will print out the information to the kernel ring buffer and to the system console. This information is normally logged via syslog to /var/log/messages.

Commands

  • Enable: echo 1 > /proc/sys/kernel/sysrq
  • Disable: echo 0 > /proc/sys/kernel/sysrq
  • Permanent activation: echo "kernel.sysrq = 1" >> /etc/sysctl.conf
  • Trigger a sysrq event: Alt+PrintScreen+[CommandKey]
  • If you have a root shell on the machine : echo "command key" > /proc/sysrq-trigger
  • Clean reboot: Right Alt + SysRq + R E I S U B
  • Initiate a system crash: echo 'c' > /proc/sysrq-trigger

Key combinations

  • b Will immediately reboot the system without syncing or unmounting your disks
  • s Will attempt to sync all mounted filesystems
  • u Will attempt to remount all mounted filesystems read-only
  • p Will dump the current registers and flags to your console
  • t Will dump a list of current tasks and their information to your console
  • m Will dump current memory info to your console
  • 0...9 Sets the console log level, controlling which kernel messages will be printed to your console. (0, for example would make it so that only emergency messages like PANICs or OOPSes would make it to your console)
  • f Will call oom_kill to kill a memory hog process
  • e Send a SIGTERM to all processes, except for init
  • i Send a SIGKILL to all processes, except for init
  • h Will display help

Links