Magic S-Abf button

from Wikipedia, the free encyclopedia
The function " S-Dep " ( eng. "SysRq") is on an IBM AT-compatible keyboards an alternative assignment of the "print" button (English "Print Screen")

As Magic SysRq Key (for short Magic Sysrequest key ., English " Magic SysRq key ") is a series of key combinations of the Linux kernel with the S-Abfdesignated key with which different functions - for example, a restart of the computer - run The individual functions can also be carried out one after the other in a meaningful sequence. This also works if the computer no longer reacts to other inputs, but the kernel has not yet crashed. This type of “ grip ” is often used to reboot without causing damage to the file system or to shut down an unresponsive X server .

Frequently used combinations

A well-known like used and in IT circles way to start the computer with hanging system new, it is pressed onto a Linux system, press Alt + SysRq to keep, while in turn the keys R, E, I, S, Uand Bto press . In this way, the file system caches are securely emptied (i.e. their contents are written to the disk), all file systems are securely unmounted and thus damage to the file system is prevented. Another well-known key sequence, RSEIUB, prefers sync. One argument against it is that the terminated processes may still write data to the cache, and the sync therefore comes too early. One argument for this is that the unmount command should synchronize the disks anyway. There is no consensus on which combination is preferable.

Available combinations

The desired command is given by simultaneously pressing S-Abf +  on the keyboard Alt. S-Abfis an alternative assignment of the key on IBM-AT-compatible keyboards Druck.

On keyboards for Germany, press the  +   +  keys at the same time . AltDruckTaste aus Tabelle unten

On keyboards for Switzerland and English-speaking countries, the key corresponds to SysRqits German counterpart S-Abf. The lettering is for example in Switzerland PrtScr SysRq. The combination on a Swiss keyboard is: Alt Gr+ PrtScr SysRq.

Due to manufacturer-specific keyboard layouts, additional keys may have to be pressed on laptops , for example on Dell laptops first Num, then Fn+ Alt+ Druck+ entsprechender Buchstabe; on z. B. ThinkPads can be used in the following sequence: Altpress and hold, press and release Fn+ Druck, entsprechenden Buchstabenpress, release all.

The key required for the corresponding command can be read off in the following table, upper and lower case is not important. The information relates to the QWERTZ keyboard used in Germany.

Alphanumeric keys and their function
button Function meaning
0...9 set log level Numbers from 0 to 9 determine the log level , i.e. the limit from which importance a message from the kernel is displayed. When 0only critical messages such as kernel panic are displayed.
B reboot Shut down the computer immediately without writing data from the kernel hard disk cache to the hard disks and without unmounting partitions, and restart the computer .
C crashdump Restart with the help of kexec (if available) and output a crash dump on the screen. Otherwise provoke a crash through null pointer dereferencing.
D Show (in text mode) all current locks .
E term Send SIGTERM to all processes except Init
F force a OOM kill Starts the OOM killer that kills the most memory-intensive process. This means that you can usually continue working on the system when a process begins to be heavily outsourced and the system reacts very slowly.
G kGDB With newer kernel versions, switches to the framebuffer text console and starts the kernel debugger kgdb , if available.
H help Output a help text for using the Magic SysRq key . Any other unassigned key also outputs this text.
I kill Send SIGKILL to all processes except Init
J "Just thaw it" Finished with newer kernel versions, the "freezing" of a file system by the IOCTL function FIFREEZE .
K secure attention key Complete all processes that on the current terminal, to be sure Login - Prompt from init and not from a Trojan . A hung application using SVGAlib or an unresponsive X server can also be terminated in this way. In Ubuntu version 9.04 and higher, this is recommended instead of the previously used combination Strg+ Alt+ Backspace.
L kill including init Send SIGKILL to all processes, including Init. This is equivalent to switching it off. Newer kernel versions show a backtrace .
M memory Output the main memory usage in the console.
N This allows the priority of real-time processes to be reduced.
O poweroff Switches the computer off with immediate effect via ACPI / APM - if supported. As with B, Onothing is saved on its own.
P show registers Show the contents of the CPU register including the flags .
Q Show all currently running timers .
R unraw Leave the keyboard raw mode, which is active under X and SVGAlib , to the keyboard XLATE mode, which can be used in Linux's text mode . This can be useful if a graphical application crashes and the user finds himself in the console, which is initially unusable due to the wrong keyboard mode.
S sync Write any data that has not yet been written to the hard drive from the kernel hard drive cache to the hard drives
T show tasks Show a list of currently running processes.
U umount All partitions integrated in a writable manner are unmounted and then re-mounted as read-only.
V framebuffer, ETM dump With newer kernel versions, switches to the framebuffer text console. On the ARM architecture which is ETM buffer displayed.
W Show blocked processes that are in "uninterruptible sleep", for example during hard disk access.
X XMON Used in newer kernel versions for the XMON interface of the Power / PowerPC architecture.
Y FTRACE dump With newer kernel versions the FTRACE buffer is displayed.
Z show global CPU registers With newer kernel versions, the global CPU registers are displayed on the SPARC-64 architecture.

Trigger on the command line

The commands mentioned can also be triggered via the shell (and thus also via scripts). To do this, the kernel Proc API writes the appropriate character in the virtual file / proc / sysrq-trigger . This is only possible as root . For example, the following command triggers an immediate reboot.

echo b > /proc/sysrq-trigger

literature

  • Oliver Diedrich: Not possible? Doesn't exist! Safely switch off hanging Linux systems. In: c't No. 26, 2008, p. 210

Web links

Individual evidence

  1. Ubuntuforums.org , Guide to the Magic SysrRq Key (English)
  2. Linuxhowtos.org (English) or pro-linux.de , statement on: "unmount contains sync"
  3. c't compact Linux. Heise, Hanover 2009.
  4. A large part of this article consists of information taken from the official documentation for the Magic SysRq Key, which is usually located on Linux systems in the file /usr/src/linux/Documentation/sysrq.txt (last revised after the documentation for version 3.4). This documentation for the corresponding kernel version of the system should be used as reliable instructions for use.
  5. Readme file from kexec
  6. Kernel.org ( Memento of the original from August 2, 2016 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. or mjmwired.net , SysRq documentation @1@ 2Template: Webachiv / IABot / www.kernel.org
  7. "Ubuntu 9.04" in the Ubuntuusers Wiki or release notes for Ubuntu 9.04 (English)