Cookie Consent by TermsFeed

How to force reboot a frozen Linux or FreeBSD machine

How to force reboot a frozen Linux or FreeBSD machine

Sometimes your filesystem gets stuck. No operations can be done and a “reboot” will just cause an indefinite waiting time for I/O. You could be able to ssh into the server (or login via console), but no operations can be done as the storage devices are blocked. This may happen because of a file system failure or a strange kernel problem. This is more likely to happen when dealing with usb attached external interfaces.

There’s a “magical” code that triggers a specific kernel condition - and a reboot. Be careful, those commands should be considered as the last resort. No disk flush will be performed, no shutdown procedure will be started so you might completely destroy your file system or any open file.

Yet, this could be the best option you have and won’t be more harmful than a hard reset or a “traditional” cable pull - but you can do this remotely.

Remember to launch those commands with root privileges:

On Linux:

echo b > /proc/sysrq-trigger

This will trigger an immediate reboot - no further disk operation will be performed.

On FreeBSD:

sysctl debug.kdb.panic=1

This will trigger a kernel panic that will (by default) cause a reboot.


See also