Tag Archives: SysRq

Restart/shutdown linux with magic (REISUB)

To restart your system, press alt + Printscreen/SysRq. Then, while holding those keys, slowly type the keys  R E I S U B (one key at a time, requires QUERTY keyboards). You can find a list of all SysRq keys here which includes key presses for other keyboard layouts.

To define the mode of SysRq you should edit the file: /etc/sysctl.d/10-magic-sysrq.conf . That file includes details of various levels of SysRq.

Here is an example of it’s contents:

# 0 - disable sysrq completely
# 1 - enable all functions of sysrq
# >1 - enable certain functions by adding up the following values:
# 2 - enable control of console logging level
# 4 - enable control of keyboard (SAK, unraw)
# 8 - enable debugging dumps of processes etc.
# 16 - enable sync command
# 32 - enable remount read-only
# 64 - enable signalling of processes (term, kill, oom-kill)
# 128 - allow reboot/poweroff
# 256 - allow nicing of all RT tasks

A recommended value is 64 because it permits you to use oom kill which is very useful.

Here is a short explanation for reboot (not all keys will work, as it depends on the value you have defined in  /etc/sysctl.d/10-magic-sysrq.conf file) :

  • R: Switch the keyboard from raw mode to XLATE mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
  • U: Remount all mounted filesystems in read-only mode
  • B: Immediately reboot the system, without unmounting partitions or syncing

Here is a short explanation for shutdown:

  • R: Switch the keyboard from raw mode to XLATE mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
  • U: Remount all mounted filesystems in read-only mode
  • O: Immediately shutdown the system, without unmounting partitions or syncing

Here is a cool mnemonic:

  • R – Reboot
  • E – Even
  • I – If
  • S – System
  • U – Utterly
  • B – Broken

References:

http://blog.kember.net/articles/reisub-the-gentle-linux-restart/

https://en.wikipedia.org/wiki/Magic_SysRq_key