Книга: Embedded Linux Primer: A Practical, Real-World Approach
14.3.7. Magic SysReq Key
14.3.7. Magic SysReq Key
This useful debugging aid is invoked through a series of special predefined key sequences that send messages directly to the kernel. For many target architectures and boards, you use a simple terminal emulator on a serial port as a system console. For these architectures, the Magic SysReq key is defined as a break character followed by a command character. Consult the documentation on the terminal emulator you use for how to send a break character. Many Linux developers use the minicom terminal emulator. For minicom, the break character is sent by typing Ctl-A F. After sending the break in this manner, you have 5 seconds to enter the command character before the command times out.
This useful kernel tool can be very helpful for development and debugging, but it can also cause data loss and system corruption. Indeed, the b command immediately reboots your system without any notification or preparation. Open files are not closed, disks are not synced, and file systems are not unmounted. When the reboot (b) command is issued, control is immediately passed to the reset vector of your architecture in a most abrupt and stunning manner. Use this powerful tool at your own peril!
This feature is well documented in the Linux kernel documentation subdirectory in a file called sysrq.txt. There you find the details for many architectures and the description of available commands.
For example, another way to set the kernel loglevel just discussed is to use the Magic SysReq key. The command is a number from 0 through 9, which results in the default loglevel being set to the number of the command. From minicom, press Ctl-A F followed by a number, such as 9. Here is how it looks on the terminal:
$ SysRq : Changing Loglevel
Loglevel set to 9
Commands can be used to dump registers, shut down your system, reboot your system, dump a list of processes, dump current memory information to your console, and more. See the documentation file in any recent Linux kernel for the details.
This feature is most commonly used when something causes your system to lock up. Often the Magic SysReq key provides a way to learn something from an otherwise dead system.
- 15.3. Обработка изображений при помощи RMagick
- 3.2. Ключи типа key_t и функция ftok
- Using ssh-keygen to Enable Key-Based Logins
- Measuring Key Buffer Usage
- 6.4.4. initrd Magic: linuxrc
- PROJECT 6.9 — Calculator with Keypad and LCD
- Program Using a Built-in Keypad Function
- Ограничение PRIMARY KEY
- 5.3. Презентация Keynote
- 4.7 Key Characteristics of an RTOS
- Appendix A C# Keywords
- Keywords