Without a key generating the same scan code, which you don't have, the only option is to echo <char> > /proc/sysrq-trigger
, where <char>
is the key you'd press along with M-SysRq
. (This of course assumes you're running a kernel with magic SysRq compiled into it, and have previously done echo 1 > /proc/sys/kernel/sysrq
in /etc/rc.local
or similar.)
If you want real magic SysRq functionality, rather than the pale imitation obtained by echoing into random /proc entries, you'll want to find yourself a PC-style USB keyboard with a SysRq key. Linux will interpret the scan code properly no matter what architecture it's running on; the tricky part, in this case, is generating the scan code in the first place, which cannot be done from a standard Mac keyboard.
(On the other hand, it seems probable a kernel could be compiled to recognize a different scan code, such as that of the Mac's eject key, in place of SysRq; I've never felt the urge to downgrade my MBP, so wouldn't know firsthand, but I imagine someone's done it. Or perhaps you will be the first; after all, custom-hacking your kernel is half the fun of running Linux, or so I am given to understand.)
Update: Apparently this can be done from userspace:
Best way to go currently is to install (manually compile) the keyfuzz program and put
echo "786616 99" | keyfuzz -s -d /dev/input/by-id/usb-Apple_Inc._Apple_Internal_Keyboard___Trackpad-event-kbd
in your /etc/profile for instance. This maps Alt-Eject on a typical Apple Macbook Pro (mine is mid-2010, 6,2), to the Alt-SysRq combination.
If you're looking for more of an old-fashioned, "Two-Fisted Tales of Linux" sort of experience, there are some kernel patches linked from that comment thread, which may offer guidance in remapping keycodes at the kernel level.
Without a key generating the same scan code, which you don't have, the only option is to
echo <char> > /proc/sysrq-trigger
, where<char>
is the key you'd press along withM-SysRq
. (This of course assumes you're running a kernel with magic SysRq compiled into it, and have previously doneecho 1 > /proc/sys/kernel/sysrq
in/etc/rc.local
or similar.) – Aaron Miller – 2013-09-30T16:34:13.5531@AaronMiller I meant from the keyboard, without necessarily having logged in or anything. – Blacklight Shining – 2013-09-30T16:38:54.817
In that case, you'll want to find yourself a PC-style USB keyboard with a SysRq key. Linux will interpret the scan code properly no matter what architecture it's running on; the tricky part, in this case, is generating the scan code in the first place, which cannot be done from a standard Mac keyboard. – Aaron Miller – 2013-09-30T16:43:54.963
(On the other hand, it seems probable a kernel could be compiled to recognize a different scan code, such as that of the Mac's eject key, in place of SysRq; I've never felt the urge to downgrade my MBP, so wouldn't know firsthand, but I imagine someone's done it. Or perhaps you will be the first; after all, custom-hacking your kernel is half the fun of running Linux, or so I am given to understand.) – Aaron Miller – 2013-09-30T16:44:56.373
Well, that got rather long; comments converted to answer. – Aaron Miller – 2013-09-30T16:46:26.503