8

I read this from here:

The most useful combination is the Alt+SysRq/Prnt Scrn + R-E-I-S-U-B.

The above basically means that while you press and hold Alt+SysRq/Prnt Scrn and press R, E, I, S, U, B giving sufficient time between each of these keys to ensure they perform the required job.

My question is: How long should I wait to ensure "sufficient time" between each of these keys?

BufBills
  • 3,035
  • 7
  • 22
  • 20

1 Answers1

10

Forget about REISUB. I don't know who invented this, but it's overly complicated: half the steps are junk. If you're going to unmount and reboot, you only need two steps: U and B. At most three steps E, U, B.

Alt+SysRq+R resets the keyboard mode to cooked mode (where typing a character inserts that character). That's useful if a program died and left the console in raw mode. If you're going to reboot immediately, it's pointles.

Alt+SysRq+E and Alt+SysRq+I kills processes. E sends processes the SIGTERM signal, which causes some programs to save their state (but few do this). If you do E, there's no fixed delay: typically, after a few seconds, either the program has done what it was going to do or it won't do it. I sends processes the SIGKILL signal, which leaves the system unusable (only init is still running) and is pointles anyway if you're going to reboot immediately.

Alt+SysRq+S synchronizes the file contents that are not yet written to disk. U does that first thing, so doing S before U is pointless.

Alt+SysRq+U remounts filesystems read-only. If you can see the console, wait until the message Emergency Remount complete. Otherwise, wait until disk activity seems to have died down.

Finally Alt+SysRq+B reboots the system without doing anything, not even flushing disk buffers (so you'd better have done it afterwards, preferably as part of Alt+SysRq+U which marks disks as cleanly unmounted).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • Gilles: Is Alt+SysRq+U and the output `Emergency Remount complete` the only output to wait for? Then is it Ok to press Alt+SysRq+ ..R,E,I,S,U...wait for output...B? (Where REISU are imeidiate after the previous one, and the B one is after waiting for `Emergency Remount complete`) – ConfusedStack Dec 21 '13 at 02:42
  • @ConfusedStack Yes, you can do “R E I S U wait B”. It's equivalent to “U wait B”. – Gilles 'SO- stop being evil' Dec 21 '13 at 18:06
  • 1
    Note that some file systems or block devices rely on user level programs (fuse, nbd, ddsnap...), that's cases where you may want to avoid E and I. – Stéphane Chazelas Dec 22 '13 at 21:58
  • I think `(S)ync` flushes all block devices in addition to flushing file systems which I don't `(U)mount` does, so a `E`, wait, `I`, wait, `S` for instance would make sense in the case of a `kvm` virtual machine with a virtual disk on a LV. – Stéphane Chazelas Dec 22 '13 at 22:05
  • Note that `init` may respawn some processes, so the system may very well be usable after `I`. Also, if you're going to do `S`, you may want to make sure nothing write to the block devices and file systems after, so `I` makes sense. – Stéphane Chazelas Dec 22 '13 at 22:09
  • @StephaneChazelas Indeed, it looks like [emergency sync](http://lxr.linux.no/linux+v3.12.6/fs/sync.c#L117) syncs everything but [emergency remount](http://lxr.linux.no/linux+v3.12.6/fs/super.c#L799) only looks at filesystems. That would make the sequence U,S,B then, or S,E,see if init respawns enough stuff and if not B. Not that there's that much point in not rebooting if all but init has been restarted. – Gilles 'SO- stop being evil' Dec 22 '13 at 22:22