<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'><br>How about if you do lsusb in the background then check the PID to see if it's still running/stuck, like:<div><br></div><div>lsusb &gt;/dev/null 2&gt;&amp;1 &amp;</div><div>usbpid=$!</div><div>sleep 4 #or however long &gt; max lsusb exec time</div><div>if ps -p $usbpid &gt;/dev/null 2&gt;&amp;1</div><div>then</div><div>&nbsp; #lsusb is hung--do your stuff here, reboot etc.</div><div>fi<br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Todor Fassl" &lt;fassl.tod@gmail.com&gt;<br><b>To: </b>"Atlanta Linux Enthusiasts" &lt;ale@ale.org&gt;<br><b>Sent: </b>Tuesday, May 10, 2016 10:39:26 AM<br><b>Subject: </b>[ale] checking for process in uninterruptable sleep state<br><br>Okay, so my latest problem with these lab workstations is that accessing <br>the usb sub-system puts the calling process into an uninterruptable <br>sleep. I'd like to write a script to check for that so at least I'd know <br>that I have to go over and reboot the machine.<br><br>Details: I have 15 Dell workstations running ubuntu 15.10 (2 are running <br>16.04 -- that did not help). Occasionally, the keyboard and mouse <br>freeze. Logging in remotely and running lsusb hangs such that you can't <br>even control-c outand it cannot be killed even with a -9. The process <br>goes into an uninterruptable sleep during a system call to open the file <br>/sys/bus/usb/devices/usb1/descriptors. That file is part of the kernel's <br>control files for the usb controller itself. So you can see why the <br>keyboard and mouse are dead, the driver for the usb controller itself is <br>hung.<br><br>We've upgraded the kernel and installed Dell's latest bios upgrades. No <br>joy. I am thinking the only remaining thing to do is to file a bug <br>report. However, I could eleaviate the problem a little if I could <br>easily detect it &nbsp;and reboot.<br><br>The problem is that I can't figure out how to write a script to detect a <br>process in a uninterruptable sleep state. No matter what I do,it seems <br>to hang. I've tried something like "bash -c "lsusb' and 'timeout 5 <br>lsusb'. They both hang. &nbsp;The only thing I've been able to do is to have <br>2 different scripts. One running lsusb and another checking for blocked <br>lsusb procs. But that is way ugly.<br><br>PS: I wouldn't mind ideas wrt the original problem either. Not that I <br>hold out any hope for that.<br>-- <br>Todd<br>_______________________________________________<br>Ale mailing list<br>Ale@ale.org<br>http://mail.ale.org/mailman/listinfo/ale<br>See JOBS, ANNOUNCE and SCHOOLS lists at<br>http://mail.ale.org/mailman/listinfo<br></div><br></div></div></body></html>