GPT on Question 13, Sep 17
How do I kill a zombie process in Linux that won't respond to SIGTERM?A zombie process cannot be killed—it has already exited. It remains in the process table because its parent has not collected its exit status with wait().
- 1.Confirm it is a zombie (
Zstate) and find its parent:
```bash
ps -o pid,ppid,state,cmd -p <zombie_pid>
```
- 2.Ask the parent to reap exited children:
```bash
kill -SIGCHLD <parent_pid>
```
This only works if the parent handlesSIGCHLDcorrectly.
- 3.If it remains, restart or terminate the parent process:
```bash
kill -TERM <parent_pid>
# If necessary:
kill -KILL <parent_pid>
```
The zombie will then be adopted and reaped by PID 1 (or another subreaper). Be careful: killing the parent may disrupt a service; prefer restarting it through its service manager:
```bash
sudo systemctl restart <service>
```
If the process state is D rather than Z, it is in uninterruptible I/O sleep—not a zombie—and even SIGKILL will not take effect 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-17 09:05:54 UTC
- Run
- 20260917T090022Z-136fc3
- Served by
- OpenAI · HTTP 200 · finish stop
- Size
- 1,006 characters · 316 tokens out incl. hidden reasoning · 5.7 s
A **zombie process cannot be killed**—it has already exited. It remains in the process table because its parent has not collected its exit status with `wait()`.
1. Confirm it is a zombie (`Z` state) and find its parent:
```bash
ps -o pid,ppid,state,cmd -p <zombie_pid>
```
2. Ask the parent to reap exited children:
```bash
kill -SIGCHLD <parent_pid>
```
This only works if the parent handles `SIGCHLD` correctly.
3. If it remains, restart or terminate the **parent process**:
```bash
kill -TERM <parent_pid>
# If necessary:
kill -KILL <parent_pid>
```
The zombie will then be adopted and reaped by PID 1 (or another subreaper). Be careful: killing the parent may disrupt a service; prefer restarting it through its service manager:
```bash
sudo systemctl restart <service>
```
If the process state is `D` rather than `Z`, it is in uninterruptible I/O sleep—not a zombie—and even `SIGKILL` will not take effect until the underlying I/O operation returns.
End of response · 25 lines · 1,006 characters · sha256 efbf24ee4d64e53ceac44723f6ccd1114a84ad4b30e0d7de8b1c84ece99f9574