spacer.png, 0 kB


spacer.png, 0 kB
spacer.png, 0 kB
Home arrow The Blog arrow Instant Shutdown / Reboot
Instant Shutdown / Reboot Print E-mail

ImageAfter the long and dispiriting post about browser I decided to also post something short and fun for which you can see the results immediately.

We'll learn 2 things in one shot:

  • how-to fastest reboot/shutdown possible
  • what's the mysterious SysRq key

Rebooting this way is not recommended because hard drives will not be unmounted and will not sync. The safest way to do it I can think of is from NimbleX or another LiveCD.

Instant Reboot
Alt + SysRq + b

Instant Shutdown
Alt
+ SysRq + o

Next we'll see a picture to help you locate the SysRq key on your keyboard.

Image

What is this key?

System request (abbreviated SysRq) is a key on keyboards for PCs that has no standard use. This key can be traced back to the operator interrupt key used on IBM 3270-type console keyboards of the IBM System/370 mainframe computer, which was used to cause the operating system such as VM/370 or MVS to allow the console to give input to the operating system.

In Linux, the kernel can be configured to provide functions for system debugging and crash recovery. This use is known as the "Magic SysRq key".

The key combination consists of Alt + SysRq + another key, which controls the command issued.

Which are the other letter that can be used and what do they do?
r - Switch the keyboard from raw mode, used by X11, to XLATE mode
e - Send the SIGTERM signal to all processes except init (PID 1)
i - Send the SIGKILL signal to all processes, including init
s - Sync all mounted filesystems
u - Remount all mounted filesystems in read-only mode
b - Immediately reboot, without unmounting or syncing

Using the keys described so far you can perform a safe reboot. Read the first letters from bottom to top.

It's BUSIER spelled backwards :)
All you have to do for a safe Reboot is Alt+SysRq+r+e+i+s+u+b
It stands for Raw (take control of keyboard back from X), tErminate (send SIGTERM to all processes, allowing them to terminate gracefully), kIll (send SIGKILL to all processes, forcing them to terminate immediately), Sync (flush data to disk), Unmount (remount all filesystems read-only) and reBoot. These keystrokes should be entered a few seconds apart. This should prevent a fsck being required on reboot; it also gives some programs a chance to save emergency backups of unsaved work.

For the fans of the command line the same result can be obtained by echoing the respective letter in procfs.

Instant Reboot
echo b > /proc/sysrq-trigger

Instant Shutdown
echo o > /proc/sysrq-trigger

Disabling SysRq is done by a simple "echo 0 > /proc/sysrq-trigger"


I bet most of you didn't know that you can reboot your computer instantly without taking the hands of the keyboard. I bet most of you also didn't know what is the SysRq key from most keyboards (near F12).

 

If you want to read more click HERE.


Quote this article on your site | Views: 4331 | Print | E-mail

Comments (2)
RSS comments
1. 18-07-2008 02:24
 
Thanks for your comments. Are very pertinent.
IP: 141.85.0.113
 
Bogdan
2. 16-07-2008 20:41
 
Correction.
Quote: 
Switch the keyboard from raw mode, used by X11, to XLATE mode. 
 
X11 uses XLATE not raw. When you X server or a svgalib program crashes it 
switches to raw. Now you might consider to set it back to XLATE. 
 
Check this link for an alternative, but more cumbersome way. 
http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-9.html 
 
Quote: 
For the fans of the command line the same result can be obtained by echoing 
the respective letter in procfs. 
 
1) Make your readers aware that only when $TERM=linux, i.e. when you are on 
TTY (Ctrl-Alt-Fn), your commands would produce verbose output and behave 
properly. It is very important for "Sync" and "Umount" parameters which 
hasn't taken place until you see the "OK" and "Done" appear on the screen, 
but again you might not get such an output if something is messed up really 
bad. With xterm, gnome-terminal, etc. you don't get any feedback. 
 
Overall I suggest you to avoid echoing to /proc/sysrq-trigger and use 
keyboard sequences unless you running gnu/linux distro with keyboard where 
SysRq or PrtSc are absent (mac for instance) or not configured. 
Here is why. When you pass "e" parameter you'll end up logged off, same goes 
for "i" (SIGTERM and SIGKILL, respectively). So you'll have to login back 
again. It's not worth it. 
 
2) Make a note that "echo ? > /proc/sysrq-trigger" has to be performed with 
root privileges, where "?" is a number or letter. 
 
Quote: 
Disabling SysRq is done by a simple "echo 0 > /proc/sysrq-trigger" 
 
This action means that only emergency messages like PANICs or OOPSes would be 
printed on your console. This setting works for current session only. 
 
*To disable all SysRq calls for current session: 
echo 0 > /proc/sys/kernel/sysrq 
 
*To disable all SysRq calls for all subsequent sessions: 
echo "kernel.sysrq = 0" | sudo tee -a /etc/sysctl.conf 
 
*--It only has effect on calls via a keyboard. "echo ? > /proc/sysrq-trigger" 
with root privileges is always allowed; run with "h" to view all available 
sequences.
IP: 71.229.144.202
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • If your comment is not relevant it will be deleted. I don't want that.
Name:
E-mail
Title:
Comment:



Code:* Code

 
< Prev
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB