Magic SysRq is a key combination directly intercepted by the kernel and can be used, among other things, to perform an emergency shutdown. It is described in Documentation/sysrq.txt and implemented in drivers/char/sysrq.c in the kernel source tree. It exists primarily for kernel hackers, but it can be useful to people in user-space also. Since it is implemented as a part of the keyboard driver, it is guaranteed to work most of the time, unless the kernel itself is dead.
A note: In the rest of this article, when I say "SysRq key" I mean the single key beside the Scroll lock key. But when I say "magic SysRq" I mean the combination <> /proc/sys/kernel/sysrq
If you want it to be always enabled, append these lines to one of your initialization scripts(preferably rc.local).
#Enable SysRq
echo -e "Enabling SysRq\n"
echo "1" > /proc/sys/kernel/sysrq
Alternatively, you might look for a file called /etc/sysctl or /etc/sysctl.conf which some distributions have(mine, RedHat, does). You can add a line like this to it, and sysrq will be enabled at boot-time.
kernel.sysrq = 1
The magic SysRq combination is a unique one. Now, every key on the keyboard sends a code when pressed or released, called the scan-code. The magic SysRq combination (Alt+SysRq), however, sends only one scan-code(0x54, decimal 84) even though two keys have been pressed. Check this out using showkey -s.
What can I do with it ?
Magic SysRq is invoked as <> + <> sent from a remote console will be interpreted as <>, and the consequences can be disastrous. See the Remote-Serial-Console-HOWTO for more details.
Conclusion
The magic SysRq hack can come in very handy at times. However, it must be used with care. It can also give you some insights into the inner workings of the kernel. If you are enterprising, you might even hack the kernel and add new commands !
Note: The original article is here
A few things, mostly technical notes...
Thursday, February 10, 2005
Subscribe to:
Post Comments (Atom)
Followers
സൂചിക::Index
-
▼
2005
(25)
-
▼
February
(11)
- How RAM is used in Linux
- RHEL ES 4.0 release 1 -- miseries while kickstarti...
- Auto-finding your hard drives for Linux Kickstart
- How to read Malayalam newspapers using FireFox
- How to turn on rsh and rlogin on RedHat Enterprise...
- Addressing IDN Spoofing on Firefox...
- Debug flags for sendmail
- Debugging check_rcpt (Anti-Relay)
- Project Work
- Sendmail 8.11.x without DNS...
- About kernel.sysrq
-
▼
February
(11)
This work is licensed under a Creative Commons License.
No comments:
Post a Comment