The magic of Sys Req

Linux is usually a system that is stable enough to survive the anomalous behavior of a software.

However, it may happen that a program is able to block the entire computer.

In this case very often there is nothing left but to force the shutdown of the computer, with the probability of corrupting the filesystem.

But before resorting to this drastic method, here comes a little "magic".

The name of this witchcraft is Magic Sys Req.

Magic Sys Req It is a mode of communication with the Linux kernel that allows you to perform various low-level commands simply by using a sequence of keys, regardless of the state in which the system is located.

Usually Magic Sys Req it is active by default in most systems but if it is not, let's see how to activate it in a few simple steps.

There are two ways to activate Magic Sys Req:

1 Mode 1:

Just open the terminal and give the command:

echo 1> / proc / sys / kernel / sysrq 

2 Mode 2:

Open the file with an editor /etc/sysctl.conf and add the line
kernel.sysrq = 1

To activate Sys Req on a locked system, just press the Alt key and the R sist key, usually the key with the written word (to understand what allows you to acquire a screenshot).

Now that we have seen how to activate it, if it was not already, and we have seen the keys to use, let's see a practical example referring to our initial problematic, that is a system that no longer responds.

To restart the system and close all open apps without risking corrupting the filesystem.

First we press the Alt and Stamp keys and then the key combination REISUB, leaving preferably a few seconds between pressing one key and the other.

This combination of keys allows the files to be saved and the system to restart without problems.

But let's see specifically how each single key works:

The R key restores keyboard operation.

The E key launches the command TERM which asks all the processes to auto-finish, after saving the files on the disk.

The I key, on the other hand, activates the command KILL that forces the deactivation of services still active.

The S key instructs the kernel to synchronize with the buffers on the disk so that the files that are still active are closed without problems.

The U key unmounts the filesystem and remounts it read-only to prevent corruption of other data.

Finally, the B key reboots the system.

If you want more information, you can refer to the documentation you can find at this link.

This website uses cookies to improve your experience. I think this does not create problems, but if you want you can do without it. accept Information

en_USEnglish
it_ITItalian en_USEnglish