Skip to content
DevOps AI ToolKit
Newsletter
Linux Troubleshooting

Linux Error Guides

A growing library of 132 production Linux error guides — each one gets you from error message to root cause, fix, validation, and prevention with real commands. Written for DevOps, SRE, and Linux engineers debugging live incidents, not reading theory.

Networking & DNS

16 guides

bind: Address already in use

How to fix bind: Address already in use (EADDRINUSE) on Linux. Find the listener with ss and lsof, clear TIME_WAIT, and untangle systemd socket conflicts.

Cannot assign requested address

How to fix the Linux 'Cannot assign requested address' (EADDRNOTAVAIL) error: bind to a missing IP, ephemeral port exhaustion, wrong interface, and IPv6 binds.

Network is unreachable

Resolve 'Network is unreachable' ENETUNREACH on Linux by checking interface state, default route, gateway reachability, and network manager configuration.

Connection refused

How to fix the Linux 'Connection refused' error (ECONNREFUSED): diagnose closed ports, dead services, wrong bind address and firewalls with ss, curl and nc.

Connection timed out

How to fix the Linux 'Connection timed out' error (ETIMEDOUT): diagnose dropped packets, firewalls, security groups and routing with ss, curl, nc and ip route.

curl: (6) Could not resolve host

How to fix the 'curl: (6) Could not resolve host' error on Linux: diagnose broken DNS, resolv.conf, proxies and systemd-resolved on Ubuntu and RHEL.

Destination Host Unreachable

How to fix the Linux 'Destination Host Unreachable' ping error: diagnose ARP failures, wrong gateways, subnet mask mistakes, and firewall drops on the same LAN.

Name or service not known

How to fix the Linux 'Name or service not known' error (EAI_NONAME): diagnose failed DNS lookups, /etc/hosts, resolv.conf and systemd-resolved on Ubuntu and RHEL.

Network is unreachable

How to fix the Linux 'Network is unreachable' (ENETUNREACH) error: diagnose missing routes, default gateways, down interfaces, and IPv6 vs IPv4 routing problems.

nf_conntrack: table full, dropping packet

Fix 'nf_conntrack: table full, dropping packet' on Linux: understand nf_conntrack_max vs conntrack count, hashsize, timeouts, and NAT-driven exhaustion.

NIC Link is Down

Fix 'NIC Link is Down', 'Reset adapter' and Tx Unit Hang errors in dmesg. Diagnose carrier loss, autoneg mismatches and ring buffers with ethtool.

No route to host

How to fix the Linux 'No route to host' error (EHOSTUNREACH): diagnose missing routes, firewall REJECTs, ARP failures and down interfaces with ip route and ss.

SSH 'Connection refused' on port 22: How to Fix It on Linux

Fix 'Connection refused' on Linux for SSH and curl: diagnose a stopped service, wrong port, firewall drop, or bind address so the server actually accepts connections on the port.

ssh: connect to host ... port 22: Connection timed out

Fix 'ssh: connect to host port 22: Connection timed out': diagnose firewall/security-group drops, a down host, sshd not listening, and routing with nc, ss and ssh -v.

sudo: unable to resolve host <hostname>

How to fix the Linux sudo: unable to resolve host error: the machine's hostname is missing from /etc/hosts. Diagnose with hostname, hostnamectl, and fix on Ubuntu/RHEL.

Temporary failure in name resolution

How to fix the Linux 'Temporary failure in name resolution' error (EAI_AGAIN): diagnose broken DNS, resolv.conf, and systemd-resolved on Ubuntu and RHEL.

Memory, Limits & Processes

9 guides

Argument list too long

How to fix the Linux 'Argument list too long' (E2BIG) error: understand ARG_MAX, use xargs and find -exec, split globs, and work around large command lines safely.

Cannot allocate memory

How to fix Cannot allocate memory on Linux: diagnose ENOMEM at fork/alloc time, overcommit policy, PID/thread ceilings, cgroup TasksMax, and per-user ulimits.

fork: Cannot allocate memory

Fix 'fork: Cannot allocate memory' on Linux — trace ENOMEM to overcommit policy, nproc limits, vm.max_map_count, cgroup pids.max, or genuine RAM exhaustion.

fork: Resource temporarily unavailable

How to fix fork: Resource temporarily unavailable (EAGAIN) on Linux by diagnosing ulimit nproc, cgroup pids.max, kernel.pid_max and kernel.threads-max limits.

task blocked for more than 120 seconds

Fix the khungtaskd 'task blocked for more than 120 seconds' warning: understand the uninterruptible D state, diagnose the I/O stall behind a hung task.

Out of memory: Killed process

How to fix Out of memory: Killed process on Linux: diagnose host OOM vs cgroup memory.max, oom_score, overcommit, swap, and container exit code 137.

TCP: out of memory -

Fix the Linux 'TCP: out of memory' and 'Out of socket memory' errors: tune tcp_mem pages, size socket buffers, cap orphaned sockets, and stop dropped data.

Text file busy

How to fix the Linux 'Text file busy' (ETXTBSY) error: find the process running or holding a binary with lsof and fuser, stop it, then replace or overwrite the executable safely.

Too many open files

How to fix Too many open files (EMFILE/ENFILE) on Linux: diagnose ulimit -n, systemd LimitNOFILE, fs.file-max, fd leaks, and inotify watch exhaustion.

Storage & Filesystems

19 guides

Buffer I/O error on dev

Fix the 'Buffer I/O error on dev' and blk_update_request I/O error kernel messages: diagnose bad sectors, medium errors, EIO in apps, and SMART data on a failing disk.

Device or resource busy

How to fix the Linux 'Device or resource busy' (EBUSY) error when unmounting, removing, or killing: find the process holding the mount and release it safely.

No space left on device

Fix 'No space left on device' on a full Linux filesystem: reclaim bytes, diagnose exhausted inodes with df -i, and free deleted-but-open files held open.

Buffer I/O error on dev sda

Diagnose Linux disk read I/O errors and 'Buffer I/O error on dev' bad blocks using SMART, badblocks, and ddrescue, then recover data safely and remap sectors.

I/O error' on Write

Diagnose disk write I/O errors (blk_update_request, write error: Input/output error) from failing disks, bad sectors, dying SSDs, or bad cabling using SMART.

Read-only file system' on Write-Protected Media

Fix write-protected disks, USB, and SD cards on Linux: physical switches, blockdev/hdparm read-only flags, ro mounts, and worn flash that forces read-only mode.

EXT4-fs error ... bad extent

Fix the EXT4-fs error 'bad extent/header' that remounts your filesystem read-only. Diagnose ext4 metadata corruption, recover the journal, and run e2fsck safely.

mount: wrong fs type, bad option, bad superblock

Fix Linux mount failures: wrong fs type, bad superblock, missing helper program, device not found, and broken /etc/fstab entries with real diagnostic commands.

UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY

How to fix the Linux 'UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY' boot error: run fsck safely from a rescue shell, repair ext4/XFS, and recover a filesystem that won't auto-check.

Input/output error

How to fix the Linux 'Input/output error' (EIO): diagnose failing disks with SMART and dmesg, distinguish device faults from NFS drops, and recover safely.

wrong fs type, bad option, bad superblock

Fix mount failures caused by wrong filesystem type, corrupt superblocks, missing helpers, or unopened LUKS/LVM devices using blkid, fsck, and dmesg.

'mount: wrong fs type, bad option, bad superblock': How to Fix on Linux

How to fix the Linux 'mount: wrong fs type, bad option, bad superblock' error: diagnose filesystem type mismatches, corrupt superblocks, missing modules, and bad fstab options.

No space left on device

Fix the Linux 'No space left on device' (ENOSPC) error: diagnose full filesystems, inode exhaustion, deleted-but-open files, reserved blocks, and runaway logs.

Read-only file system

Fix the 'Read-only file system' (EROFS) error in Linux: diagnose kernel-forced remounts after I/O errors, fsck-needed corruption, failing disks, ro fstab, and RAID.

Read-only file system' (EROFS)

Fix EROFS 'Read-only file system' after ext4 remounts read-only on errors: diagnose with dmesg and tune2fs, verify disk health, run fsck safely, and remount rw.

Stale file handle

How to fix the Linux 'Stale file handle' (ESTALE) error on NFS: understand why the file handle went stale, remount the export, and prevent it recurring.

Structure needs cleaning

How to fix the Linux 'Structure needs cleaning' (EUCLEAN) error on ext4 and btrfs: confirm the corruption, unmount, back up, and run the correct repair safely.

Transport endpoint is not connected

How to fix the Linux 'Transport endpoint is not connected' (ENOTCONN) error from a dead NFS or FUSE mount: force-unmount the stale mount and remount cleanly.

umount: target is busy

Fix 'umount: target is busy' on Linux: find the processes, open files, and bind mounts holding a mountpoint, and unmount cleanly with fuser and lsof.

Permissions, Exec & Auth

20 guides

bad interpreter: No such file or directory

How to fix the Linux 'bad interpreter: No such file or directory' error: CRLF line endings, wrong shebang paths, missing interpreters, and BOM issues explained.

/bin/bash^M: bad interpreter

Fix '/bin/bash^M: bad interpreter: No such file or directory' and 'Permission denied' when running a script on Linux: strip CRLF line endings, chmod +x, and fix shebang and noexec mounts.

bash: somecmd: command not found

Understand why bash cannot find a command, from missing packages and PATH gaps to stale hash caches and login-shell rc files, with concrete diagnostic steps.

cannot open shared object file

Fix 'error while loading shared libraries: cannot open shared object file' on Linux using ldd, ldconfig, and LD_LIBRARY_PATH to resolve missing libraries.

chown: invalid user: '<name>

How to fix the Linux chown: invalid user error: the user does not exist in NSS, a typo, an unresolvable LDAP/SSSD account, or a UID needing --from. Diagnose with getent and id.

command not found

Fix the 'bash: command not found' error in Linux: diagnose missing packages, broken PATH, non-login shells, stale hash cache, sudo secure_path, and bad shebangs.

No such file or directory

Diagnose ENOENT syscall failures on Linux with strace, ltrace, realpath, and readlink to find missing files, broken symlinks, and bad interpreters.

Exec format error

How to fix the Linux 'Exec format error' (ENOEXEC): wrong CPU architecture, missing shebang, corrupt binaries, and multi-arch container images explained.

gcc: command not found

Fix 'gcc: command not found' and 'no acceptable C compiler found in $PATH' by installing build-essential, the Development Tools group, or build-base.

./script.sh: No such file or directory

Learn why './script.sh No such file or directory' appears even when the file exists, and how to fix shebangs, CRLF line endings, and broken ELF loaders.

No such file or directory (when the file clearly exists)

How to fix Linux 'No such file or directory' when the file exists: missing ELF interpreter/loader, wrong architecture, and missing shared libraries explained.

open: Permission denied

Fix the Linux open Permission denied EACCES error by checking mode bits, ownership, parent directory execute bits, ACLs, SELinux, and AppArmor denials.

Operation not permitted

How to fix the Linux 'Operation not permitted' error (EPERM): missing capabilities, the immutable bit, seccomp, user namespaces, SELinux and AppArmor denials explained.

passwd: Authentication token manipulation error

How to fix the Linux passwd: Authentication token manipulation error — usually a full or read-only filesystem or an immutable /etc/shadow, not a bad password. Diagnose and repair.

Permission denied

How to fix the Linux 'Permission denied' error (EACCES): file modes, ownership, ACLs, noexec mounts, missing execute bit, SELinux and AppArmor denials explained.

Permission denied (publickey)

Fix SSH 'Permission denied (publickey)': diagnose missing keys, authorized_keys, file permissions, StrictModes, wrong user, ssh-agent, and disabled key types.

Segmentation fault (core dumped)

How to fix the Linux 'Segmentation fault (core dumped)' error: capture cores with coredumpctl, analyze with gdb, read dmesg segfault lines, and find the faulting library.

Too many authentication failures

Fix SSH 'Too many authentication failures': stop the agent offering every key, use IdentitiesOnly and IdentityFile, and raise MaxAuthTries if needed.

su: Authentication failure

How to fix the Linux su: Authentication failure error: wrong password, a locked or expired account, PAM faillock lockout, or a nologin shell. Diagnose on Ubuntu and RHEL.

cannot create file: Permission denied

Fix 'Permission denied' when writing files on Linux: diagnose directory permissions, ownership, read-only mounts, immutable +i attributes, full disks, and SELinux/AppArmor denials fast.

systemd & Services

7 guides

Boot & Kernel

7 guides

Package Management

12 guides

E: Failed to fetch' in apt

Fix apt 'E: Failed to fetch' errors on Debian and Ubuntu: resolve 404 Not Found, Hash Sum mismatch, stale sources, proxy cache, DNS, and network problems fast.

The repository does not have a Release file

Fix the apt 'does not have a Release file' error on Ubuntu and Debian: correct the suite/codename, remove EOL repos, and re-run apt update safely.

E: Unable to locate package

Resolve APT's 'E: Unable to locate package' on Debian and Ubuntu: run apt update, enable the universe repo, fix package name typos, and add the correct third-party sources.

Could not get lock /var/lib/dpkg/lock-frontend

How to fix the Linux 'Could not get lock /var/lib/dpkg/lock-frontend' error: find the process holding the apt/dpkg lock, wait for unattended-upgrades, and recover safely.

dpkg: error processing package

Fix 'dpkg: error processing package' and 'E: Sub-process /usr/bin/dpkg returned an error code (1)' on Debian/Ubuntu: repair half-configured packages, broken deps, and failing postinst scripts.

Sub-process /usr/bin/dpkg returned an error code (1)

Fix the apt 'Sub-process /usr/bin/dpkg returned an error code (1)' error on Ubuntu and Debian: read the real maintainer-script failure above it and repair dpkg.

dpkg was interrupted, you must manually run dpkg --configure -a

How to fix the Linux 'dpkg was interrupted, you must manually run dpkg --configure -a' error: recover a half-configured package database on Debian and Ubuntu safely.

Fix 'Failed to download metadata for repo' on dnf/yum (RHEL, Rocky, Alma)

How to fix the Linux dnf 'Failed to download metadata for repo' error on RHEL, Rocky, and Alma: repair repo URLs, proxy, TLS, clock skew, and clean the dnf cache.

Hash Sum mismatch

How to fix the Linux apt 'Hash Sum mismatch' error on Ubuntu and Debian: clear the package lists cache and track down the caching proxy or stale mirror behind it.

NO_PUBKEY / the following signatures couldn't be verified

How to fix the Linux apt 'NO_PUBKEY' and 'the following signatures couldn't be verified' error on Ubuntu using the modern signed-by keyring in /etc/apt/keyrings.

rpmdb: BDB0113 Thread/process failed

How to fix the Linux rpmdb: BDB0113 Thread/process failed error caused by a corrupt RPM Berkeley DB: verify, back up, and rebuild /var/lib/rpm safely on RHEL/Rocky.

The following packages have unmet dependencies

How to fix the Linux 'The following packages have unmet dependencies' error on Ubuntu and Debian: resolve held, broken, and conflicting apt packages step by step.

Other

42 guides

You are in emergency mode

Fix 'You are in emergency mode' on Linux after a bad /etc/fstab entry: read journalctl -b, identify the failed mount, comment or add nofail, and restore a clean systemd boot.

No such file or directory

Fix a broken symbolic link on Linux: detect dangling links with ls, readlink and find -xtype l, understand relative vs absolute targets, and recreate the link safely with ln -sfn.

cannot access: No such file or directory

Fix Linux 'cannot access' and 'cannot statx: Permission denied' errors from ls and stat: diagnose a missing directory execute bit, wrong path, broken symlink, or bad mount.

cgroup: fork rejected by pids controller

Fix 'cgroup: fork rejected by pids controller' on Linux: find the cgroup that hit pids.max, tell a fork bomb from a low TasksMax, and raise it safely.

Clock skew detected' in make

Fix 'make: Clock skew detected' and files with times in the future: sync the clock with NTP, correct the timezone, and repair timestamps on NFS builds.

cp: error writing: No space left on device

Fix 'cp: error writing: No space left on device' and other mid-copy failures on Linux: reclaim disk and inodes, handle I/O errors, and resume large copies safely with rsync.

cron job not running

Fix a cron job that never runs on Linux: check the daemon and schedule, read cron logs, fix PATH and environment, escape %, set MAILTO, and correct crontab and /etc/cron.d permissions.

firmware: failed to load rtl_nic/rtl8168g-2.fw (-2)

Fix Linux device init failures from missing firmware blobs, bad kernel modules, or IOMMU conflicts. Use dmesg and lspci to diagnose driver probe errors.

bash: cd: No such file or directory

Fix 'bash: cd: No such file or directory' when a target directory is missing, mistyped, or on the wrong path. Spot typos, dead symlinks, and hidden chars.

No signal

A monitor showing 'No signal' on a Linux server usually means the GPU, video mode, or console output is misconfigured; here is how to diagnose and recover.

Failed to allocate directory watch: Too many open files

Fix 'Failed to allocate directory watch: Too many open files' — inotify watch/instance exhaustion. Raise fs.inotify.max_user_watches, not just ulimit -n.

Failed to fetch ... getaddrinfo ENOTFOUND

Fix 'Failed to fetch' errors while fetching extensions or packages on Linux: diagnose DNS, proxy, TLS, and marketplace outages behind corporate networks in VS Code, code-server, and apt.

load average: 14.52, 13.87, 12.31

Diagnose runaway processes and high load averages on Linux using top, htop, pidstat, and mpstat. Identify CPU-bound vs I/O-wait issues and resolve them fast.

Host key verification failed

Fix SSH 'Host key verification failed': understand when a changed host key means a rebuilt server versus a real MITM, clear the stale known_hosts entry safely, and prevent recurrence.

Job for <svc>.service failed because the control process exited with error code

Fix 'Job for <svc>.service failed because the control process exited with error code': read systemctl status, journalctl -xe, verify the unit, fix ExecStart.

unsigned module loading is restricted

Fix kernel lockdown and Secure Boot module signature errors on Linux by signing out-of-tree modules, enrolling a MOK key, and configuring DKMS signing.

setlocale: LC_ALL: cannot change locale

Fix Linux 'setlocale: cannot change locale' warnings: generate the missing locale, set LANG and LC_ALL, and stop SSH forwarding unset locales.

earlyoom: mem avail 2%, swap nearly full

Diagnose Linux memory pressure before the OOM killer fires using free -h, vmstat, /proc/pressure/memory PSI, slabtop, smem, and cgroup v2 memory metrics.

make: *** Error 1

Fix 'make: *** [Makefile:N] Error 1' and 'configure: error: not found' when building software from source on Linux: install missing -dev headers, toolchain, and pkg-config libraries.

modprobe: FATAL: Module not found

Fix 'modprobe: FATAL: Module not found': match modules to the running kernel, rebuild modules.dep, install kernel-modules-extra, and handle DKMS.

Failed to start Network Manager

Fix no network after netplan on Ubuntu: 'Failed to start Network Manager', invalid YAML indentation, wrong renderer (networkd vs NetworkManager), wrong interface names.

Failed to initialize NVML: Driver/library version mismatch

Fix 'Failed to initialize NVML: Driver/library version mismatch' on GPU/ML nodes: the NVIDIA kernel module and userspace libs are out of sync. Reload or reboot.

Out of memory: Killed process 1234 (name)

When the Linux kernel logs 'Out of memory Killed process', the OOM killer has reclaimed RAM; learn to read the logs, find the cause, and prevent repeats.

Resource temporarily unavailable

Troubleshoot the Linux Resource temporarily unavailable EAGAIN flock error and stale PID lock files that block a service from starting cleanly again.

rmdir: failed to remove: Directory not empty

Fix 'rmdir: failed to remove: Directory not empty' on Linux: reveal hidden and open files, spot busy mountpoints and NFS silly-rename leftovers, safely.

RTNETLINK answers: File exists

Fix 'RTNETLINK answers: File exists' from ip route/addr add: understand the duplicate route or address conflict, find what already owns it, and add idempotently with replace instead of add.

Job for nginx.service failed because the control process exited with error-code

Diagnose why a systemd service fails to start, from config syntax and port conflicts to permissions and wrong Type, using status output and the journal.

Terminated by signal 2

Understand 'Terminated by signal 2' on Linux: why Ctrl-C sends SIGINT, why the exit code is 130, and how to trap the signal so scripts and services shut down cleanly.

ssh_exchange_identification: Connection closed by remote host

Fix 'ssh_exchange_identification: Connection closed by remote host': diagnose sshd crashes, TCP wrappers, fail2ban bans, MaxStartups throttling, full disk, and firewall drops.

sudo: must be owned by uid 0 and have the setuid bit set

Recover from 'sudo must be owned by uid 0 and have the setuid bit set': restore sudo ownership and the setuid bit via pkexec, su, or rescue mode.

sudo: no tty present and no askpass program specified

Fix 'sudo: no tty present and no askpass program specified': supply NOPASSWD, disable requiretty, use an askpass helper, or allocate a PTY for cron, CI, and remote sudo.

swapon: swapon failed: Invalid argument

Fix 'swapon failed: Invalid argument': diagnose an unformatted, wrong-size, holey, or CoW swap file versus a mislabeled partition, rebuild it correctly with mkswap, and enable swap reliably.

syntax error near unexpected token

Fix Bash 'syntax error near unexpected token' errors: handle arrays, subshells, function syntax, stray parentheses, and running a bash script under sh instead of bash.

Failed to start foo.service: Unit foo.service not found.

A practical walkthrough of why systemd reports a unit as not found, covering install paths, daemon-reload, template units, masking, and the exact fixes.

Too many levels of symbolic links

Fix 'Too many levels of symbolic links' (ELOOP): find and break circular or self-referencing symlinks, spot bind-mount loops, and safely repair broken link chains on Linux.

could not connect to server

Fix Linux database connection errors for PostgreSQL and MySQL: diagnose a stopped service, wrong socket path, listen_addresses binding, and firewall rules blocking the port.

No such file or directory' when Searching

Fix Linux file-search failures with find and locate: handle a stale updatedb database, wrong search path, case sensitivity, permission-hidden directories, and unquoted patterns.

Permission denied' and 'Input/output error

Fix Linux file-read failures: 'cannot open for reading: Permission denied' and 'Input/output error' from cat. Diagnose permissions, ACLs, ownership, and failing disk hardware.

syntax error: unexpected end of file

Fix Bash 'syntax error: unexpected end of file' errors: find the unclosed quote, if, for, while, case, function, or heredoc that leaves the parser waiting for a terminator.

is not in the sudoers file. This incident will be reported.

Fix the Linux 'deploy is not in the sudoers file. This incident will be reported.' error: add the user to sudo/wheel, repair /etc/sudoers with visudo, recover when locked out.

Value too large for defined data type

Resolve the Linux Value too large for defined data type and Numerical result out of range errors caused by 32-bit programs lacking Large File Support.

watchdog: BUG: soft lockup

Diagnose 'watchdog: BUG: soft lockup - CPU stuck' on Linux: read the stack trace, find spinlock and driver stalls, check steal time, and tune thresholds.

More for Linux & infra engineers

Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 2,778 DevOps AI prompts
  • One practical workflow email per week