Sysrq key
Author: a | 2025-04-24
Re: [Solved] SysRq key combination without a SysRq key Thank you loqs, reading the documentation it says that the Print Scr key is a substitute for SysRq. My lapboard
[Solved] SysRq key combination without a SysRq key / Newbie
Points in time is captured.There are also command keys for rebooting a machine with as minimal an impact as possible:"r" - turns off keyboard raw mode and sets it to XLATE."s" - will attempt to sync all mounted filesystems. This lessens the chance of data loss."e" - sends a SIGTERM to all processes, except for init."i" - sends a SIGKILL to all processes, except for init."u" - will attempt to remount all mounted filesystems read-only."b" - will reboot your system immediately (without syncing or unmounting your disks).There is a mnemonic for remembering the order of the above command keys: Raising Skinny Elephants Is Utterly Boring.How to trigger SysRq on different systemsDesktop machine (x86 architecture):If a PS2 or a USB keyboard is connected to the machine, a SysRq key combination is sent to the kernel by pressing the Alt key together with the Print Screen/SysRq key together with a command key, e.g. Alt-SysRq-m for memory information.Server with SSH:Log into the machine with ssh. To send a SysRq key to the kernel, it is enough to write the command key it into /proc/sysrq-trigger as root. E.g. # echo m > /proc/sysrq-trigger # echo w > /proc/sysrq-trigger # echo l > /proc/sysrq-triggerServer with serial console only:It is often necessary to resort to using the serial console when a system starts misbehaving. The /proc/sysrq-trigger file could be used for sending SysRq keys in case it is still possible to log into the system. Otherwise, Sysrq keys can also be sent over a serial line by sending a break followed by a command key within 5 seconds.Note: The type of terminal you have will define how to 'send break', e.g.: in ipmitool the break character is "~B" (tilde followed by a capital B).Azure:On Azure, SysRq keys can be sent from the GUI interface of the serial console of a virtual machine. To get to the console, select "Support + troubleshooting/Serial console" in the menu of the machine on the Azure portal. The top bar of the console holds a tool for sending SysRq keys. This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.. Re: [Solved] SysRq key combination without a SysRq key Thank you loqs, reading the documentation it says that the Print Scr key is a substitute for SysRq. My lapboard 1. You may press Windows key and PrtScr/SysRq key together or press Ctrl key and PrtScr/SysRq key together or just press PrtScr/SysRq key on your computer keyboard to Press the SysRq key with the other hand. If your keyboard doesn't have the SysRq label, press the Prtscn key. Release the Ctrl Alt Fn keys while still holding the SysRq key. You invoke SysRq by hitting Alt SysRq Key on your keyboard. If you can’t find the SysRq key on your keyboard, it is usually the same as the Print Screen key. If your enable the magic SysRq key. You need to say yes to ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ when configuring the kernel. When running a kernel with SysRq Yes its that PrintScreen/SysRq key that we are going to MakeUseOf in this article. What is a Magic SysRq Key A Magic SysRq Key lets you send some low level commands This document (000020294) is provided subject to the disclaimer at the end of this document. SUSE Linux Enterprise Server 15SUSE Linux Enterprise Desktop 15SUSE Linux Enterprise Server 12SUSE Linux Enterprise Desktop 12 system or an application is hung and there is no obvious way how to debug the problem. Perhaps, kdump is not enabled or the system got stuck before the kdump service had been started. This document lists simple debugging steps that can be taken for most systems and that provide valuable debugging information with little effort. PrerequisiteIt is often necessary to have a serial console operational and to be able to store its output into a file. Text format is preferred over images. In case image is the only way, please use an OCR software to convert its content to text if possible. A serial console is only required if the kernel log messages do not got stored to disk, for example due to rsyslogd not being operational, or journald just logging to memory but not to disk.System Request KeysThere is a simple way to gather some data from the system without resetting or crashing it for kdump: system request (SysRq) keys. SysRq keys are predefined (hard-coded in the kernel) key combinations that trigger various actions. Note: The kernel configs "CONFIG_MAGIC_SYSRQ=y", "CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1" are set in kernels built by SUSE under General Support[1]. In case you build your own, please refer to the official[2] documentation.How to use the magic SysRq keyThe action triggered depends on the command key used in the SysRq key combination. The command keys most useful for debugging are."t" prints a stack trace for every process on the system into the kernel log. The output allows one to see what all processes were doing at that moment. On a busy, fully booted system, the output may be tens of thousands of lines long."l" prints the stack traces of all processes that are currently running on active CPUs into the kernel log."w" ("z" on AZERTY keyboards) prints the stack traces of all processes that are blocked in uninterruptible sleep into the kernel log. This command key is used for debugging I/O issues. The output should be much shorter than that of the "t" command key because not all processes are printed out."m" ("," on AZERTY) prints current memory information into the kernel log. Useful if a memory-related issue is suspected."c" - will crash the system. A kernel core dump will be stored if kdump is enabled, see [3].When getting debugging data, it is a good idea to send the command keys repeatedly (with the exception of "c") with at least several seconds in between the commands keys. In this way, the state of the system at differentComments
Points in time is captured.There are also command keys for rebooting a machine with as minimal an impact as possible:"r" - turns off keyboard raw mode and sets it to XLATE."s" - will attempt to sync all mounted filesystems. This lessens the chance of data loss."e" - sends a SIGTERM to all processes, except for init."i" - sends a SIGKILL to all processes, except for init."u" - will attempt to remount all mounted filesystems read-only."b" - will reboot your system immediately (without syncing or unmounting your disks).There is a mnemonic for remembering the order of the above command keys: Raising Skinny Elephants Is Utterly Boring.How to trigger SysRq on different systemsDesktop machine (x86 architecture):If a PS2 or a USB keyboard is connected to the machine, a SysRq key combination is sent to the kernel by pressing the Alt key together with the Print Screen/SysRq key together with a command key, e.g. Alt-SysRq-m for memory information.Server with SSH:Log into the machine with ssh. To send a SysRq key to the kernel, it is enough to write the command key it into /proc/sysrq-trigger as root. E.g. # echo m > /proc/sysrq-trigger # echo w > /proc/sysrq-trigger # echo l > /proc/sysrq-triggerServer with serial console only:It is often necessary to resort to using the serial console when a system starts misbehaving. The /proc/sysrq-trigger file could be used for sending SysRq keys in case it is still possible to log into the system. Otherwise, Sysrq keys can also be sent over a serial line by sending a break followed by a command key within 5 seconds.Note: The type of terminal you have will define how to 'send break', e.g.: in ipmitool the break character is "~B" (tilde followed by a capital B).Azure:On Azure, SysRq keys can be sent from the GUI interface of the serial console of a virtual machine. To get to the console, select "Support + troubleshooting/Serial console" in the menu of the machine on the Azure portal. The top bar of the console holds a tool for sending SysRq keys. This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
2025-04-10This document (000020294) is provided subject to the disclaimer at the end of this document. SUSE Linux Enterprise Server 15SUSE Linux Enterprise Desktop 15SUSE Linux Enterprise Server 12SUSE Linux Enterprise Desktop 12 system or an application is hung and there is no obvious way how to debug the problem. Perhaps, kdump is not enabled or the system got stuck before the kdump service had been started. This document lists simple debugging steps that can be taken for most systems and that provide valuable debugging information with little effort. PrerequisiteIt is often necessary to have a serial console operational and to be able to store its output into a file. Text format is preferred over images. In case image is the only way, please use an OCR software to convert its content to text if possible. A serial console is only required if the kernel log messages do not got stored to disk, for example due to rsyslogd not being operational, or journald just logging to memory but not to disk.System Request KeysThere is a simple way to gather some data from the system without resetting or crashing it for kdump: system request (SysRq) keys. SysRq keys are predefined (hard-coded in the kernel) key combinations that trigger various actions. Note: The kernel configs "CONFIG_MAGIC_SYSRQ=y", "CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1" are set in kernels built by SUSE under General Support[1]. In case you build your own, please refer to the official[2] documentation.How to use the magic SysRq keyThe action triggered depends on the command key used in the SysRq key combination. The command keys most useful for debugging are."t" prints a stack trace for every process on the system into the kernel log. The output allows one to see what all processes were doing at that moment. On a busy, fully booted system, the output may be tens of thousands of lines long."l" prints the stack traces of all processes that are currently running on active CPUs into the kernel log."w" ("z" on AZERTY keyboards) prints the stack traces of all processes that are blocked in uninterruptible sleep into the kernel log. This command key is used for debugging I/O issues. The output should be much shorter than that of the "t" command key because not all processes are printed out."m" ("," on AZERTY) prints current memory information into the kernel log. Useful if a memory-related issue is suspected."c" - will crash the system. A kernel core dump will be stored if kdump is enabled, see [3].When getting debugging data, it is a good idea to send the command keys repeatedly (with the exception of "c") with at least several seconds in between the commands keys. In this way, the state of the system at different
2025-04-07Switch novnc KVM consoleI can't switch virtual consoles in Linux KVM guests with alt-F1, alt-F2...VNC viewer does not pass some key combinations or they may be intercepted by your operating system.To send custom key combinations to the guest, go to "Monitor" in Virtual Machine Configuration for a given guest and use "sendkey" command.For example, to switch to the third console (tty3) you would use:sendkey alt-f3How can I send sysrq to Linux KVM guests?Similarly to the above, go to "Monitor" in Virtual Machine Configuration for a given guest and use "sendkey" command.For example, to issue "Emergency Sync", you would use:sendkey alt-sysrq-sIn the VNC viewer for the given guest you should see:SysRq : Emergency SyncYou should also see this entry if you run "dmesg" on this guest.See also for a full reference of possible combinations.How can I access Linux guests through a serial terminalSee Serial TerminalHow can I assign a physical disk to a VM?You don't have to do anything at host level (i.e. not add to fstab or anything), just set is as available directly to the KVM guest:qm set -ide# /dev/sdbOr:qm set -ide# /dev/disk/by-id/[your disk ID]...since having the drive letter change (should you add a drive) might have unintended consequences.Also see /etc/qemu-server/.conf if you want to add it editing the conf file by hand (i.e. adding ide1: /dev/sdb2).After that you can run the VM as usual, and you will have the new storage device available inside it.Beware that you can't assign it to more than one running VM if the
2025-03-29Run top/kill/pkill to discover and kill the offending process) ALT+ SYSRQ + R then CTRL + ALT+ F2 (as above, but first try to regain control of the keyboard) CTRL + ALT + Backspace (kills the graphic session and goes to a console, all graphical applications are terminated too) ALT+ SYSRQ + R then ALT + Backspace (as above, but first try to regain control of the keyboard) CTRL + ALT + DEL (reboot) ALT+ SYSRQ + R then CTRL + ALT + DEL (as above, but first try to regain control of the keyboard) ALT+ SYSRQ + R + E + I + S + U + B (forces a clean reboot even when the keyboard is not responding) The last one is the most effective, but you could try the other commands first. Wubi CustomizationCan you add Ubuntu-flavor-XYZ to Wubi?If you want your distribution included into the official release of Wubi, it first requires approval. A live CD ISO must be available to do that (Wubi uses an ubiquity based installer). How do I compile Wubi from source?Wubi can be easily rebranded and modified. Get the Wubi source code and modify the files in the ./data directory as you see fit. In particular you may want to change isolist.ini and setting.nsh, you might also want to change english.nsh (to alter the localised strings) and the artwork (image names have to match the headers in isolist.ini). To compile on a Debian based system, run: sudo apt-get install gettext build-essential grub-pc mingw32 #Is needed to compile WubimakeNote that you need the following: A Live CD with ubiquity + casper + lupin-support (which provides lupin-casper) The ISO must have a .disk/info formatted like the one in the Ubuntu ISO and with data matching what you provided in the isolist.ini If you want users to be able to download the ISO, in your web server you need to provide a metalink file for each ISO provided, the md5 of said metalink files, and the signature of the md5s. To verify the signature you need to add the signing key to data/trustedkeys.gpg. If this is too much trouble, you can disable signature checks in data/settings.nsh. The metalink file must be on a "stable" URL since that is hardcoded in isolist.ini. The metalink file can in turn point to all your mirrors. You will notice that 2 metalink files are provided in isolist.ini, one is for final release, and one for development versions. Can I use Wubi for non-Ubuntu based distributions?It should be fairly straightforward to modify the frontend (feel free to ask if you need any help), as shown above. Your Linux distribution must have a mechanism to do unattended installation using a preseed file. Wubi takes advantages of debian-installer/ubiquity presiding. If you use a different mechanism, you will have to modify src/wubi/installer_preseed.nsh. The make prerequisite scripts may need to be updated as well, since they are Debian specific. Note that upstream files (Linux-side) need to be changed since normal distributions are generally
2025-04-01