Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a command like

vi > out
vi | out

That I could use to cause a watchdog reset of my embedded linux device?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

If you have a watchdog on your system and a driver that uses /dev/watchdog, all you have to do is kill the process that is feeding it; if there is no such process, then you can touch /dev/watchdog once to turn it on, and if you don't touch it again, it will reset.

You also might be interested in resetting the device using the "magic sysrq" way. If you have a kernel with the CONFIG_MAGIC_SYSRQ feature compiled in, then you can echo 1 > /proc/sys/kernel/sysrq to enable it, then echo b > /proc/sysrq-trigger to reboot. When you do this, it reboots immediately, without unmounting or or syncing filesystems.

share|improve this answer
1  
Simply killing the watchdog daemon might not be good enough. Depending on how the watchdog device is configured it might disable the watchdog if /dev/watchdog is closed. In that case you can try sending SIGSTOP to your watchdog process instead. –  Kristof Provost Feb 7 '13 at 15:22

If you think the watchdog is running OK, and want to test that it really is capable of recovering a crashed system, then you can do one better than Shawn's answer by using the "magic sysrq" to crash the system with a kernel panic. Syncing your file system first is a good idea, so do something like this as root:

sync; sleep 2; sync; echo c > /proc/sysrq-trigger

That should cause a kernel panic if the sysrq is enabled. Then if you wait around 60 seconds (typical time-out for the watchdog module) you should see the machine reboot. Please note this will only work with hardware watchdogs and not the 'softdog' module.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.