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.

This question already has an answer here:

I have a zombie process that refuses to be removed, have tried killall -9 1913 and pkill with no effect. Any help would be very much appreciated.Running Ubuntu 12.04.2 LTS. Thank you.

aruna@aruna-desktop:~$ ps -aux | grep Z
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
aruna     1913  0.0  0.0      0     0 ?        Z    12:07   0:00 [lightdm-session] <defunct>
share|improve this question

marked as duplicate by jasonwryan, Hauke Laging, Gilles, slm, Renan Jul 7 '13 at 4:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

2 Answers 2

It looks like the root cause of this zombie process is a bug that is described here.

Getting Rid of Zombie Processes:

You can’t kill zombie processes as you can kill normal processes with the SIGKILL signal — zombie processes are already dead. Bear in mind that you don’t need to get rid of zombie processes unless you have a large amount on your system – a few zombies are harmless. However, there are a few ways you can get rid of zombie processes.

One way is by sending the SIGCHLD signal to the parent process. This signal tells the parent process to execute the wait() system call and clean up its zombie children. Send the signal with the kill command, replacing pid in the command below with the parent process’s PID:

kill -s SIGCHLD pid

However, if the parent process isn’t programmed properly and is ignoring SIGCHLD signals, this won’t help. You’ll have to kill or close the zombies’ parent process. When the process that created the zombies ends, init inherits the zombie processes and becomes their new parent. (init is the first process started on Linux at boot and is assigned PID 1.) init periodically executes the wait() system call to clean up its zombie children, so init will make short work of the zombies. You can restart the parent process after closing it.

If a parent process continues to create zombies, it should be fixed so that it properly calls wait() to reap its zombie children. File a bug report if a program on your system keeps creating zombies.

You can find parent process id when you use l option with ps that is ps -l, it will show in PID and child process will show in PPID

You can also see process tree by using pstree command.

share|improve this answer
    
Thank you for the answer, it's way over my head right now but I understand some of it. This may sound simple to one who is experienced but HOW do I find the parent process ID of the zombie ? –  Aruna Hewapathirane Jul 6 '13 at 18:13
    
I have updated the answer –  Raza Jul 6 '13 at 18:24
    
Thank's again. Tried everything it still remains, am not woorired anymore since a zombie does not consume system resources and I just learnt a whole lot of stuff so am happy :-) –  Aruna Hewapathirane Jul 6 '13 at 18:38
add comment

Well, I would have said "you can't do that" before I googled up this stackoverflow question. It appears that you can use gdb to call the waitpid() system call in the parent process of the zombie process. Good trick.

My advice is to not do this: whatever "lightdm" is, it probably cleans up after exited child processes every so often, or maybe it assumes it does. If you do the waitpid() with gdb, you may hose up lightdm.

share|improve this answer
    
Many thank's very useful and I will look through the gdb trick and study it first before I try it.. –  Aruna Hewapathirane Jul 6 '13 at 18:36
add comment

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