# Can't kill a process



## bkouhi (Jun 10, 2013)

Hi.

This is the output of `ps aux`:


```
USER    PID  %CPU %MEM    VSZ    RSS TT  STAT STARTED        TIME COMMAND
...
javad 58722   0.0  0.0      0      0 v0  Z    12:00PM     0:00.03 <defunct>
javad 58380   0.0  0.0      0      0 v0  Z     9:14AM    14:25.23 <defunct>
...
```

I don't know why the process shown as <defunct>. It must be unrar or xfe. I tried different ways to kill that process but I'm unable to do this. I tried this ways (as root and also as my wheel user):

`# kill -9 58722`
`# pkill -9 unrar`

I also tried to kill the process using my window manager but the window manager is also unable to kill that process.

How can I kill that? Obviously if I reboot the machine, the process will be killed but it may happens again in the future and I don't want to reboot the machine every time a process crashes.


----------



## ShelLuser (Jun 10, 2013)

bkouhi said:
			
		

> I don't know why the process shown as <defunct>. It must be unrar or xfe.


Actually it*'*s none of the above. A defunct process is a so called zombie process, and as the name somewhat suggests it's already dead. And you can't kill that which is already dead (well, not in the real world).

What you could do is look up the parent process (shown in ps as PPID). `ps -l` should be able to come in handy there. When all else fails you could try to kill the parent after which the zombies will also disappear.

Be careful though and pay good attention. Because if the parent is already dead then there is a chance that the "master process" init has already taken custody of those zombies. And you know what happens if you kill init I hope...

Just in case: init, which has a program identifier ("PID") of 1, even on your system, is the 'mother of all processes'. A Unix system begins with the execution of init which then takes care to start the rest of the required processes.

As such _everything_ can be traced back to init. But; kill init and you're effectively (and dangerously) killing or resetting your server.

If these zombies have already been taken over by init then there's little you can do but to reset the machine, or wait if the processes go away by themselves.

You don't have to worry about resources too much, normally the only resource taken by a zombie process is a program ID.

Hope this helps.


----------



## bkouhi (Jun 10, 2013)

Thanks for the detailed answer. I found the parents and then killed them. Now the zombies are gone. I also killed some other processes and then started them again (tint2, conky, wbar, etc). They were unusable but killing them and then starting them again worked and my desktop become usable again. Thanks!


----------



## kpa (Jun 10, 2013)

By definition a zombie process is a process that has ended its execution but the parent of the process hasn't yet called wait(2) to fetch the exit status of the child process.


----------

