| .. | .. |
|---|
| 48 | 48 | How do I use the magic SysRq key? |
|---|
| 49 | 49 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 50 | 50 | |
|---|
| 51 | | -On x86 - You press the key combo :kbd:`ALT-SysRq-<command key>`. |
|---|
| 51 | +On x86 |
|---|
| 52 | + You press the key combo :kbd:`ALT-SysRq-<command key>`. |
|---|
| 52 | 53 | |
|---|
| 53 | | -.. note:: |
|---|
| 54 | + .. note:: |
|---|
| 54 | 55 | Some |
|---|
| 55 | 56 | keyboards may not have a key labeled 'SysRq'. The 'SysRq' key is |
|---|
| 56 | 57 | also known as the 'Print Screen' key. Also some keyboards cannot |
|---|
| .. | .. |
|---|
| 58 | 59 | have better luck with press :kbd:`Alt`, press :kbd:`SysRq`, |
|---|
| 59 | 60 | release :kbd:`SysRq`, press :kbd:`<command key>`, release everything. |
|---|
| 60 | 61 | |
|---|
| 61 | | -On SPARC - You press :kbd:`ALT-STOP-<command key>`, I believe. |
|---|
| 62 | +On SPARC |
|---|
| 63 | + You press :kbd:`ALT-STOP-<command key>`, I believe. |
|---|
| 62 | 64 | |
|---|
| 63 | 65 | On the serial console (PC style standard serial ports only) |
|---|
| 64 | 66 | You send a ``BREAK``, then within 5 seconds a command key. Sending |
|---|
| 65 | 67 | ``BREAK`` twice is interpreted as a normal BREAK. |
|---|
| 66 | 68 | |
|---|
| 67 | 69 | On PowerPC |
|---|
| 68 | | - Press :kbd:`ALT - Print Screen` (or :kbd:`F13`) - :kbd:`<command key>`, |
|---|
| 70 | + Press :kbd:`ALT - Print Screen` (or :kbd:`F13`) - :kbd:`<command key>`. |
|---|
| 69 | 71 | :kbd:`Print Screen` (or :kbd:`F13`) - :kbd:`<command key>` may suffice. |
|---|
| 70 | 72 | |
|---|
| 71 | 73 | On other |
|---|
| .. | .. |
|---|
| 73 | 75 | let me know so I can add them to this section. |
|---|
| 74 | 76 | |
|---|
| 75 | 77 | On all |
|---|
| 76 | | - write a character to /proc/sysrq-trigger. e.g.:: |
|---|
| 78 | + Write a character to /proc/sysrq-trigger. e.g.:: |
|---|
| 77 | 79 | |
|---|
| 78 | 80 | echo t > /proc/sysrq-trigger |
|---|
| 81 | + |
|---|
| 82 | +The :kbd:`<command key>` is case sensitive. |
|---|
| 79 | 83 | |
|---|
| 80 | 84 | What are the 'command' keys? |
|---|
| 81 | 85 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| .. | .. |
|---|
| 171 | 175 | useful when you want to exit a program that will not let you switch consoles. |
|---|
| 172 | 176 | (For example, X or a svgalib program.) |
|---|
| 173 | 177 | |
|---|
| 174 | | -``reboot(b)`` is good when you're unable to shut down. But you should also |
|---|
| 175 | | -``sync(s)`` and ``umount(u)`` first. |
|---|
| 178 | +``reboot(b)`` is good when you're unable to shut down, it is an equivalent |
|---|
| 179 | +of pressing the "reset" button. |
|---|
| 176 | 180 | |
|---|
| 177 | 181 | ``crash(c)`` can be used to manually trigger a crashdump when the system is hung. |
|---|
| 178 | 182 | Note that this just triggers a crash if there is no dump mechanism available. |
|---|
| 179 | 183 | |
|---|
| 180 | | -``sync(s)`` is great when your system is locked up, it allows you to sync your |
|---|
| 181 | | -disks and will certainly lessen the chance of data loss and fscking. Note |
|---|
| 182 | | -that the sync hasn't taken place until you see the "OK" and "Done" appear |
|---|
| 183 | | -on the screen. (If the kernel is really in strife, you may not ever get the |
|---|
| 184 | | -OK or Done message...) |
|---|
| 184 | +``sync(s)`` is handy before yanking removable medium or after using a rescue |
|---|
| 185 | +shell that provides no graceful shutdown -- it will ensure your data is |
|---|
| 186 | +safely written to the disk. Note that the sync hasn't taken place until you see |
|---|
| 187 | +the "OK" and "Done" appear on the screen. |
|---|
| 185 | 188 | |
|---|
| 186 | | -``umount(u)`` is basically useful in the same ways as ``sync(s)``. I generally |
|---|
| 187 | | -``sync(s)``, ``umount(u)``, then ``reboot(b)`` when my system locks. It's saved |
|---|
| 188 | | -me many a fsck. Again, the unmount (remount read-only) hasn't taken place until |
|---|
| 189 | | -you see the "OK" and "Done" message appear on the screen. |
|---|
| 189 | +``umount(u)`` can be used to mark filesystems as properly unmounted. From the |
|---|
| 190 | +running system's point of view, they will be remounted read-only. The remount |
|---|
| 191 | +isn't complete until you see the "OK" and "Done" message appear on the screen. |
|---|
| 190 | 192 | |
|---|
| 191 | 193 | The loglevels ``0``-``9`` are useful when your console is being flooded with |
|---|
| 192 | 194 | kernel messages you do not want to see. Selecting ``0`` will prevent all but |
|---|
| .. | .. |
|---|
| 231 | 233 | handler is called. Your handler must conform to the prototype in 'sysrq.h'. |
|---|
| 232 | 234 | |
|---|
| 233 | 235 | After the ``sysrq_key_op`` is created, you can call the kernel function |
|---|
| 234 | | -``register_sysrq_key(int key, struct sysrq_key_op *op_p);`` this will |
|---|
| 236 | +``register_sysrq_key(int key, const struct sysrq_key_op *op_p);`` this will |
|---|
| 235 | 237 | register the operation pointed to by ``op_p`` at table key 'key', |
|---|
| 236 | 238 | if that slot in the table is blank. At module unload time, you must call |
|---|
| 237 | | -the function ``unregister_sysrq_key(int key, struct sysrq_key_op *op_p)``, which |
|---|
| 238 | | -will remove the key op pointed to by 'op_p' from the key 'key', if and only if |
|---|
| 239 | | -it is currently registered in that slot. This is in case the slot has been |
|---|
| 240 | | -overwritten since you registered it. |
|---|
| 239 | +the function ``unregister_sysrq_key(int key, const struct sysrq_key_op *op_p)``, |
|---|
| 240 | +which will remove the key op pointed to by 'op_p' from the key 'key', if and |
|---|
| 241 | +only if it is currently registered in that slot. This is in case the slot has |
|---|
| 242 | +been overwritten since you registered it. |
|---|
| 241 | 243 | |
|---|
| 242 | 244 | The Magic SysRQ system works by registering key operations against a key op |
|---|
| 243 | 245 | lookup table, which is defined in 'drivers/tty/sysrq.c'. This key table has |
|---|
| .. | .. |
|---|
| 284 | 286 | Credits |
|---|
| 285 | 287 | ~~~~~~~ |
|---|
| 286 | 288 | |
|---|
| 287 | | -Written by Mydraal <vulpyne@vulpyne.net> |
|---|
| 288 | | -Updated by Adam Sulmicki <adam@cfar.umd.edu> |
|---|
| 289 | | -Updated by Jeremy M. Dolan <jmd@turbogeek.org> 2001/01/28 10:15:59 |
|---|
| 290 | | -Added to by Crutcher Dunnavant <crutcher+kernel@datastacks.com> |
|---|
| 289 | +- Written by Mydraal <vulpyne@vulpyne.net> |
|---|
| 290 | +- Updated by Adam Sulmicki <adam@cfar.umd.edu> |
|---|
| 291 | +- Updated by Jeremy M. Dolan <jmd@turbogeek.org> 2001/01/28 10:15:59 |
|---|
| 292 | +- Added to by Crutcher Dunnavant <crutcher+kernel@datastacks.com> |
|---|