You know that though Ubuntu is rock solid, not always foolproof. Sometimes, an application or bug may hang the system and not allow you to launch the console to perform any operation or restart the computer, etc. In those extreme cases where you have no other output, instead of turning off the equipment by pressing and holding the on / off button or with the reset button, you have another option.
This option is to press a combination of keys as they are Alt + Print Screen + REISUB. That makes the system responsive and reboots to get out of that frozen state. Remember that you must hold down the Alt + Print Screen keys and then you can press the following keys one by one without having to hold them all at the same time (obviously): R, E, I, S, U, and B. The problem is that it may not work in some version of Ubuntu ...
What this function does is activate a SysReq (System Request) or request to the system for the kernel to respond to that request and, in this case, reboot the frozen system. The keys are used to:
- A: Returns control to the keyboard or unRaw.
- E: Terminate all processes or tErm.
- I: kill the processes that remain alive or fullkIll.
- S: Synchronize the discs or Sync.
- U - Mount all file systems as read-only or Umount.
- B: restart the computer or reBoot.
If your version of the system is disabled by default, it can be easily fixed. For activate it and the system attends the sequences that follow Alt + Imp Pant to perform different functions (since there are more than these that I have shown), you have to do the following:
echo "kernel.sysrq = 1" >> /etc/sysctl.d/99-sysctl.conf
Another option is to use the following command that would have the same effect:
sysctl -w kernel.sysrq=1
Remember that for the previous commands you need privileges, so do it preferably with sudo or, failing that, as root.
And from now on, the key combination should work ... Remember that if you change it in the / proc / sys / kernel / sysrq file, it will work, but it will not survive when you reboot the system, so you will have to change it again. That is, it is not permanent.
More about magic SysRq
What you just did with the command from the previous device is to change the kernel configuration to set it to a value of 1 which enables all the SysRq functions. But you must know that there is other possible values, in case you are interested in using them:
- 0 - Disable SysRq completely.
- 1 - Enable all SysRq features.
- > 1: bit mask to allow certain functions:
- 2: enables console control at the log level.
- 4: enable keyboard control (SAK, unraw)
- 8 - Enable process debug dumps, etc.
- 16: enable sync command.
- 32: enables remount in read-only mode.
- 64: enable process signaling (term, kill, oom-kill)
- 128: allow reboot / poweroff.
- 176 - Allows sync only, reboot, and remount in read-only mode.
- 256: allows nicing of all RT tasks
That said, too there are other keys magic other than R, E, S, I, U, B, which you can use to make certain requests to the operating system. They can be used in sequence like RESIUB, but also isolated, like Alt + Screenprint + S, Alt + Screenprint + B, etc. And so that you know more possibilities, here is a list:
- B: reboot the computer insecurely. That is, without synchronizing the disk buffers, or unmounting the mounted partitions. This can cause data to be lost or some data that was being written to get corrupted. It is like pressing the physical reset button or pressing the ON / OFF button of other portable equipment or AIO.
- C: forces a crash, dumping the main system memory to disk.
- D: will mount the system locks.
- E: sends a SIGTERM signal to all processes except init / systemd / upstart,… That is, it kills all running processes except that one.
- F: invokes an OOM Kill, to solve some cases when the system is out of memory.
- G: enter console debug mode, using framebuffer.
- H: will show help on using SysRq.
- J: forces a freeze of the filesystems or file systems by using FIFREEZE.
- K: kill all the console processes you are using. That also includes the graph.
- L: shows a stack backtrace of all active CPUs in the system. If there are any inactive or manually disabled, it will not show anything about them.
- M: shows information from your memory.
- N: reset to niceness defaults for all high priority and RealTime processes. That will alleviate resource contention problems.
- Or: it will completely shut down the computer. That is, it does not leave it dormant like a halt.
- P: show registers and flags.
- Q: show all active timers and clock sources.
- A: Change the keyboard mode from RAW to XLATE.
- S: it will synchronize the buffers of the disk or disks, that is, the memories that store access operations to be done. So your data doesn't get corrupted if you remove the drive or if you restart suddenly.
- T: displays a list of tasks.
- U: change the mounting mode of partitions to read-only or read-only.
- V: force the reset of the framebuffer console.
- W: shows you a list of blocked tasks.
- Space bar: will show the magic SysRq keys available on your computer.
Remember that not all of these will work in all modes ...