Wednesday, January 16, 2008

Rebooting linux without reboot command

Just a sample of how you can reboot or shutdown linux without issuing reboot command, so called hard reboot. That means that system will just make a reset as if you pressed a reset button, without running any shutdown scripts, etc. A kind of dangerous staff, but can be helpful in some occasions.


echo 1 > /proc/sys/kernel/sysrq 
echo b > /proc/sysrq-trigger
 
If you want to force shutdown machine try this.

echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

2 comments:

Dalibor said...

Don't forget to run sync before hard rebooting.
Or if you want 2 b h4ck3r again:
echo s > /proc/sysrq-trigger

Urgentissimo! said...

Great one!

I had "I/O errors" on a hard disk of a remote server but was still able to enter via ssh (almost any command failed with "disk I/O error").

After dumping the dmesg (that shows me some HDD Flush Cache failure) I was able to reboot using those two commands.