Skip to content

How to Fix Linux Kill Process — Resource Temporarily Unavailable

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix Linux Kill Process. We cover key concepts, practical examples, and best practices.

You run kill <PID> and get Resource temporarily unavailable — the process is in an uninterruptible sleep state (D state) or the system has reached its process limit.

The Problem

kill: (1234): Resource temporarily unavailable

Or:

kill: cannot kill process: Resource temporarily unavailable

Step-by-Step Fix

Step 1: Check the process state

ps aux | grep 1234

Look at the STAT column:

  • D — uninterruptible sleep (cannot be killed)
  • Z — zombie (already dead, parent must reap)
  • T — stopped
  • S — sleeping
  • R — running

Step 2: Try SIGKILL for normal processes

# WRONG — default SIGTERM may not work
kill 1234

# RIGHT — use SIGKILL
kill -9 1234

Or:

kill -KILL 1234

Step 3: Handle zombie processes

# Zombie processes cannot be killed
ps aux | grep Z

Kill the parent process to reap the zombie:

kill -9 <parent-pid>

Step 4: Handle D-state (uninterruptible sleep) processes

D-state processes are waiting on I/O. If the underlying storage is stuck, the process cannot be killed. Options:

  1. Fix the storage issue (mount, NFS, disk)
  2. Reboot the system
  3. Wait for I/O timeout

Check what the process is waiting on:

cat /proc/1234/status | grep -E "State|Pid"

Step 5: Check system process limits

ulimit -u

If you hit the max user processes limit:

# Check current count
ps -U $USER | wc -l

# If near limit, increase
ulimit -u 65535

Make permanent in /etc/security/limits.conf:

user    soft    nproc   65535
user    hard    nproc   65535

Step 6: Reboot if necessary

sudo reboot

Prevention Tips

  • Use kill -15 (SIGTERM) first, then kill -9 (SIGKILL)
  • Avoid NFS mounts with hard options (use soft or intr)
  • Monitor system limits with ulimit -a
  • Set appropriate process limits in production
  • Use pkill or killall for pattern-based killing

Common Mistakes with process kill

  1. Misunderstanding that String is [Char] with poor performance for large text operations
  2. Using foldl instead of foldl' causing stack overflow on large lists
  3. Forgetting deriving (Show, Eq) on custom data types needed for debugging

These mistakes appear frequently in real-world LINUX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between SIGTERM and SIGKILL?

SIGTERM (15) asks the process to terminate gracefully — it can clean up resources. SIGKILL (9) force-kills the process immediately with no cleanup. Always try SIGTERM first.

Why can't I kill a D-state process?

D-state means the process is in uninterruptible sleep, typically waiting on hardware I/O. The kernel will not deliver signals until the I/O completes. If the device is dead, only a reboot will clear it.

How do I prevent zombie processes?

Zombies occur when the parent process does not call wait() to reap child exit status. Fix the parent application to handle SIGCHLD. Or kill the parent so init (PID 1) reaps the zombie.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro