MarketMagic SysRq key
Company Profile

Magic SysRq key

The magic SysRq key is a key combination understood by the Linux kernel, which allows the user to perform various low-level commands regardless of the system's state. It is often used to recover from freezes, or to reboot a computer without corrupting the file system.

Implementation
The Linux kernel contains sysrq.c, which implements magic SysRq functionality. Magic SysRq functionality is called by serial devices at a low level in the driver code. == Commands ==
Commands
The key combination consists of and another key, which controls the command issued. may be released before pressing the command key, as long as remains held down. The combinations always assume the QWERTY keyboard layout. For example, on the Dvorak keyboard layout, the combination to shut down the system uses the key instead of . Furthermore, some keyboards may not provide a separate key. In this case, a separate key should be present. On some devices, notably laptops, the key may need to be pressed to use the magic key, e.g. on Thinkpad Carbon X1 the is activated by pressing simultaneously, then releasing and while still holding . A complete list of commands is available in the official Linux Kernel Documentation on Linux Magic System Request Key Hacks. == Configuration ==
Configuration
The feature is controlled both by a compile-time option in the kernel configuration, ,), it is possible to have more fine-grained control over how the magic SysRq key can be used. On these machines, the number written to can be 0, 1, or a number greater than 1 which is a bitmask indicating which features to allow. On Ubuntu this is set at boot time to the value defined in . == Uses ==
Uses
Before the advent of journaled filesystems a common use of the magic SysRq key was to perform a safe reboot of a locked-up Linux computer (using the sequence of key presses indicated by the mnemonic REISUB), which lessened the risk of filesystem corruption. With modern filesystems, syncing and unmounting is still useful to force unflushed data to disk, but is no longer necessary to prevent filesystem corruption (and may increase the risk of corruption in case the lock-up is caused by the kernel being in a bad state). The default value of kernel.sysrq in distributions such as Ubuntu and Debian remains 176 (allowing the sync, unmount, and reboot functions) and 438 (allowing the same functions plus loglevel, unraw, and nice-all-RT-tasks) respectively. Another past use was to kill a frozen graphical program, as the X Window System used to have complete control over the graphical mode and input devices. == Other ways to invoke Magic SysRq ==
Other ways to invoke Magic SysRq
While the magic SysRq key was originally implemented as part of the kernel's keyboard handler for debugging, the functionality has been also exposed via the proc filesystem and is commonly used to provide extended management capabilities to headless and remote systems. From user space programs (such as a command line shell), SysRq may be accessed by writing to (e.g., ). The Linux daemons and provide a method of accessing SysRq features over a TCP connection after authenticating with a plain-text password. The daemon will invoke pre-configured SysRq triggers when system load average exceeds a certain threshold. The Xen hypervisor has functionality to send magic commands to hosted domains via its command. Additionally, a SysRq command can be invoked from a Xen paravirtual console by sending a break sequence followed by the desired key. The Kernel-based Virtual Machine (KVM) hypervisor has functionality to send magic commands to hosted domains via its command. eg: virsh send-key --domain domainname --keycode KEY_LEFTALT KEY_SYSRQ KEY_S Chromebooks have a keyboard but no dedicated SysRq key. They use () instead, however some keys have a different function. Some Dell Laptops require the following sequence: • Sequentially press & hold • Release • While still holding , press the desired key e.g., IBM Power Systems servers can invoke the Magic SysRq feature using followed by the desired key from the Hardware Management Console. IBM mainframe partitions can invoke the Magic SysRq feature using followed by the desired key on 3270 or HMC. == See also ==
tickerdossier.comtickerdossier.substack.com