REISUB Freeze resolution

Holding down [Alt] + [SysRq] (which is the Print Screen key) while slowly typing REISUB will get you safely restarted. REISUO will do a shutdown rather than a restart:

  • R: Switch the keyboard from raw mode to XLATE mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
  • U: Remount all mounted filesystems in read-only mode
  • B: Immediately reboot the system, without unmounting partitions or syncing

I'll try to explain those in an easily understandable way, but it might not necessarily be 100% complete or 100% correct:

  • R - switch the keyboard mode

    This is said to "Switch the keyboard from raw mode, the mode used by programs such as X11 and svgalib, to XLATE mode" (from Wikipedia), but I don't really know if this would normally have any notable effect.

  • E - gracefully terminate all running programs

    This sends the SIGTERM signal to all processes except init and thereby asks them to gracefully terminate, giving them a chance to tidy up and free their resources, save data, etc...

  • I - forcibly kill all running programs

    This is similar to the E, but sends the SIGKILL signal to all processes except init, which kills them immediately and forcibly.

  • S - sync all disks and flush their caches

    All your disks normally have a write cache, a piece of RAM where the system caches data it wants to save on the device, to speed the access up. Syncing tells the system to flush these caches now and perform all remaining writes. That way you do not lose any data that has already been cached but not been written yet, and it protects from leaving the file system in an inconsistent state.

  • U - unmount all disks and remount them read-only

    This is again pretty unspectacular, it simply makes all mounted disks read-only to prevent any further (partial) writes.

  • B - reboot the system

    This reboots the system. However, it does not perform a clean shutdown, but instead a hard reset.

However...

On Ubuntu, these SysRqs are normally masked and partially disabled. Only syncing, remounting read-only and shutting down/rebooting are enabled.

This is controlled by the kernel interface file /proc/sys/kernel/sysrq, which holds the decimal representation of a bitmask of the allowed SysRq actions. The Ubuntu default is 176. See this answer for loads of additional explanations and material.

So actually you could also just Alt + SysRq + { S | U | B }.