MODELDRIFT.WATCH

Question 13 · Sep 19 · Day 10

Gemini on Question 13, Sep 19

How do I kill a zombie process in Linux that won't respond to SIGTERM?

The short answer is: You cannot directly kill a zombie process because it is already dead.

A zombie process (marked with a Z or <defunct> in top/ps) has already finished executing. It only exists as an entry in the process table because its parent process hasn't read its exit status yet. Because the zombie is dead, it will ignore all signals, including SIGTERM (15) and SIGKILL (9).

To remove a zombie process, you must target its parent process. Here is the step-by-step way to do it:

Step 1: Find the Parent Process ID (PPID)

You need to find the ID of the process that created the zombie. Run this command, replacing <zombie_pid> with the ID of your zombie process:

ps -o ppid= -p <zombie_pid>

Alternatively, to see a list of all zombies and their parents, run:
ps axo stat,ppid,pid,comm | grep -w defunct (The first number is the Parent PID, the second is the Zombie PID).

Step 2: Check what the Parent Process is

Before you kill the parent, you should see what it is, so you don't accidentally crash an important service.

ps -p <PPID> -o comm=

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

Step 3: Nudge the Parent (Optional, but safe)

Sometimes, you can remind the parent process to do its job and reap its children by sending it a SIGCHLD signal. This won't kill the parent.

kill -s SIGCHLD <PPID>

Check if the zombie is gone. If it is still there, the parent is bugged or frozen, and you must proceed to Step 4.

Step 4: Kill the Parent Process

If you kill the parent process, the zombie will become an "orphan." In Linux, orphan processes are automatically adopted by init or systemd (PID 1), which automatically cleans up zombies.

First, try a graceful termination of the parent:

kill -15 <PPID>

If the parent doesn't respond, force kill the parent:

kill -9 <PPID>

Once the parent is dead, the zombie will instantly disappear.


⚠️ Important Warnings

  • •If the Parent PID is 1: If the PPID is 1 (init or systemd), do not attempt to kill it. Killing PID 1 will crash your system. If PID 1 is holding onto a zombie, it is usually tied up waiting for a hardware/kernel resource (often a frozen network mount or dead disk). In this case, a system reboot is your only solution.
  • •Are you sure it's a Zombie? People often confuse Zombie processes (Z state) with Uninterruptible Sleep processes (D state). If your process state is D, it is stuck waiting on hardware (like a failing hard drive). You cannot kill a D state process without fixing the hardware issue or rebooting.

sha256 e0fc20da3574… · 18 tokens in · 1,912 out · 17.5 s · via Google · stopped on its own

Sep 19, 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-19 09:00:04 UTC (matches the pin)
Date
2026-09-19 · run 20260919T090005Z-86161c · scorer v1
Scored
answered
sha256
e0fc20da357412fdbc547ee3b31cf3ccf756b13c55eb9c3b7b7c98b03d059860
Permalink
https://modeldrift.watch/r/2026-09-19/R1/google/gemini-3.1-pro-preview/
Scored
answered
Received
2026-09-19 09:05:42 UTC
Run
20260919T090005Z-86161c
Served by
Google · HTTP 200 · finish stop
Size
2,649 characters · 1,912 tokens out incl. hidden reasoning · 17.5 s
The short answer is: **You cannot directly kill a zombie process because it is already dead.**
A zombie process (marked with a `Z` or `<defunct>` in `top`/`ps`) has already finished executing. It only exists as an entry in the process table because its **parent process** hasn't read its exit status yet. Because the zombie is dead, it will ignore all signals, including `SIGTERM` (15) and `SIGKILL` (9).
To remove a zombie process, you must target its **parent process**. Here is the step-by-step way to do it:
### Step 1: Find the Parent Process ID (PPID)
You need to find the ID of the process that created the zombie. Run this command, replacing `<zombie_pid>` with the ID of your zombie process:
```bash
ps -o ppid= -p <zombie_pid>
```
*Alternatively, to see a list of all zombies and their parents, run:*
`ps axo stat,ppid,pid,comm | grep -w defunct` (The first number is the Parent PID, the second is the Zombie PID).
### Step 2: Check what the Parent Process is
Before you kill the parent, you should see what it is, so you don't accidentally crash an important service.
```bash
ps -p <PPID> -o comm=
```
*(Replace `<PPID>` with the number you got in Step 1).*
### Step 3: Nudge the Parent (Optional, but safe)
Sometimes, you can remind the parent process to do its job and reap its children by sending it a `SIGCHLD` signal. This won't kill the parent.
```bash
kill -s SIGCHLD <PPID>
```
Check if the zombie is gone. If it is still there, the parent is bugged or frozen, and you must proceed to Step 4.
### Step 4: Kill the Parent Process
If you kill the parent process, the zombie will become an "orphan." In Linux, orphan processes are automatically adopted by `init` or `systemd` (PID 1), which automatically cleans up zombies.
First, try a graceful termination of the parent:
```bash
kill -15 <PPID>
```
If the parent doesn't respond, force kill the parent:
```bash
kill -9 <PPID>
```
Once the parent is dead, the zombie will instantly disappear.
***
### ⚠️ Important Warnings
* **If the Parent PID is 1:** If the PPID is `1` (`init` or `systemd`), **do not attempt to kill it.** Killing PID 1 will crash your system. If PID 1 is holding onto a zombie, it is usually tied up waiting for a hardware/kernel resource (often a frozen network mount or dead disk). In this case, a **system reboot** is your only solution.
* **Are you sure it's a Zombie?** People often confuse Zombie processes (`Z` state) with Uninterruptible Sleep processes (`D` state). If your process state is `D`, it is stuck waiting on hardware (like a failing hard drive). You cannot kill a `D` state process without fixing the hardware issue or rebooting.

End of response · 47 lines · 2,649 characters · sha256 e0fc20da357412fdbc547ee3b31cf3ccf756b13c55eb9c3b7b7c98b03d059860