MODELDRIFT.WATCH

Question 13 · Sep 10 · Day 1

Gemini on Question 13, Sep 10

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.

By definition, a zombie process (state Z in Linux) has already completed execution. It takes up no CPU or memory. The only reason it still exists is because its parent process hasn't read its exit status yet. Because the zombie is dead, it will ignore all signals, including SIGTERM (kill -15) and SIGKILL (kill -9).

To get rid of a zombie, you must deal with its parent. Here is how to do it step-by-step:

Step 1: Find the Parent Process ID (PPID)

First, you need to find the ID of the process that spawned the zombie. Run the following command (replace <zombie_PID> with the ID of your zombie process):

ps -o ppid= -p <zombie_PID>

Alternatively, you can list all zombies and their parents with: ps -A -ostat,pid,ppid,cmd | grep -e '^[Zz]' (The third column is the PPID).

Step 2: Nudge the Parent Process

Sometimes, the parent process just needs a reminder to check on its children. You can send a SIGCHLD signal to the parent, which tells it "one of your child processes has died, please clean it up."

kill -s SIGCHLD <PPID>

Check if the zombie is gone. If it is, you're done!

Step 3: Kill the Parent Process

If the parent process is frozen, poorly programmed, or refusing to clean up the zombie, your only option is to kill the parent.

Warning: Make sure you know what the parent process is before doing this. Killing it might stop a service you are currently using.

First, try to kill the parent gracefully:

kill <PPID>

If the parent refuses to die, force kill it:

kill -9 <PPID>

What happens next?
When the parent dies, the zombie process becomes an "orphan." In Linux, orphaned processes are immediately adopted by the init or systemd process (PID 1). PID 1 is programmed to automatically clean up (reap) any zombies it adopts. The zombie will instantly disappear.


A Common Mix-Up: Is it actually in "D" State?

Often, people confuse a Zombie process (Z) with a process in Uninterruptible Sleep (D state).

If you run top or ps aux and the process has a D next to it, it is not a zombie. It is a living process that is stuck waiting on hardware (like a disconnected network drive, a failing hard drive, or a USB issue).

  • •You cannot kill a D state process with kill -9.
  • •To fix a D state process, you either have to restore the hardware connection it is waiting for, or reboot the server.

sha256 eb5f606f2d66… · 18 tokens in · 1,577 out · 14.2 s · via Google · stopped on its own

Sep 10, the whole dayQuestion 13, every day

Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
Model
google/gemini-3.1-pro-preview
pinned google/gemini-3.1-pro-preview-20260219; no alias snapshot recorded that day
Date
2026-09-10 · run 20260910T221001Z-bb5bd1 · scorer v1
Scored
answered
sha256
eb5f606f2d66c889ca7d2178c60e0adfe486c858d78b9f7e5a67edc8c515919b
Permalink
https://modeldrift.watch/r/2026-09-10/R1/google/gemini-3.1-pro-preview/
Scored
answered
Received
2026-09-10 22:15:31 UTC
Run
20260910T221001Z-bb5bd1
Served by
Google · HTTP 200 · finish stop
Size
2,534 characters · 1,577 tokens out incl. hidden reasoning · 14.2 s
The short answer is: **You cannot kill a zombie process because it is already dead.**
By definition, a zombie process (state `Z` in Linux) has already completed execution. It takes up no CPU or memory. The only reason it still exists is because its **parent process** hasn't read its exit status yet. Because the zombie is dead, it will ignore all signals, including `SIGTERM` (kill -15) and `SIGKILL` (kill -9).
To get rid of a zombie, you must deal with its parent. Here is how to do it step-by-step:
### Step 1: Find the Parent Process ID (PPID)
First, you need to find the ID of the process that spawned the zombie. Run the following command (replace `<zombie_PID>` with the ID of your zombie process):
```bash
ps -o ppid= -p <zombie_PID>
```
*Alternatively, you can list all zombies and their parents with: `ps -A -ostat,pid,ppid,cmd | grep -e '^[Zz]'` (The third column is the PPID).*
### Step 2: Nudge the Parent Process
Sometimes, the parent process just needs a reminder to check on its children. You can send a `SIGCHLD` signal to the parent, which tells it "one of your child processes has died, please clean it up."
```bash
kill -s SIGCHLD <PPID>
```
Check if the zombie is gone. If it is, you're done!
### Step 3: Kill the Parent Process
If the parent process is frozen, poorly programmed, or refusing to clean up the zombie, your only option is to kill the parent.
**Warning:** Make sure you know what the parent process is before doing this. Killing it might stop a service you are currently using.
First, try to kill the parent gracefully:
```bash
kill <PPID>
```
If the parent refuses to die, force kill it:
```bash
kill -9 <PPID>
```
**What happens next?**
When the parent dies, the zombie process becomes an "orphan." In Linux, orphaned processes are immediately adopted by the `init` or `systemd` process (PID 1). PID 1 is programmed to automatically clean up (reap) any zombies it adopts. The zombie will instantly disappear.
---
### A Common Mix-Up: Is it actually in "D" State?
Often, people confuse a Zombie process (`Z`) with a process in **Uninterruptible Sleep (`D` state)**.
If you run `top` or `ps aux` and the process has a **D** next to it, it is *not* a zombie. It is a living process that is stuck waiting on hardware (like a disconnected network drive, a failing hard drive, or a USB issue).
* You **cannot** kill a `D` state process with `kill -9`.
* To fix a `D` state process, you either have to restore the hardware connection it is waiting for, or **reboot the server**.

End of response · 49 lines · 2,534 characters · sha256 eb5f606f2d66c889ca7d2178c60e0adfe486c858d78b9f7e5a67edc8c515919b