Recital

Login Register

HOWTO: force a immediate reboot of a remote Linux machine

 

Occasionally as a Linux administrator you will be in the situation where working on a remote server and you are left with no option but to force a reboot the system. This may be for a number of reasons, but where I have found it most frequent is when working on Linux clusters in a remote location.

When the "reboot" or "shutdown" commands are executed daemons are gracefully stopped and storage volumes unmounted.
This is usually accomplished via scripts in the /etc/init.d directory which will wait for each daemon to shut down gracefully before proceeding on to the next one. This is where a situation can develop where your Linux server fails to shutdown cleanly leaving you unable to administer the system until it is inspected locally. This is obviously not ideal so the answer is to force a reboot on the system where you can guarantee that the system will power cycle and come back up. The method will not unmount file systems nor sync delayed disk writes, so use this at your own discretion.

To force the kernel to reboot the system we will be making use of the magic SysRq key.

The magic_SysRq_key provides a means to send low level instructions directly to the kernel via the /proc virtual file system.


To enable the use of  the magic SysRq option type the following at the command prompt:

 

    echo 1 > /proc/sys/kernel/sysrq

 

Then to reboot the machine simply enter the following:

 

    echo b > /proc/sysrq-trigger


Voilà! Your system will instantly reboot.
{linkr:related;keywords:linux;limit:5;title:Related Articles}
{linkr:bookmarks;size:small;text:nn;separator:%20;badges:2,1,18,13,19,15,17,12}

Twitter

Copyright © 2024 Recital Software Inc.

Login

Register

User Registration
or Cancel