Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

Doing a Polite System Reset Using REISUB


Sometimes computer systems freeze. We’re not talking about the times when
one program starts acting weird and the program freezes and everything else
works fine. In those cases, you can use kill to terminate the program and
move on, as described in the section “Printing Resource Usage with top,”
earlier in this chapter or you can use the kill command as described in
Chapter 16, “System-Monitoring Tools.” The freezing we’re talking about is
when nothing will work. Nothing responds to any keyboard or other input, not
even a Ctrl+Alt+Del key combination. What then? The absolute worst-case
scenario is to perform a power cycle, which is a fancy way of saying “Turn it
off and back on again.” The problem is that power cycling can cause you to
lose data because it can corrupt the file system. This doesn’t always happen,
but it is a large enough risk that you want to avoid performing a power cycle
unless absolutely necessary. Instead, you can try using REISUB.


NOTE
Before you can use the REISUB feature, it must be enabled. The feature is
enabled when the value of /proc/sys/kernel/sysrq is set to 1 . You
must have this enabled before you encounter a problem in order for
REISUB to work.
To check the current value of this variable, run the following:

Click here to view code image
matthew@seymour:~$ cat /proc/sys/kernel/sysrq


To  change  the value,  first   edit    the /etc/sysctl.conf    file    by
uncommenting the line in the file by removing the # in front of it and
saving to set kernel.sysrq=1. Then run the following:

Click here to view code image
matthew@seymour:~$ sudo sysctl -p /etc/sysctl.conf


The Linux kernel has a set of key combination commands that are built in at
the kernel level. These are referred to using the name of one of the keys, the
SysRq key, often labeled PrtScr. The Magic SysRq Key combinations send
commands directly to the kernel, bypassing any programs running on top of
the kernel, including your window manager and probably anything that is
frozen. To use these commands, press SysRq+Alt+ one other key. Here we
focus on the six keys that are most useful to most people; you can find full
lists of available commands at https://www.kernel.org/doc/html/latest/admin-
guide/sysrq.html.

Free download pdf