[HowTo] reboot / turn off your frozen computer: REISUB/REISUO

Difficulty: ★★☆☆☆

This tutorial was created because people are using a hard power off during freezes, so this will teach you how to turn off your computer when everything is frozen using softer means.
So whenever you see someone saying they had to “Power Off” or “Hard Reset” their system without doing a REISUB, please send them here! :innocent:

If you’re reading this in response to a question, please click the green link above this text to bring you to the full unabridged text of the tutorial.


If you can read this line, you’re all set, and you already are where you need to be! :+1:

Please click the  ►to expand that section below:

REISUB (reboot)

REISUB (also known as the magic SysRq key ) is a mnemonic for:

and is a gentle way of rebooting your system by doing the following:

  • Switch the keyboard from R aw mode, used by programs such as X11 and SVGALib, to XLATE (translate) mode
  • Send an E nd signal (SIGTERM) to all processes, except the boot process, allowing all processes to end gracefully
  • Send an I nstant kill (SIGKILL) to all processes, except the boot process, forcing all processes to end .
  • S ync all mounted filesystems, allowing them to write all data to disk.
  • U nmount and remount all mounted filesystems in read-only mode.
  • Re B oot the system

In fact, the only data you lose is since your last [auto]save as the system is shut down gracefully.

Before you read any further, ensure all your work is saved!

How to invoke the REISUB procedure?
First we have to unlock the SysRq key so:

  • Execute echo kernel.sysrq=1 | sudo tee --append /etc/sysctl.d/99-sysctl.conf
    I don't want any stinking commands editing my files for me!
    • Oh, you’re the manual kind of person and wants to document why you’re doing this, right? :+1:
    • Add to your /etc/default/grub in the GRUB_CMDLINE_LINUX_DEFAULT parameter the sysrq_always_enabled=1 variable instead of executing the above command
  • Execute sudo update-grub
  • Reboot normally and come back here to read the rest of the blurb… :wink:

There is a special Sys tem R e q uest key on most keyboards called SysRq on all English language and most international keyboards.

Expand this for the translation for some International keyboards

:it: Stamp (or Stampa on old Olivetti keyboards)
:de: S-Abf
:mexico: PetSis (maybe also other :es: keyboards, please confirm)
:earth_africa: Feed back in a comment below if you have found yours that is not mentioned here. :innocent:

  • On full-size keyboards, it’s called by pressing Alt+SysRq
  • On most laptop keyboards it’s called by pressing Fn+Alt+PrtSc
  • On some keyboards, if none of the above Alt combinations work or the SysRq key is missing, please also try:
    • Alt+PrtSc
    • Alt Gr+PrtSc
    • Ctrl+Alt+PrtSc

Once you’ve located your SysRq key, please keep the Alt key pressed and then release the SysRq.

Now lightly tap these keys waiting between 1 second (fast, new machines) and 6 seconds (older or resource-starved machines¹) in-between keypresses : R E I S U B

There! If you actually followed the above instructions, your system just rebooted gracefully and you did not damage your HDD (if you still have one) by forcing it into PARK mode forcefully nor was your EXT4 or NTFS transaction journal rolled back.

Congratulations!

:innocent: :+1: :clap:

REISUO (Turn off)
  1. Read the REISUB section above and then you’ll know what this means:
  2. R E I S U O will turn your machine O ff instead of re B ooting it…
Light tap on power button (<5 seconds)
  1. Sometimes (If only the UI is frozen), you can still switch to one of the TTYs by pressing Ctrl+Alt+F2 or F3, … and gently tap the power button there.
  2. To do the same from within your Desktop Environment (DE) this has to be set up beforehand!
    So to ensure that your power button effectively shuts down your computer instead of going to sleep / Hibernate / … in the future , follow these steps for your DE:
  • In Gnome:

    Details
    • To immediately trigger the Power Off modal dialog, execute the following command:

      gnome-session-quit --power-off
      

      The Power Off modal dialog will appear with options to Cancel or Power Off. Otherwise it will power off automatically after 60 seconds.

    • To set this as the default power button behavior, execute the following command:

      gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'interactive'
      
  • In KDE:

    Details
    • Go to System Settings
    • Type energy
    • Click Energy Saving
    • in all of the On AC Power, On Battery and On Battery tabs, set the check-mark on Button events handling and the Even when an external monitor is connected
    • When power button pressed to Shut Down as per below screenshot:
    • Click Apply
  • In XFCE:

    Details
    • Go to the Applications menu or System settings
    • Clock Power Manager
    • From When Power Button is pressed: select Shutdown.

That’s it! If all of your data is saved, just press the power button lightly and your system will shut down gracefully from now on!

Keep power button suppressed (>5 seconds)

See section “Pull circuit breaker on House / Street / Block” below…

Yank power cord from a laptop without battery or a PC without UPS

See section “Pull circuit breaker on House / Street / Block” below…

Pull circuit breaker on House / Street / Block

Please! Do not do this!

Unless you’re using ZFS or BTRFS and have ensured they use redundancy, you will lose data because every time you press the power button and don’t boot an external Linux USB to fsck your /, your system becomes more and more damaged until you’re in for a re-install!

Maybe not the first time, maybe not the second time, but eventually, you will!

Use REISUB, REISUO or a light tap instead!

Happy safe computing! :+1:

Note 1: How long you have to wait in-between keystrokes is a function of your hardware speed and how busy a system is. For my laptop it’s 1 second, for servers, I wait 3 seconds but we have been notified that on some resource-starved machines it can take up to 10 6 seconds. :man_shrugging:
Note 2: For the full

86 Likes