GPT on Question 13, Sep 27
How do I kill a zombie process in Linux that won't respond to SIGTERM?A zombie process is already dead—it has exited, but its parent has not collected its exit status. Therefore, neither SIGTERM nor SIGKILL can remove the zombie directly.
- 1.Confirm it is a zombie and find its parent:
```bash
ps -o pid,ppid,state,cmd -p <PID>
```
A zombie has stateZ.
- 2.Ask the parent to reap exited children:
```bash
kill -SIGCHLD <PPID>
```
This only helps if the parent handlesSIGCHLDcorrectly.
- 3.If it remains, gracefully restart or terminate the parent process:
```bash
kill -TERM <PPID>
```
Once the parent exits, the zombie is normally adopted and reaped by PID 1 (systemd/init). UseSIGKILLon the parent only as a last resort, since it may disrupt a service or lose data.
If the parent is PID 1, or zombies persist inside a container, the init process is not reaping children correctly. Restart the container/service and use an init wrapper such as tini or Docker’s --init option.
Also verify the process is not in state D instead. A D process is blocked in uninterruptible kernel I/O and cannot be killed until the underlying I/O operation returns.
Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
- Scored
- answered
- Received
- 2026-09-27 09:04:46 UTC
- Run
- 20260927T090007Z-7adb14
- Served by
- OpenAI · HTTP 200 · finish stop
- Size
- 1,141 characters · 384 tokens out incl. hidden reasoning · 5.9 s
A zombie process is already dead—it has exited, but its parent has not collected its exit status. Therefore, neither `SIGTERM` nor `SIGKILL` can remove the zombie directly.
1. Confirm it is a zombie and find its parent:
```bash
ps -o pid,ppid,state,cmd -p <PID>
```
A zombie has state `Z`.
2. Ask the parent to reap exited children:
```bash
kill -SIGCHLD <PPID>
```
This only helps if the parent handles `SIGCHLD` correctly.
3. If it remains, gracefully restart or terminate the parent process:
```bash
kill -TERM <PPID>
```
Once the parent exits, the zombie is normally adopted and reaped by PID 1 (`systemd`/`init`). Use `SIGKILL` on the parent only as a last resort, since it may disrupt a service or lose data.
If the parent is PID 1, or zombies persist inside a container, the init process is not reaping children correctly. Restart the container/service and use an init wrapper such as `tini` or Docker’s `--init` option.
Also verify the process is not in state `D` instead. A `D` process is blocked in uninterruptible kernel I/O and cannot be killed until the underlying I/O operation returns.
End of response · 23 lines · 1,141 characters · sha256 ada54ee5024373bd3001e7ebf45cdb498edbee052b9676c60441ccf65f976018