Onoccasion, my laptop has become stuck so I've used the magic key combination of Alt + SysRq + REISUB to perform a safe reboot. However, it doesn't seem to work for me as when I press the B key to complete the magic key command it simply says, "resetting..." and doesn't do anything.
The file is well documented and tells you exactly how to enable which features. The current default was picked for security purposes and should only be changed if you know why you need to (for security implications see #194676).
ATTRIBUTIONS:
_do_I_use_the_magic_SysRq_key which was based on the original work by
Credits
Written by Mydraal [email protected]
Updated by Adam Sulmicki [email protected]
Updated by Jeremy M. Dolan [email protected] 2001/01/28 10:15:59
Added to by Crutcher Dunnavant [email protected]
1 How do I get sysrq to behave the way I want?
1.1 What is the magic SysRq key?
1.2 How do I enable the magic SysRq key?
1.3 How do I use the magic SysRq key?
1.4 What are the 'command' keys?
1.5 Okay, so what can I use them for?
A common well known and used method of regaining use of machine after it freezing or locking with limitising the risk of disk corruption leading to system file damage or loss of data is to use
Alt + SysRq + r and then e and then i and then s and then u and then b and/or if needed (o)
Description of the problem:
By default SysRq is enabled by default on Ubuntu desktop systems which is invaluable when a system has locked up and you want to stop it as gently as possible or debug the issue. However many people are surprised that you can also ask it to dump the contents of current memory to the console (or dmesg) albeit only from the keyboard.
openSUSE sets a default bitmask of 176 on its SysRq that by default restricts you to sync, reboot and "remount read-only". This stops people using sysrq by default to inspect memory which sounds sensible.
Ubuntu Developers saw the need to do something about this and the best solution considering the possible complications of the mentioned observation is to apply bitmask 176 sysrq by default creating the need for user input to set sysrq as they desire. Bitmask 176 only allows S, U, B which is sync, remount mounted partitions and reboot.
Reading the full bug report and comments will highlight some options that may be applicable to your system.
One method of getting txt output regarding how your system is using sysrq is to apply sysrq commands from tty (when system not suffering from locks/freezes). Doing this may indicate sysrq has not been completely disabled but is using bitmask 176.
Note.
The value of /proc/sys/kernel/sysrq influences only the invocation via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always allowed (by a user with admin privileges-see below).
would set the T behave as SysRq
Note.
Some keyboards may not have a key labeled SysRq. The SysRq key is also known as the Print Screen key. Also some keyboards cannot handle so many keys being pressed at the same time, so you might have better luck with Alt + SysRq - SysRq then press command key then release everything. See the full writing of QA which this guide is based on _do_I_use_the_magic_SysRq_key.3F for more information regarding this.
Sak (Secure Access Key) is useful when you want to be sure there is no trojan program running at console which could grab your password when you would try to login. It will kill all programs on given console, thus letting you make sure that the login prompt you see is actually the one from init, not some trojan program. Others find it useful as (System Attention Key) which is useful when you want to exit a program that will not let you switch consoles. (For example, X or a svgalib program.)
Note.
In its true form it is not a true SAK like the one in a c2 compliant system, and it should not be mistaken as such.
Sync is great when your system is locked up, it allows you to sync your disks and will certainly lessen the chance of data loss and fscking.
Warning
The sync hasn't taken place until you see the "OK" and "Done" appear on the screen. (If the kernel is really in strife, you may not ever get the OK or Done message.
The loglevels 0-9 are useful when your console is being flooded with kernel messages you do not want to see. Selecting 0 will prevent all but the most urgent kernel messages from reaching your console.
Note.
They will still be logged if syslogd/klogd are alive
There are some keyboards that send different scancodes for SysRq than the pre-defined 0x54. So if SysRq doesn't work out of the box for a certain keyboard, run showkey -s to find out the proper scancode sequence. Then use setkeycodes 84 to define this sequence to the usual SysRq code (84 is decimal for 0x54). It's probably best to put this command in a boot script.
Warning
You exit showkey by not typing anything for ten seconds.
In order to register a basic function with the table, you must first include the header include/linux/sysrq.h, this will define everything else you need. Next, you must create a sysrq_key_op struct, and populate it with...
After the sysrq_key_op is created, you can call the kernel function register_sysrq_key(int key, struct sysrq_key_op *op_p); this will register the operation pointed to by 'op_p' at table key 'key', if that slot in the table is blank. At module unload time, you must call the function unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which will remove the key op pointed to by 'op_p' from the key 'key', if and only if it is currently registered in that slot. This is in case the slot has been overwritten since you registered it.
The Magic SysRq system works by registering key operations against a key op lookup table, which is defined in 'drivers/char/sysrq.c'. This key table has a number of operations registered into it at compile time, but is mutable, and 2 functions are exported for interface to it the register_sysrq_key and unregister_sysrq_key. Of course, never ever leave an invalid pointer in the table. ie; when your module that called register_sysrq_key() exits, it must call unregister_sysrq_key() to clean up the sysrq key table entry that it used.
Note.
Null pointers in the table are always safe.
If for some reason you feel the need to call the handle_sysrq function from within a function called by handle_sysrq, you must be aware that you are in a lock (you are also in an interrupt handler, which means don't sleep!), so you must call __handle_sysrq_nolock instead.
Use Alt + SysRq + S and then U and then B to sync, attempt to remount all mounted filesystems and then reboot if needed. Without changing a thing to system files.
If Alt + SysRq + B does not reboot system it may be necessary to edit /etc/sysctl.d/10-magic-sysrq.conf in order to allow the attempt of applying Alt + SysRq + B (or/and O after editing /proc/sys/kernel/sysrq bitmask to enable the reboot and shutting down of the system by use of sysrq. You could do this by any of the methods described above.
Relative interesting info-After watching 17 08 2013 episode of the BBC programme "Click" and the "cyberwarfare" article really caught my attention. The programme also have their own website Click if you can not watch the programme. FAWC
Make sure you are holding alt while pressing print screen + reisub. In my computer, if I press alt+print screen and release all buttons, then press reisub, it doesn't reboot my computer. Pressing alt and hold it, then press the other keys works. Hope it helps others.
The best thing about Apple's keyboard case is the feel of its keys. For me, the key travel is perfect, and it mirrors the feel of Apple's most recent MacBooks. I write fast and instinctually, and the positioning of the keys is pretty good for my muscle memory. The trackpad beneath is just the right size. Sure, it could be bigger, but it's big enough.
I'm talking about the 12-inch version of the Magic Keyboard -- the 11-inch model is a little more compressed. It works, but I also get that "typing on a Netbook" old-fashioned feeling I had years ago on 10-inch laptops. The side keys (Tab) and the edge-oriented keys (Return, some symbol keys) suffer the most. All the keyboard cases made for the 11-inch iPads have some sort of key compression like this, though.
The backlit keys are subtle and work well in low light or darkness, although sometimes the lights take too long to automatically turn off. And Apple has no key backlighting adjustment controls on the keyboard (which other keyboard cases often have).
The Magic Keyboard has one little bonus that's been super handy -- there's a pass-through charge port for USB-C on the side of the hinge. It's on the left side, while the USB-C port on the iPad is on the right. This means I can charge from either side at a desk, which is really important to prevent the iPad from becoming incredibly annoying. That port can't output to things like monitors (you need to use the iPad's own USB-C/Thunderbolt port for that), but it's a useful charge-up aid.
The Magic Keyboard folds smaller than most other keyboard cases, wrapping tightly around the iPad. But it lacks protection for the iPad sides, and the magnets can detach when inside a bag or if you drop the iPad, knocking the entire case loose.
Some iPad keyboard cases have extra rows of dedicated function keys, including volume control and play/pause buttons. I love these, and Apple oddly left them out on the Magic Keyboard. Apple has a lot of keyboard shortcuts in iOS, but dedicated function keys would be a great addition.
The Magic Keyboard's odd design means it can't fold all the way back, with the keyboard parked behind the screen. You either use it as a laptop-thing, or fold it shut. iPads are sketchpads and readers, too, and you can't use the iPad easily for those purposes with the Magic Keyboard on. That means popping the case off (it attaches with magnets), and then you're left holding a naked iPad. Surely Apple can figure this out? The old Smart Keyboard cover isn't as good for work, yet was more flexible as a folio case solution. But it doesn't work with the Magic Keyboard-compatible iPads (Air, Pro).
3a8082e126