SysRq
References:
- http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/en-US/Reference_Guide/s3-proc-sys-kernel.html
- http://www.ibm.com/developerworks/linux/library/l-magic.html
- http://www.linuxtoday.com/news_story.php3?ltsn=2008-12-10-001-35-OS-HL
- /usr/src/linux-source-2.6.xx/Documentation/sysrq.txt
- /usr/share/doc/linux-doc-2.6.xx/Documentation/sysrq.txt.gz
- /usr/share/doc/kernel-doc-<version>/Documentation/sysrq.txt
- or... well, you get the idea. We are, after all, talking about Linux
here so the information IS available.
- Wikipedia
Note that this is documented only on i386 on Linux, and you need your
kernel to have been compiled with the 'Magic SysRq Key' option. Find out if
it has been by looking at
/proc/sys/kernel/sysrq
If it exists and
contains the value 1, all possible requests are allowed.
If it exists and contains the value 0
echo 1 > /proc/sys/kernel/sysrq
If the machine is headless or is being accessed remotely, magic commands may
be run on the command line. This is, however, contingent upon being able to
shell into the machine. To run magic commands, echo the desired trigger code
to the SysRq trigger in the procfs. For example:
echo b > /proc/sysrq-trigger
The key combinations are a little different from platform to platform:
- x86 ALT-SYSRQ-[command key]
- SPARC ALT-STOP-[command key]
- PowerPC ALT-Print Screen-[command key]
The command keys are as follows:
- s
- Attempts to sync all mounted file systems
- u
- Attempts to remount all mounted file systems to read-only
- b
- Attempts to immediately reboot your system
(This is effectively like hitting the reset switch or
power button on your box; processes will not
be given the chance to shut down.)
- p
- Prints the current set of registers and flags to the console
- t
- Prints the list of current tasks and related information to the
console
- e
- Sends a SIGTERM to all processes, with the exception of init
- i
- Sends a SIGKILL to all processes, with the exception of init
- l
- Sends a SIGKILL to all processes
Here's another interpretation:
- r
- Unraw: Restores the keyboard after an X crash or similar.
- 0
- Changes console loglevel to 0 and so reduces error messages.
- k
- System attention key: Kills all processes on the current virtual
console.
- e
- Terminate: Kills all processes except init on the current terminal.
- i
- Kill: Kills all processes except init, everywhere.
- s
- Sync: Attempts to sync all mounted filesystems. Outputs OK and Done
when it's managed. This can reduce the chances of needing to run fsck at a
later stage so it can be useful if you're having disk problems.
- u
- Umount: Attempts to remount all mounted filesystems read-only.
- b
- Reboot: immediately reboots the system without syncing or unmounting
disks. Not a good idea unless in extremis! This may lead to data loss.
- p
- Dumps current registers and flags to the console.
- m
- Dumps current memory info to the console.
The best series of sysreq keys to issue has luckily been solved by an
acronym found on the wikipedia link.
Raising Elephants Is So Utterly Boring, or BUSIER in reverse.
The series above will do the following:
- 1. R: Switch the keyboard from RAW mode to XLATE mode (ASCII Mode, sort
of.)
- 2. E: Terminate all processes, applications should gracefully close
- 3. I: Kill all processes, forcefully terminate all processses
- 4. S: Sync/flush data to the disk
- 5. U: Unmount all filesystems and remount as read only
- 6. B: Reboot the system
A few seconds pause should be used between each sysreq command issued so they
can take full effect.
Send mail to the Webmaster
 |
This site best viewed with a browser |
| Warning: This is a Debian centric site and MAY contain peanuts. |
| Many thanks to Debra Lynn and Ian Murdock for making Debian possible |
| First created Dec 14, 2008 ~ Last revised April 22, 2009 |