How to force reboot a Linux machine Print

  • 4

Sometimes we find ourselves in sticky situations, where devices have locked up, or multiple disk mounts have ceased -- or sometimes even worse! The quickest and often safest route to normality is to reboot the machine.

But wait! If we simply issue an ordinary 'reboot' command, the locked up devices or broken disk mounts may never allow us to gracefully reboot. So what do we do? We force a reboot!

Now please note, and read very carefully. This method is unsafe. This is a strong warning. It is not potentially unsafe, or sometimes unsafe. It is always unsafe. You could corrupt your entire filesystem, or worse. Execute with caution.

Once logged into SSH or console, paste in the following command and your server will instantly reboot. When we say instantly, we mean it. There is no going back!
echo 1 > /proc/sys/kernel/sysrq && echo b > /proc/sysrq-trigger

So what do does this command actually do? The first step enables the magic SysRq key. This allows us to communicate directly with the kernel. The second step sends the 'b' trigger (for reboot) to sysrq which forces a reboot.

In a few moments your system should freshly reboot as if you'd pressed the 'reset' button on the physical chassis. If it doesn't you're in a lot of trouble, and it's time to inspect the hardware (or software configuration) more closely.
 

Was this answer helpful?

« Back