You are not logged in.

#1 2010-12-04 09:10:13

fu9ar
Member
Registered: 2010-12-02
Posts: 6

watchdog.h, /dev/watchdog, accidently rebooted my system

I borked something, but in an interesting way.

So there I was, turning on kernel threads in htop, sorting everything by PID and checking out the first things that were loading after the init[3] thread.  I found one called watchdog.  PID 5, this little puppy was running with RT priority here on my system.
htop screenshot
The first thing I do is run a:

man watchdog
No manual entry for watchdog

No dice.

find / | grep watchdog

I saw a file called /usr/include/linux/watchdog.h on my local machine and went to check it out to see if it could shed any light on the situation. 

Analysis: Collection of definitions that look like assembly tokens...  Is this accurate?

I plan to e-mail the address listed as the maintainer to ask some questions after I've done these tests.

I turned to the web now, firing up my trusty wifi card. 

Search Engine Time Warp Music

http://linux.die.net/man/8/watchdog

No manual entry on the local machine...  Where can I get the full man pages?

That led me to /dev/watchdog

The brash type I am, I decided to just fuck around with /dev/watchdog  I don't remember exactly what I did, I was using pipes and echo and cat and trying to see what the device did like a neanderthal handling a firearm.

I don't remember the exact command that caused the system reboot.  Further, there seemed to be some kind of delay between the command and the reboot.  I'm going to try some things and see if I can re-create the effect.  Documenting them here.

Basic system info
[root@fubar /]# uname -a
Linux fubar 2.6.33-ARCH #1 SMP PREEMPT Thu May 13 12:06:25 CEST 2010 i686 Intel(R) Atom(TM) CPU N270 @ 1.60GHz GenuineIntel GNU/Linux
Attempt 1
[root@fubar /]# echo /dev/watchdog
/dev/watchdog
[root@fubar /]# cat /dev/watchdog

that second one, returned some Permission Denied error and then, reboot came a short time later.  Apparently the abrubt reboot left some corrupted junk on my drive too, so I fixed it with a fsck in the repair shell...

Visually scanning through a cat of the

/home/lost+found

makes it look like some of the cache from firefox probably. 

Learned:  how to fsck and repair damage in the init 1 environment.

What happened?

Last edited by fu9ar (2010-12-04 12:18:14)

Offline

#2 2010-12-04 13:16:49

jauntale
Member
Registered: 2009-06-26
Posts: 27

Re: watchdog.h, /dev/watchdog, accidently rebooted my system

cat /dev/watchdog closes the device and after timeout watchdog reboots the system.

Offline

#3 2010-12-04 20:29:53

fu9ar
Member
Registered: 2010-12-02
Posts: 6

Re: watchdog.h, /dev/watchdog, accidently rebooted my system

How did cat close the watchdog?  Why does cat do this?  Bad cat!

/me downloads source code for GNU coreutils

Last edited by fu9ar (2010-12-04 20:33:33)

Offline

#4 2010-12-04 20:35:38

fr33ke
Member
Registered: 2010-08-21
Posts: 20

Re: watchdog.h, /dev/watchdog, accidently rebooted my system

The documentation is in the linux source tree Documentation/watchdog.

Offline

#5 2010-12-04 21:19:23

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: watchdog.h, /dev/watchdog, accidently rebooted my system

fu9ar wrote:

How did cat close the watchdog?  Why does cat do this?  Bad cat!

Never issue a command as root if you do not want the command to be completed successfully!  Cat did it's job and so did watchdog.


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#6 2010-12-04 22:03:02

fu9ar
Member
Registered: 2010-12-02
Posts: 6

Re: watchdog.h, /dev/watchdog, accidently rebooted my system

Part of the reason I posted this was for other newbies to learn from my "mistakes".

Also, breaking things is fun! big_smile

Last edited by fu9ar (2010-12-04 22:10:48)

Offline

#7 2010-12-04 23:58:12

hellnest
Member
From: $ dmesg | grep ATA
Registered: 2010-11-11
Posts: 194
Website

Re: watchdog.h, /dev/watchdog, accidently rebooted my system

fu9ar wrote:

How did cat close the watchdog?  Why does cat do this?  Bad cat!

/me downloads source code for GNU coreutils

LoL ... naughty cat big_smile


roll Snapping my own life roll
hmmgithubhmm
coolMyBlogcool

Offline

Board footer

Powered by FluxBB