GPT on Question 13, Sep 16
How do I kill a zombie process in Linux that won't respond to SIGTERM?You can’t kill a zombie process—even with SIGKILL—because it has already exited. It remains only as a process-table entry until its parent collects its exit status with wait().
- 1.Confirm it is a zombie (
STATcontainsZ):
ps -o pid,ppid,stat,cmd -p <PID>
- 2.Find its parent:
PPID=$(ps -o ppid= -p <PID> | tr -d ' ') ps -fp "$PPID"
- 3.Ask the parent to reap children:
sudo kill -SIGCHLD "$PPID"
- 4.If the parent is broken, restart or terminate the parent gracefully:
sudo kill -TERM "$PPID" # As a last resort: sudo kill -KILL "$PPID"
The zombie should then be adopted and reaped by init/systemd. Do not kill PID 1. For a service, prefer:
sudo systemctl restart <service>
A persistent zombie usually indicates a bug in the parent program: it needs to handle SIGCHLD and call wait()/waitpid(). If the process state is D rather than Z, it is not a zombie; it is stuck in uninterruptible kernel I/O and requires addressing the underlying device/filesystem issue, sometimes followed by a reboot.
Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
- Scored
- answered
- Received
- 2026-09-16 09:05:27 UTC
- Run
- 20260916T090004Z-fdcf7b
- Served by
- OpenAI · HTTP 200 · finish stop
- Size
- 1,091 characters · 394 tokens out incl. hidden reasoning · 7.9 s
You can’t kill a zombie process—even with `SIGKILL`—because it has already exited. It remains only as a process-table entry until its parent collects its exit status with `wait()`.
1. Confirm it is a zombie (`STAT` contains `Z`):
```bash
ps -o pid,ppid,stat,cmd -p <PID>
```
2. Find its parent:
```bash
PPID=$(ps -o ppid= -p <PID> | tr -d ' ')
ps -fp "$PPID"
```
3. Ask the parent to reap children:
```bash
sudo kill -SIGCHLD "$PPID"
```
4. If the parent is broken, restart or terminate the **parent** gracefully:
```bash
sudo kill -TERM "$PPID"
# As a last resort:
sudo kill -KILL "$PPID"
```
The zombie should then be adopted and reaped by `init`/`systemd`. Do **not** kill PID 1. For a service, prefer:
```bash
sudo systemctl restart <service>
```
A persistent zombie usually indicates a bug in the parent program: it needs to handle `SIGCHLD` and call `wait()`/`waitpid()`. If the process state is `D` rather than `Z`, it is not a zombie; it is stuck in uninterruptible kernel I/O and requires addressing the underlying device/filesystem issue, sometimes followed by a reboot.
End of response · 36 lines · 1,091 characters · sha256 66c5c1b63bf338b1b5ae2894035429661b9cb657a3836373245c64be50776d3f