MODELDRIFT.WATCH

Question 13 · Sep 17 · Day 8

Gemini on Question 13, Sep 17

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.

A zombie process (marked with a Z or defunct in top or ps) is a process that has already finished executing and terminated. The only reason it still shows up is that its parent process hasn't acknowledged its death yet (by reading its exit status).

Because the zombie isn't actually running, sending it a SIGTERM (kill -15) or even a SIGKILL (kill -9) will do absolutely nothing.

To get rid of a zombie, you must target its parent process. Here is the step-by-step way 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 to list all zombie processes and their parent PIDs:

ps -eo pid,ppid,stat,cmd | awk '$3=="Z"'
  • •PID: The ID of the zombie.
  • •PPID: The ID of the parent process.

Note the PPID of the zombie you want to clear.

Step 2: Check what the Parent Process is

Before you do anything to the parent, check what it is. You don't want to accidentally kill a critical system service.

ps -p <PPID> -o pid,cmd

(Replace <PPID> with the number you found in Step 1).

Step 3: Nudge the Parent (The Gentle Approach)

Sometimes, the parent process is just hanging and needs a reminder to clean up its dead children. You can send a SIGCHLD signal to the parent. This signal explicitly tells a process that one of its children has stopped or terminated.

kill -s SIGCHLD <PPID>

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

Step 4: Kill the Parent (The Aggressive Approach)

If the parent is poorly programmed or completely frozen, it will never clean up the zombie. The only way to remove the zombie is to kill the parent process.

Note: Be aware that killing the parent process will stop whatever application or service that parent was running.

First, try a graceful termination of the parent:

kill -15 <PPID>

If the parent refuses to die, force kill it:

kill -9 <PPID>

What happens next?

When you kill the parent process, the zombie process becomes an "orphan." In Linux, all orphaned processes are immediately adopted by the init or systemd process (PID 1).

PID 1 is specifically programmed to constantly check for dead children and clean them up. The moment PID 1 adopts the zombie, it will read its exit status, and the zombie will disappear from your system completely.

sha256 4920e8b33cfd… · 18 tokens in · 1,685 out · 15.7 s · via Google · stopped on its own

Sep 17, 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; alias resolved to google/gemini-3.1-pro-preview-20260219 at 2026-09-17 09:00:21 UTC (matches the pin)
Date
2026-09-17 · run 20260917T090022Z-136fc3 · scorer v1
Scored
answered
sha256
4920e8b33cfd7bcf49c3b14dc4af21b6e1e3613580100ca033d12119d165eadd
Permalink
https://modeldrift.watch/r/2026-09-17/R1/google/gemini-3.1-pro-preview/
Scored
answered
Received
2026-09-17 09:06:32 UTC
Run
20260917T090022Z-136fc3
Served by
Google · HTTP 200 · finish stop
Size
2,496 characters · 1,685 tokens out incl. hidden reasoning · 15.7 s
The short answer is: **You cannot kill a zombie process because it is already dead.**
A zombie process (marked with a `Z` or `defunct` in `top` or `ps`) is a process that has already finished executing and terminated. The only reason it still shows up is that its **parent process** hasn't acknowledged its death yet (by reading its exit status).
Because the zombie isn't actually running, sending it a `SIGTERM` (`kill -15`) or even a `SIGKILL` (`kill -9`) will do absolutely nothing.
To get rid of a zombie, you must target its **parent process**. Here is the step-by-step way 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 to list all zombie processes and their parent PIDs:
```bash
ps -eo pid,ppid,stat,cmd | awk '$3=="Z"'
```
* **PID**: The ID of the zombie.
* **PPID**: The ID of the parent process.
Note the **PPID** of the zombie you want to clear.
### Step 2: Check what the Parent Process is
Before you do anything to the parent, check what it is. You don't want to accidentally kill a critical system service.
```bash
ps -p <PPID> -o pid,cmd
```
*(Replace `<PPID>` with the number you found in Step 1).*
### Step 3: Nudge the Parent (The Gentle Approach)
Sometimes, the parent process is just hanging and needs a reminder to clean up its dead children. You can send a `SIGCHLD` signal to the parent. This signal explicitly tells a process that one of its children has stopped or terminated.
```bash
kill -s SIGCHLD <PPID>
```
Check if the zombie is gone. If it is, you're done!
### Step 4: Kill the Parent (The Aggressive Approach)
If the parent is poorly programmed or completely frozen, it will never clean up the zombie. The only way to remove the zombie is to **kill the parent process**.
*Note: Be aware that killing the parent process will stop whatever application or service that parent was running.*
First, try a graceful termination of the parent:
```bash
kill -15 <PPID>
```
If the parent refuses to die, force kill it:
```bash
kill -9 <PPID>
```
### What happens next?
When you kill the parent process, the zombie process becomes an "orphan." In Linux, all orphaned processes are immediately adopted by the `init` or `systemd` process (PID 1).
PID 1 is specifically programmed to constantly check for dead children and clean them up. The moment PID 1 adopts the zombie, it will read its exit status, and the zombie will disappear from your system completely.

End of response · 52 lines · 2,496 characters · sha256 4920e8b33cfd7bcf49c3b14dc4af21b6e1e3613580100ca033d12119d165eadd