Sponsored Links
-->

Tuesday, December 12, 2017

Good To Know: 7 Secret Linux Keyboard Shortcuts That Might Save ...
src: iwf1.com

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 filesystem. Its effect is similar to the computer's hardware reset button (or power switch) but with many more options and much more control.

This key combination provides access to powerful features for software development and disaster recovery. In this sense, it can be considered a form of escape sequence. Principal among the offered commands are means to forcibly unmount file systems, kill processes, recover keyboard state, and write unwritten data to disk. With respect to these tasks, this feature serves as a tool of last resort.

The magic SysRq key cannot work under certain conditions, such as a kernel panic or a hardware failure preventing the kernel from running properly.


Video Magic SysRq key



Commands

The key combination consists of Alt+SysRq and another key, which controls the command issued. In Ubuntu the combination of Alt+SysRequest acts as "print screen" command.

The combinations always assume the QWERTY keyboard layout; for example, on a Dvorak Simplified Keyboard, the combination to shut the system down uses the R key instead of O. Furthermore, some keyboards may not provide a separate SysRq key. In this case, a separate PrtScr key should be present.

On some devices, notably laptops, the Fn key may need to be pressed to use the magic SysRq key.

The magic SysRq key may also be accessible from the serial console (by sending an RS-232 break signal) if the sysctl option is set to allow it.

When logged in using SSH the SysRq may be accessible by writing to /proc/sysrq-trigger (echo s > /proc/sysrq-trigger).


Maps Magic SysRq key



Uses

A common use of the magic SysRq key is to perform a safe reboot of a Linux computer which has otherwise locked up (abbr. REISUB). This can prevent a fsck being required on reboot and gives some programs a chance to save emergency backups of unsaved work. The QWERTY (or AZERTY) mnemonics: "Raising Elephants Is So Utterly Boring", "Reboot Even If System Utterly Broken" or simply the word "BUSIER" read backwards, are often used to remember the following SysRq-keys sequence:

  • unRaw (take control of keyboard back from X),
  • tErminate (send SIGTERM to all processes, allowing them to terminate gracefully),
  • kIll (send SIGKILL to all processes, forcing them to terminate immediately),
  • Sync (flush data to disk),
  • Unmount (remount all filesystems read-only),
  • reBoot.

When magic SysRq keys are used to kill a frozen graphical program, the program has no chance to restore text mode. This can make everything unreadable. The commands textmode (part of SVGAlib) and the reset command can restore text mode and make the console readable again.

On distributions that do not include a textmode command, the key command Ctrl+Alt+F1 may sometimes be able to force a return to a text console. (Use F1, F2, F3, ..., F(n), where n is the highest number of text consoles set up by the distribution. Ctrl+Alt+F(n+1) would normally be used to reenter GUI mode on a system on which the X server has not crashed.)


The Magic Sys Req Key - YouTube
src: i.ytimg.com


Configuration

The feature is controlled both by a compile-time option in the kernel configuration, CONFIG_MAGIC_SYSRQ, and a sysctl kernel parameter, kernel.sysrq.

On newer kernels (since 2.6.12), 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 /proc/sys/kernel/sysrq can be 0, 1, or a number greater than 1 which is a bitmask indicating which features to allow.


DAEMON Tools Lite 1051 License Key - YouTube
src: i.ytimg.com


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.

The Linux daemons sysrqd and tcpconsole provide a method of accessing SysRq features over a TCP connection after authenticating with a plain-text password. The hangwatch 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 xm sysrq command. Additionally, a SysRq command can be invoked from a Xen paravirtual console by sending a break sequence Ctrl+O followed by the desired key.

Many embedded systems have no attached keyboard, but instead use a serial console for text input/output to the running system. It is possible to invoke a Magic SysRq feature over a serial console by sending a 'break' serial command, followed by the desired key. The method of sending a break is dependent on the terminal program or hardware used to connect to the serial console.

Chromebooks have a keyboard but no dedicated SysRq key. They use Alt+VolumeUp (Alt+F10) instead.

IBM Power servers can invoke the Magic SysRq feature using Ctrl+O followed by the desired key from HMC console.

IBM mainframe partitions can invoke the Magic SysRq feature using ^+- followed by the desired key on 3270 or HMC console.


recovery magic serial key
src: i.ytimg.com


See also

  • Stop-A, key sequence used to access Sun Microsystems's Open Firmware (OpenBoot)
  • Console server
  • KVM switch
  • System console

Safe Reboot when System Severely Freezes - YouTube
src: i.ytimg.com


References


Key top of keyboard not knowing what to use for the top 10 - GIGAZINE
src: i.gzn.jp


External links

  • "Documentation/sysrq.txt". Linux (kernel source tree). kernel.org. Retrieved 2017-01-31. 
  • Morton, Andrew (2013-03-13). "Kernel patch to the -mm tree that added the /proc/sysrq-trigger feature: This makes sysrq facilities available to remote users". Retrieved 2015-04-09. 
  • Lawrence, Tony (2005-04-13). "Magic Sysrq Key on Linux". AP Lawrence. Retrieved 2015-04-09. 
  • Gall, Tom (2000-04-01). "Magic sys request". Developer works. IBM. Archived from the original on 2007-05-27. Retrieved 2013-09-03. 

Source of article : Wikipedia