Magic SysRq key | Linux Rescue | Frozen Linux








The magic SysRq key is a key combination which allows the user to perform various low-level commands regardless of the system's state. If your Linux machine freezes or you want to reboot your Linux machine without corrupting the filesystem you can use this magic SysRq key combination.This key combination provides access to powerful features and thus needs some knowledge to use it.Please do not proceed without knowing about these combinations as you may put your system in a critical state.Please note that this magic SysRq key cannot work under certain conditions, such as a kernel panic or a hardware failure preventing the kernel from running properly.













Commads:





The key combination consists of Alt+SysRq and another key, which controls the command issued.SysRq may be released before pressing the command key, as long as Alt remains held down.
These combinations always assume the QWERTY keyboard layout.






1. Immediately reboot the system, without unmounting or syncing filesystems - b2. Perform a system crash. A crashdump will be taken if it is configured - c





3. Display all currently held Locks (CONFIG_LOCKDEP kernel option is required) - d





4. Send the SIGTERM signal to all processes except init (PID 1) - e





5. Call oom_kill, which kills a process to alleviate an OOM condition - f





6. When using Kernel Mode Setting, switch to the kernel's framebuffer console - g





7. Send the SIGKILL signal to all processes except init - i





8. Forcibly "Just thaw it" – filesystems frozen by the FIFREEZE ioctl - j





9. Kill all processes on the current virtual console - k





10. Shows a stack backtrace for all active CPUs - l





11. Switch the keyboard from raw mode, used by programs such as X11 and SVGALib, to XLATE mode - r





12. Sync all mounted filesystems - s





13. Remount all mounted filesystems in read-only mode - u










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.[5] The QWERTY (or AZERTY) mnemonics: "Raising Elephants ISUtterly Boring", "Reboot Even ISystem 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 except init, 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 F1F2F3, ..., 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.) There are also distributions where Ctrl+Alt+F(3 to n-2)) opens text consoles, Ctrl+Alt+F1 reenter GUI mode, Ctrl+Alt+F2 reenter GUI mode on the login page, in order to log another user.





Peace Out.





Suhaib Bin Younis | @suhaibbinyounis


Post a Comment

Post a Comment (0)

Previous Post Next Post