LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What if 'kill -9' fails to kill a task? (https://www.linuxquestions.org/questions/linux-newbie-8/what-if-kill-9-fails-to-kill-a-task-265861/)

chii-chan 12-13-2004 06:13 AM

What if 'kill -9' fails to kill a task?
 
What should I do if even 'kill -9 PID' won't kill the stalled/defunctioned task/process? Any other powerful way of killing that task/process?

(Other than halt -p or something similar to that...) :)

trickykid 12-13-2004 07:25 AM

What kind of process is it? Does it have any parent ID's running?

enigma82 12-13-2004 09:41 AM

Normally it SHOULD NOT HAPPEN!
"kill -9 PID" should and it does kill anything. You can kill even PID 0 (init) - if you are root of course.

Try running kill -9 PID under root credentials. I hope it works for you.
This is the most powerful way of killing processes.


BTW, try using KILL -HUP PID (i think this also does the job).

visaris 12-13-2004 11:45 AM

Sometimes a process will be waiting for kernel to do some I/O and the kernel is waiting for a timeout because of a hardware error, etc. This can happen if you try to do a file copy for instance and a harddrive fails. The 'cp' command may not be killable until the kernel timeout has occurred (this may hang indefinately).

So yeah. Sometimes, you're just shit out of luck.

foo_bar_foo 12-13-2004 03:32 PM

Quote:

Originally posted by visaris


Sometimes, you're just shit out of luck.

yea sometimes you just can't kill stuff till init goes down and kills off (infantacides) :) her lost/confused children

chii-chan 12-13-2004 04:33 PM

The irritating programs most of the time are wine , gqview and nautilus (for gnome 2.8 that comes with Fedora Core 3. The versions before 2.4 are just ok.).. I'm sure it was not due to any hardware problems. I've tried killing them as root though and I found that if the status is 'DEFUNC' in ps aux, there's no hope other than 'halt =p' or 'reboot'. (I haven't tried 'kill hup process' but it is the same as kill -1 process if I'm not mistaken').

I just have a feeling of banging my head agaist the monitor everytime it happened, reminescent of my Windoze days... May be sometime out of luck...

Btw, the parent process was only WindowMaker, and when this happened sometimes I can't even kill WindowMaker and not even rebooting. (Usually restarting X do help killing those stalled programs). Reset button was my only best friend.

Tinkster 12-13-2004 05:06 PM

What kernel and graphics hardware are you using?
If these things happen often there may be an issue
with how your kernel and hardware interact.


Cheers,
Tink

twantrd 12-13-2004 08:00 PM

Usually if kill -9 doesn't work for me then I would do a 'pkill -9 PID' which works more of the time. Also 'kill -1' (also known as 'kill -HUP') doesn't really kill the process. It actually reloads the configuration for that process. Like say if you have DNS (named) running and want to reload the new modified conf files then you would do a 'kill -1 <PID of named>' and that reloads the new configs.

-twantrd

chii-chan 12-13-2004 08:37 PM

For the one I have lots of problems are Fedora Core 3. It is on kernel-2.6.9-1.667, and NVIDIA-GeForce FX using NVIDIA-Linux-x86-1.0-6629-pkg1. I'm using WindowMaker 0.91 on this setup, and I think may be somehow it conflicts with GNOME 2.8. I haven't tried KDE. But may be the problems lies in the nautilus itself where you have to let it finish listing the whole directory and calculating how many files inside there before you can change to another directory. It really slows thing down. Then when my friend (he has no Linux knowledge but let him familiarize with Linux) read some manga, after sometime, the nautilus hang when he tried to open some directory quickly. And for gqview, as I let it open automatically when I click a picture in nautilus, so when nautilus hang, it would also hang. And I'm also using the developmental version of it so it is expectable. I don't have wine one this setup because the wine for kernel 2.6 can't run anything I'm used to run using older version for kernel 2.4.

On the second setup, on the same computer, I have Fedora Core 1 with kernel 2.4.22-1.2115 and NVIDIA-Linux-x86-1.0-6106-pkg1 driver. I've no problem with this one really even though I'm using WindowMaker 0.91 and doesn't seem to conflict with GNOME 2.4. This one never give me any problem that I can say you can turn on this computer forever and it will never hang. It is just that sometime when the wine refuse to be killed that I have to reboot it.

The third setup is on Redhat 8.0 custom kernel 2.4.25 with NVIDIA Geforce2 MX with NVIDIA-Linux-x86-1.0-6106-pkg1 driver. This setup never give me any problem at all except for faulty memory modules that I've removed and unstable winmodem driver that spontaneously disconnect sometime.

So far, most of my problem is with Fedora Core 3, and maybe kernel 2.6, and nautilus 2.8. May be it is with the WindowMaker itself, because I read lots of peole saying Fedora Core 3 is the most stable release for Redhat and Fedora. Some even claim of ease of use and setup like Windows. I don't think so.

And thanks for 'pkill'. I never know there is such command to try. And since I'm not at the problematic setup I can't test that.

btmiller 12-13-2004 08:45 PM

Unfortunately there are certain states in which a process cannot be killed. Zombie (defunct) processes can't be killed, even with kill -9 (you can't kill the living dead, after all). For a zombie, the thing to do is try and kill its parent, which will cause it to be adopted by init and reaped. If processes are stuck in uninterruptible I/O there might be a dodgy device like a disconnected NFS server causing the problem.

BTW, enigma82, init is PID #1 (PID #0 is either the swapper or in some systems the pager), and init never receives any signal it doesn't want (even from root), -- this is hard-coded into the kernel (see the comment on line 568 in arch/i386/kernel/signal.c of the 2.6.9 Linux kernel).

MainframeGuy 12-14-2004 06:44 AM

try skill?
 
I am just a n00b - but isn't SKILL the next step up for this problem?

If I am wrong feel free to slap me with a kipper! ;)

mhearn 12-14-2004 07:56 AM

Wine was zombified on some 2.6 kernels due to a kernel bug, but I think it's fixed now.

valajbeg 01-17-2010 05:52 AM

Quote:

Originally Posted by btmiller (Post 1349020)
Unfortunately there are certain states in which a process cannot be killed. Zombie (defunct) processes can't be killed, even with kill -9 (you can't kill the living dead, after all). For a zombie, the thing to do is try and kill its parent, which will cause it to be adopted by init and reaped. If processes are stuck in uninterruptible I/O there might be a dodgy device like a disconnected NFS server causing the problem.

BTW, enigma82, init is PID #1 (PID #0 is either the swapper or in some systems the pager), and init never receives any signal it doesn't want (even from root), -- this is hard-coded into the kernel (see the comment on line 568 in arch/i386/kernel/signal.c of the 2.6.9 Linux kernel).

what would be solution for killing uninterruptible process, how to remove it???

I'm having similar problems with kate, probbably be cause the folder that i mount via sshfs and when connection fails the kate goes to interruptible state and i can't get kate running again...


what should i do there?

btmiller 01-17-2010 11:17 AM

Wow, this was an old thread... In general I've never found a good way to kill processes locked up in iowait. Have you tried forcibly unmounting the sshfs file system? I do this for NFS sometimes. Do be careful, however, as forcibly unmounting things can theoretically lead to data corruption (although it's never happened to me with an NFS export, YMMV). In a lot of cases, I simply reboot to avoid leaving the system in an inconsistent state.

Disillusionist 01-17-2010 12:31 PM

Be sure to check the system logs before doing things the windows way and rebooting...

In some situations a reboot could make life more difficult (especially if the issue is caused by a hardware failure)


All times are GMT -5. The time now is 01:15 PM.