[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

2 posts were split to a new topic: Booting live ISO HP hangs

A post was split to a new topic: SysRq (RSEIUB) problems

A post was split to a new topic: REISUB doesn’t always work

2 posts were split to a new topic: REISUB not working during boot

Just wanted to say that Alt + PrtSc on the Drop: SHIFT keyboard (with stock firmware/keymap) did the trick.

Also, to save anybody else the google, /etc/default/grub is where GRUB_CMDLINE_LINUX_DEFAULT can be modified. I spent more than a few min looking in /etc/grub.d/

1 Like

That’s in the tutorial now. Thanks for the feed-back.

Furthermore: all remarks from 2020-08-17 → 2020-09-20 have been deleted to keep the conversation clean for new users.

When using the sysctl.d approach - you can immediately apply the config

# sysctl --system

or

# sysctl -p /etc/sysctl.d/99-sysctl.conf

Yes, you’re 100% correct, but they have to add a GRUB_CMDLINE_LINUX_DEFAULT parameter, so they have to reboot anyway, so I left that out for simplicity.

:scream:

But you wrote OR, so what it is? Grub or sysctl or both?

OR changed to XOR.

:stuck_out_tongue_winking_eye:

looks like the command for light tab on power button on gnome doesn’t work anymore:

$ gsettings set org.gnome.settings-daemon.plugins.power button-power 'shutdown'
No such key “button-power”
1 Like

What’s the output of:

gsettings list-recursively | grep --ignore-case button
inxi --admin --full | grep Desktop

:question:

(I’m on KDE nowadays)

output of `gsettings list-recursively | grep --ignore-case button`
$gsettings list-recursively | grep --ignore-case button
org.cinnamon.desktop.interface buttons-have-icons false
org.gnome.shell.extensions.arcmenu override-menu-button-active-background-color false
org.gnome.shell.extensions.arcmenu custom-menu-button-icon ''
org.gnome.shell.extensions.arcmenu menu-button-active-backgroundcolor 'rgba(238,238,236,0.18)'
org.gnome.shell.extensions.arcmenu custom-menu-button-text 'Applications'
org.gnome.shell.extensions.arcmenu override-menu-button-color false
org.gnome.shell.extensions.arcmenu menu-button-hover-color 'rgb(214,214,214)'
org.gnome.shell.extensions.arcmenu custom-menu-button-icon-size 20.0
org.gnome.shell.extensions.arcmenu menu-button-active-color 'rgb(240,240,240)'
org.gnome.shell.extensions.arcmenu menu-button-color 'rgb(240,240,240)'
org.gnome.shell.extensions.arcmenu menu-button-hover-backgroundcolor 'rgba(238,238,236,0.1)'
org.gnome.shell.extensions.arcmenu override-menu-button-hover-color false
org.gnome.shell.extensions.arcmenu button-padding -1
org.gnome.shell.extensions.arcmenu menu-button-disable-rounded-corners false
org.gnome.shell.extensions.arcmenu enable-menu-button-arrow false
org.gnome.shell.extensions.arcmenu override-menu-button-active-color false
org.gnome.shell.extensions.arcmenu override-menu-button-hover-background-color false
org.gnome.shell.extensions.arcmenu menu-button-appearance 'Icon'
org.gnome.shell.extensions.arcmenu show-activities-button false
org.gnome.shell.extensions.arcmenu menu-button-icon 'Arc_Menu_Icon'
org.gnome.calculator button-mode 'programming'
org.gnome.desktop.peripherals.trackball scroll-wheel-emulation-button-lock false
org.gnome.desktop.peripherals.trackball scroll-wheel-emulation-button 0
org.gnome.shell.extensions.openweather use-text-on-buttons false
org.gnome.desktop.peripherals.touchpad tap-button-map 'default'
org.cinnamon.settings-daemon.peripherals.mouse middle-button-enabled true
org.cinnamon.desktop.wm.preferences mouse-button-modifier '<Alt>'
org.cinnamon.desktop.wm.preferences resize-with-right-button true
org.cinnamon.desktop.wm.preferences mouse-button-zoom-modifier '<Alt>'
org.cinnamon.desktop.wm.preferences button-layout 'menu:minimize,maximize,close'
org.gnome.shell.extensions.dash-to-panel show-activities-button false
org.gnome.shell.extensions.dash-to-panel show-apps-button-context-menu-titles @as []
org.gnome.shell.extensions.dash-to-panel show-apps-button-context-menu-commands @as []
org.gnome.shell.extensions.dash-to-panel showdesktop-button-width 7
org.cinnamon.settings-daemon.plugins.xsettings buttons-have-icons false
org.gnome.settings-daemon.plugins.power power-button-action 'suspend'
org.cinnamon.settings-daemon.plugins.power button-hibernate 'hibernate'
org.cinnamon.settings-daemon.plugins.power button-power 'suspend'
org.cinnamon.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.desktop.wm.preferences mouse-button-modifier '<Super>'
org.gnome.desktop.wm.preferences resize-with-right-button false
org.gnome.desktop.wm.preferences button-layout 'appmenu:minimize,maximize,close'
org.gnome.shell.extensions.dash-to-dock show-show-apps-button true
io.github.GnomeMpv use-skip-buttons-for-playlist false
io.github.celluloid-player.Celluloid use-skip-buttons-for-playlist false
org.gnome.evolution.shell buttons-style 'toolbar'
org.gnome.evolution.shell buttons-hide @as []
org.gnome.evolution.shell buttons-visible-sub true
org.gnome.evolution.shell buttons-visible true
org.gnome.login-screen disable-restart-buttons false
org.gnome.nautilus.preferences mouse-back-button 8
org.gnome.nautilus.preferences mouse-forward-button 9
org.gnome.nautilus.preferences mouse-use-extra-buttons true
org.gtk.Settings.EmojiChooser recent-emoji [(([uint32 128721], 'stop sign', ''), uint32 0), (([129300], 'thinking face', ':thinking:'), 0), (([128578], 'slightly smiling face', ':slight_smile:'), 0), (([128517], 'grinning face with sweat', ':sweat_smile:'), 0), (([128526], 'smiling face with sunglasses', ':sunglasses:'), 0), (([127969], 'house with garden', ':house_with_garden:'), 0), (([127968], 'house', ':house:'), 0), (([128161], 'light bulb', ':bulb:'), 0), (([128515], 'grinning face with big eyes', ':smiley:'), 0), (([128173], 'thought balloon', ':thought_balloon:'), 0), (([128172], 'speech balloon', ':speech_balloon:'), 0), (([128495], 'right anger bubble', ':anger_right:'), 0), (([128488], 'left speech bubble', ''), 0), (([128307], 'white square button', ':white_square_button:'), 0), (([128433], 'computer mouse', ':mouse_three_button:'), 0), (([128187], 'laptop computer', ':computer:'), 0), (([128421], 'desktop computer', ':desktop:'), 0), (([127822], 'red apple', ':apple:'), 0), (([127970], 'office building', ':office:'), 0)]
org.nemo.preferences mouse-forward-button 9
org.nemo.preferences mouse-use-extra-buttons true
org.nemo.preferences mouse-back-button 8
org.gnome.shell.extensions.unite show-window-buttons 'maximized'
org.gnome.shell.extensions.unite window-buttons-theme 'default-dark'
org.gnome.shell.extensions.unite window-buttons-placement 'auto'
org.gnome.shell.extensions.unite hide-activities-button 'auto'
ca.desrt.dconf-editor.Settings mouse-back-button 8
ca.desrt.dconf-editor.Settings mouse-use-extra-buttons true
ca.desrt.dconf-editor.Settings mouse-forward-button 9
$ inxi --admin --full | grep Desktop
  Desktop: GNOME 40.5 tk: GTK 3.24.30 wm: gnome-shell dm: GDM 40.1
1 Like

2 posts were split to a new topic: Converted to personal message

It’s org.gnome.settings-daemon.plugins.power power-button-action for GNOME 40.5.

:bowing_man:

Edited that into the tutorial just now…

:bed: :zzz: :first_quarter_moon_with_face:

$ gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'shutdown'
The provided value is outside of the valid range

it’s not too important for me, I can still use the tty way

1 Like

The Gnome devs did it again: taking away functionality that used to exist before (and one of the reasons I migrated away from them). Took me a couple of weeks of rallying votes / comments from a ton of people last time they removed this exact functionality (~3 years ago), so:

  • file a bug and say you want to be able to shut down your machine in an emergency (I used the example of :beer: spilled over my keyboard back then)
  • You might get lucky and find a Foster-drinking :australia: dev that agrees with you.

:grin:

1 Like

The current options are 'nothing', 'suspend', 'hibernate' or 'interactive'. When setting it to 'interactive', it presents the Power Off modal dialog and will power off automatically in 60 seconds. The user can choose Cancel or Power Off.

2 Likes

If,
A = “Add to your /etc/default/grub . . .”
B = “Execute echo kernel.sysrq=1 | sudo tee --append /etc/sysctl.d/99-sysctl.conf
C = “Execute sudo update-grub
D = “Reboot normally”,
where do I have to put the parentheses in the ill-expressed statement of A XOR B AND C AND D? (Seriously asking).

Another part that I am not sure 100% understanding is in the key press sequences

am I supposed to press one of those Alt combinations and then release the keys other than the Alt, and with Alt key still pressed I should press the REISUB key sequences with the mentioned interval?

1 Like