Gemini on Question 13, Sep 13
How do I kill a zombie process in Linux that won't respond to SIGTERM?The short answer is: You cannot kill a zombie process because it is already dead. Sending it a SIGTERM (or even a SIGKILL / kill -9) will not work.
A zombie process (usually marked with a Z or <defunct> in top or ps) is a process that has finished executing, but its parent process hasn't read its exit status yet.
To get rid of a zombie, you have to target its parent process. Here is how to do it:
Step 1: Find the Parent Process ID (PPID)
First, you need to find out which process spawned the zombie. Run the following command, replacing <ZOMBIE_PID> with the PID of your zombie process:
ps -o pid,ppid,state,cmd -p <ZOMBIE_PID>
If you don't know the zombie's PID, you can list all zombies and their parents using:
ps axo stat,ppid,pid,comm | grep -w defunct
Look at the PPID column. That is the Parent Process ID.
Step 2: Nudge the Parent (The Gentle Approach)
Sometimes, the parent process is just hanging and needs a reminder to check on its children. You can send a SIGCHLD signal to the parent. This tells the parent, "One of your children died, please collect its exit status."
kill -s SIGCHLD <PPID>
Wait a few seconds and check if the zombie is gone. If it is still there, move to Step 3.
Step 3: Kill the Parent Process (The Hard Approach)
⚠️ Warning: Before doing this, check what the parent process is. If the parent is a critical system service (like systemd, init, or your active SSH session), killing it could reboot your server or log you out.
If the parent process is poorly programmed or frozen, it will never reap the zombie. The only way to clear the zombie is to kill the parent process.
When a parent process dies, all of its zombie children are "orphaned" and automatically adopted by the system's root process (PID 1, usually systemd or init). PID 1 is designed to automatically clean up zombies immediately.
Kill the parent process using:
kill -15 <PPID>
If the parent also refuses to die, force kill it:
kill -9 <PPID>
Once the parent dies, the zombie will instantly vanish.
Troubleshooting Edge Cases
- •What if the Parent is PID 1?
If the zombie's parent is already PID 1 (initorsystemd), and it isn't being cleaned up, you are likely experiencing a bug in your init system. The only way to clear this is to reboot the system. - •Are you sure it's a Zombie? (The 'D' State)
People often confuse Zombie processes (Z) with processes in Uninterruptible Sleep (D).
If your process state isD(usually waiting on Disk I/O or a network share to respond), it cannot be killed, not even withkill -9. To fix aDstate process, you either have to fix the hanging hardware/network issue (e.g., unmounting a frozen NFS drive) or reboot the machine.
Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
- Scored
- answered
- Received
- 2026-09-13 09:05:08 UTC
- Run
- 20260913T090021Z-a7390a
- Served by
- Google · HTTP 200 · finish stop
- Size
- 2,869 characters · 1,876 tokens out incl. hidden reasoning · 15.1 s
End of response · 54 lines · 2,869 characters · sha256 2970750d0ec2249f4b706ac61f81e141e30268168c8e18123a3b3c13dc0c6fb5