[NCLUG] Can't kill process

Michael Dwyer mdwyer at sixthdimension.com
Mon Dec 9 09:24:58 MST 2002


Evelyn Mitchell wrote:
> * On 2002-12-07 00:37 BJ Tiemessen <tiemesse at CS.ColoState.EDU> wrote:
> 
>>I have a hung process than just won't die.  I was trying to install an 
>>RPM off a cdrom and now rpmdrake is hung and my cdrom drive has been 
>>spinning for a few hours.  I've spent an hour searching the internet and 
>>cant find any helpfull information on this.  I have tried kill -9 and 
>>killall but both fail to kill the process.  I was able to kill the 
>>parent processes so now the PPID is 1, but I still cant kill PID 7244. 
>>I know I could always reboot but I would like to learn how to do this 
>>just in case I ever run into this again in an environment where I cant 
>>reboot as easy.  
> 
> 
> You'll want to kill the process that has the open file on the cdrom.
> You can find that out by finding out which file is open:
>    lsof
> 
> Which creates a report:
> init         1     root  mem    REG        3,6    33960     393638
> /sbin/init
> init         1     root  mem    REG        3,6    87341     213361
> /lib/ld-2.2.9
> 3.so

If your distribution lacks lsof (it is often an optional install), you 
might still have the 'fuser' command, which does a little of the same 
thing.  It will tell you which process IDs have the specified file (or 
device) open.  It is also somewhat more scriptable:

   killall -9 `fuser foo`

Mind you, that last command is dangerous... :)  Don't ever do it like 
that, unless you are okay with accidently rebooting your system when you 
accidently kill init...




More information about the NCLUG mailing list