Skip to content

Cheat sheet: Error codes & fixes

Look up an error: HTTP 404/502/503/504, exit codes 126/127/137/143, CrashLoopBackOff, ImagePullBackOff, Permission denied, no space left on device, git rejected, state lock. Meaning, causes and the diagnose command.

IndexUpdated

Also:error codes · http status · 400 · 401 · 403 · 404 · 405 · 413 · 429 · 500 · 502 · 503 · 504 · exit code · exit code 137 · exit code 127 · OOMKilled · CrashLoopBackOff · ImagePullBackOff · Pending · Permission denied · no space left on device · connection refused · address already in use · certificate has expired

Type the code or the message in the filter (404, 137, CrashLoopBackOff, permission denied) and click it: you get what it means, the usual causes & fixes, and a command to diagnose it, explained part by part.

55 items
Click a command to see what each part does.

HTTP status codes & TLS15

  • curl -sSIL <url>301 / 302Redirect: see every hop

    What it means

    301 Moved Permanently / 302 Found: the resource is at another URL, given in the Location header. Not an error by itself.

    Usual causes & fixes

    • Redirect loop (ERR_TOO_MANY_REDIRECTS): HTTP→HTTPS redirect behind a load balancer that terminates TLS. The app sees HTTP every time; trust X-Forwarded-Proto.
    • Wrong host or missing trailing slash in the Location header.
    • Old path after a move: update the link or add a permanent redirect.

    Diagnose: what each part of the command does

    1. curlmake an HTTP request
    2. -s -Sno progress bar, but still show errors
    3. -Iheaders only (HEAD request)
    4. -Lfollow redirects, printing the headers of every hop
    5. <url>the address you are testing
  • curl -v -X POST -H "Content-Type: application/json" -d @<file>.json <url>400Bad Request: look at exactly what you send

    What it means

    The server will not process the request because of a client error: malformed syntax, invalid framing, bad parameters.

    Usual causes & fixes

    • Invalid JSON: check it with jq . <file>.json.
    • Missing or wrong Content-Type header.
    • Headers or cookies too large (nginx: "Request Header Or Cookie Too Large" → raise large_client_header_buffers).
    • Required field missing: read the response body, APIs usually say which one.

    Diagnose: what each part of the command does

    1. -vverbose: print request and response headers
    2. -X POSTHTTP method
    3. -H "Content-Type: application/json"tell the server the body is JSON
    4. -d @<file>.jsonsend the body from a file (@ = read file)
  • curl -i -H "Authorization: Bearer <token>" <url>401Unauthorized: test the credentials

    What it means

    "Unauthenticated": the request has no valid credentials. The WWW-Authenticate response header says which scheme is expected.

    Usual causes & fixes

    • Token missing, expired or for the wrong environment.
    • Wrong scheme: Bearer vs Basic vs an API-key header.
    • Clock skew makes a fresh JWT look expired/not-yet-valid: check timedatectl.
    • A proxy (basic auth, oauth2-proxy) in front of the app asks for its own login.

    Diagnose: what each part of the command does

    1. -iinclude response headers in the output
    2. -H "Authorization: Bearer <token>"send the token the way the API expects
  • namei -l <path-to-file>403Forbidden: check the server log and the file path

    What it means

    The server knows who you are but refuses access.

    Usual causes & fixes

    • nginx/Apache: the web server user needs x on every parent folder and r on the file (see namei output). Check sudo tail -n 50 /var/log/nginx/error.log.
    • Folder requested but no index file and autoindex off → 403.
    • IP allow/deny list, WAF rule, or a cloud bucket policy.
    • Kubernetes API "forbidden": RBAC. Check with kubectl auth can-i <verb> <resource> -n <namespace>.

    Diagnose: what each part of the command does

    1. nameifollow a path one component at a time
    2. -llong format: owner, group and permissions of EVERY directory on the way
    3. <path-to-file>e.g. /var/www/site/index.html
  • curl -sS -o /dev/null -w "%{http_code} %{url_effective}\n" -L <url>404Not Found: what does the server actually return?

    What it means

    The server cannot find the requested resource. For an API it can also mean the endpoint exists but the object does not.

    Usual causes & fixes

    • Typo or wrong path/base path (e.g. app served under /api but called at /).
    • nginx location / root / alias points somewhere else: nginx -T | grep -n -A5 "location".
    • Kubernetes ingress host or path does not match (see the next entry).
    • Static site: file not deployed, or case-sensitive name (Index.html vs index.html).

    Diagnose: what each part of the command does

    1. -sSquiet, show errors
    2. -o /dev/nulldiscard the body
    3. -w "%{http_code} %{url_effective}\n"print the final status and the final URL after redirects
    4. -Lfollow redirects
  • kubectl get ingress -A; kubectl describe ingress <ingress> -n <namespace>404Not Found behind a Kubernetes ingress

    What it means

    The ingress controller answered but no rule matched the host + path (often the controller's default 404 page).

    Usual causes & fixes

    • Host header does not match the host: rule (test with curl -H "Host: <host>" http://<ingress-ip>/<path>).
    • pathType: Exact vs Prefix, or a rewrite annotation changing the path.
    • Wrong ingressClassName, so a different controller (or none) owns the ingress.

    Diagnose: what each part of the command does

    1. get ingress -Aall ingresses with their HOSTS and ADDRESS
    2. describe ingress <ingress>rules: host + path → service:port, and events
    3. -n <namespace>namespace of the ingress
  • curl -i -X OPTIONS <url>405Method Not Allowed: which methods are allowed?

    What it means

    The method (GET/POST/PUT…) is known but not supported for this URL.

    Usual causes & fixes

    • POST to a static location, or GET to a POST-only endpoint.
    • A proxy or ingress rule only allows some methods.
    • CORS preflight (OPTIONS) not handled by the API.

    Diagnose: what each part of the command does

    1. -ishow response headers
    2. -X OPTIONSask the server which methods it supports (Allow header)
  • grep -rn "client_max_body_size" /etc/nginx/413Content Too Large: find the body size limit

    What it means

    The request body is larger than the server allows.

    Usual causes & fixes

    • nginx: raise client_max_body_size 50m; in the http/server/location block, then sudo nginx -t && sudo systemctl reload nginx.
    • ingress-nginx: annotation nginx.ingress.kubernetes.io/proxy-body-size: "50m".
    • App or framework upload limit as well.

    Diagnose: what each part of the command does

    1. grep -rnsearch recursively with line numbers
    2. "client_max_body_size"nginx directive that limits upload size
    3. /etc/nginx/nginx config folder
  • curl -sI <url> | grep -i -E "retry-after|ratelimit"429Too Many Requests: read the rate-limit headers

    What it means

    You sent too many requests in a given time (rate limiting).

    Usual causes & fixes

    • Wait for Retry-After seconds; add backoff with jitter to clients.
    • Retry storm from many pods sharing one egress IP / API key.
    • Docker Hub "toomanyrequests" on image pulls: docker login or use a mirror.

    Diagnose: what each part of the command does

    1. curl -sIquiet, headers only
    2. | grep -i -Ecase-insensitive, extended regex filter
    3. "retry-after|ratelimit"Retry-After and X-RateLimit-* headers
  • kubectl logs <pod> -n <namespace> --tail=100500Internal Server Error: read the application logs

    What it means

    Generic "the server hit something it does not know how to handle": the app crashed or threw.

    Usual causes & fixes

    • Unhandled exception: the stack trace is in the app log (docker logs <container> / journalctl -u <service>).
    • Bad config or missing env var after a deploy: compare with the previous version, roll back if needed.
    • Downstream dependency (DB, cache) down or credentials rotated.

    Diagnose: what each part of the command does

    1. kubectl logs <pod>app output (stack traces end up here)
    2. -n <namespace>namespace
    3. --tail=100last 100 lines
  • sudo tail -n 50 /var/log/nginx/error.log502Bad Gateway: the proxy got no valid answer from the app

    What it means

    The gateway/proxy received an invalid response from the upstream (your app).

    Usual causes & fixes

    • App not running or crashed: check systemctl status <service> / pod status.
    • Proxy points to the wrong port (proxy_pass / Service targetPort).
    • App listens on 127.0.0.1 inside a container instead of 0.0.0.0.
    • TLS mismatch: proxy speaks HTTP to an HTTPS backend or the reverse.

    Diagnose: what each part of the command does

    1. sudolog files are root-only
    2. tail -n 50last 50 lines
    3. /var/log/nginx/error.lognginx error log: says why the upstream failed (connection refused, reset, …)
  • kubectl get endpointslices -l kubernetes.io/service-name=<service> -n <namespace>502 / 503Kubernetes service has no ready pods behind it

    What it means

    Empty ENDPOINTS = the Service has nowhere to send traffic, so the ingress returns 502/503.

    Usual causes & fixes

    • Service selector does not match the pod labels: compare kubectl get svc <service> -o yaml with kubectl get pods --show-labels.
    • Pods exist but are not Ready: readiness probe failing (kubectl describe pod <pod> → Events).
    • targetPort does not match the containerPort.

    Diagnose: what each part of the command does

    1. get endpointslicesthe pod IPs a Service actually sends traffic to
    2. -l kubernetes.io/service-name=<service>only the slices of that Service
    3. -n <namespace>namespace
  • kubectl get pods -l app=<app> -n <namespace> -o wide503Service Unavailable: are the pods ready?

    What it means

    The server is not ready to handle the request: down for maintenance or overloaded. Often sent with Retry-After.

    Usual causes & fixes

    • READY 0/1: readiness probe failing (wrong path/port, app still starting).
    • All replicas restarting or scaled to 0.
    • Maintenance mode or circuit breaker in the proxy/mesh (Envoy "no healthy upstream").

    Diagnose: what each part of the command does

    1. -l app=<app>pods of that app
    2. -o wideshow node and IP too
  • curl -sS -o /dev/null -w "connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n" <url>504Gateway Timeout: how long does the backend take?

    What it means

    The gateway did not get a response from the upstream in time.

    Usual causes & fixes

    • Backend slower than the proxy timeout: nginx proxy_read_timeout defaults to 60s; cloud load balancers have their own idle timeout.
    • Slow DB query or external call: check app/DB logs.
    • Network path blocked (security group / firewall) so the connect hangs.

    Diagnose: what each part of the command does

    1. -o /dev/nulldiscard body
    2. %{time_connect}time to open the TCP connection
    3. %{time_starttransfer}time to first byte: how long the backend "thought"
    4. %{time_total}whole request
  • echo | openssl s_client -connect <host>:443 -servername <host> 2>/dev/null | openssl x509 -noout -subject -issuer -datesTLSCertificate expired / not trusted: inspect the cert

    What it means

    Errors like "certificate has expired", "unable to get local issuer certificate" or "hostname mismatch" come from the certificate the server presents.

    Usual causes & fixes

    • Expired: renew (cert-manager / certbot) and reload the server.
    • Missing intermediate chain: serve the full chain (fullchain.pem).
    • Hostname not in the SAN list, or wrong SNI/default certificate.

    Diagnose: what each part of the command does

    1. echo |send an empty request so s_client exits
    2. openssl s_client -connect <host>:443do a TLS handshake
    3. -servername <host>SNI: ask for the certificate of this host name
    4. 2>/dev/nullhide handshake noise
    5. openssl x509 -nooutparse the certificate, do not print it
    6. -subject -issuer -dateswho it is for, who signed it, valid from / until

Exit codes10

  • echo $?$?What did the last command return?

    What it means

    Every command returns a number 0-255. 0 means success. CI jobs and && use it.

    Usual causes & fixes

    • Check it right after the command; the next command overwrites it.
    • In scripts use set -e to stop on the first failure, set -o pipefail to catch failures inside pipes.

    Diagnose: what each part of the command does

    1. echoprint
    2. $?exit status of the last command: 0 = success, anything else = failure
  • bash -x <script>.sh1General error: trace the script

    What it means

    Catch-all for general errors: the program failed and chose 1.

    Usual causes & fixes

    • Read the last lines of stderr: the real message is usually there.
    • A command inside the script failed: -x shows which one.

    Diagnose: what each part of the command does

    1. bashrun the script with bash
    2. -xprint every command (with expanded variables) before running it
  • <command> --help2Misuse / wrong arguments

    What it means

    Bash builtins return 2 for incorrect usage (invalid option, missing argument); many tools follow this.

    Usual causes & fixes

    • Typo in a flag or a missing required argument.
    • Shell syntax error in a script.

    Diagnose: what each part of the command does

    1. --helpshow valid options and arguments
  • ls -l <file>; file <file>126Found but cannot execute

    What it means

    The command exists but is not executable.

    Usual causes & fixes

    • Missing execute bit: chmod +x <file>.
    • Windows line endings in a script: sed -i 's/\r$//' <file> (or dos2unix).
    • Filesystem mounted noexec: findmnt -o TARGET,OPTIONS -T <file>.

    Diagnose: what each part of the command does

    1. ls -l <file>check the x permission bit
    2. file <file>check the type: script with CRLF line terminators, wrong binary format…
  • command -v <command> || echo "not found; PATH=$PATH"127Command not found

    What it means

    The shell could not find the program in any PATH folder.

    Usual causes & fixes

    • Not installed (install it with apt/dnf/apk).
    • Installed in a folder not on PATH (e.g. ~/.local/bin): export PATH="$HOME/.local/bin:$PATH".
    • Typo, or a container image that does not include the tool (distroless, alpine without bash).

    Diagnose: what each part of the command does

    1. command -v <command>print where the command is, or nothing if it is not found
    2. ||if that failed…
    3. echo "…PATH=$PATH"…show the folders the shell searches
  • kill -l $(( <exit-code> - 128 ))128+NKilled by a signal: which one?

    What it means

    When a process dies from signal N, the shell reports 128+N. E.g. 137 → 9 (KILL), 143 → 15 (TERM), 130 → 2 (INT).

    Usual causes & fixes

    • Run it with the code you got, e.g. kill -l $(( 137 - 128 )) prints KILL.

    Diagnose: what each part of the command does

    1. kill -l <number>print the signal name for a number
    2. $(( … ))shell arithmetic
    3. <exit-code> - 128exit codes above 128 mean "terminated by signal N"
  • kill -l 2130Stopped with Ctrl+C

    What it means

    128 + 2 (SIGINT): someone (or something) pressed Ctrl+C / sent an interrupt.

    Usual causes & fixes

    • Expected if you stopped it. In CI it usually means the job was cancelled.

    Diagnose: what each part of the command does

    1. kill -l 2signal 2 = INT, what Ctrl+C sends
  • dmesg -T | grep -i -E "out of memory|killed process"137Killed (SIGKILL): usually out of memory

    What it means

    128 + 9 (SIGKILL): the process was force-killed. In containers this is almost always the memory limit (OOMKilled).

    Usual causes & fixes

    • Docker: docker inspect --format '{{.State.OOMKilled}}' <container>; raise -m or fix the leak.
    • Kubernetes: kubectl describe pod <pod> → Last State: Terminated, Reason: OOMKilled; raise resources.limits.memory.
    • A human or script ran kill -9, or a stop timed out and was escalated.

    Diagnose: what each part of the command does

    1. dmesg -Tkernel messages with readable timestamps
    2. grep -i -E "out of memory|killed process"the OOM killer lines
  • dmesg -T | grep -i segfault139Segmentation fault (SIGSEGV)

    What it means

    128 + 11 (SIGSEGV): the program accessed invalid memory and crashed.

    Usual causes & fixes

    • Bug in a native binary or library; version mismatch between binary and libs (e.g. glibc vs musl/alpine).
    • Wrong CPU architecture image under emulation.

    Diagnose: what each part of the command does

    1. dmesg -Tkernel log
    2. grep -i segfaultlines about the crash (which binary, which library)
  • docker inspect --format '{{.State.ExitCode}} {{.State.FinishedAt}}' <container>143Terminated (SIGTERM): asked to stop

    What it means

    128 + 15 (SIGTERM): a graceful stop request: docker stop, a Kubernetes rollout/scale-down, systemctl stop.

    Usual causes & fixes

    • Normal during deploys and restarts.
    • If unexpected: check who stopped it (events, kubectl get events, systemd journal).
    • App should handle SIGTERM and exit cleanly within the grace period (terminationGracePeriodSeconds, default 30s).

    Diagnose: what each part of the command does

    1. docker inspectcontainer details
    2. --format '…'print just the exit code and when it stopped

Kubernetes pod errors9

  • kubectl logs <pod> -n <namespace> --previousCrashLoopBackOffContainer keeps crashing: read the crashed run

    What it means

    Not a phase: the container starts, exits, and Kubernetes keeps restarting it with increasing back-off.

    Usual causes & fixes

    • App exits at startup: missing env var, bad config, failed DB connection (see the log).
    • OOMKilled / exit 137: raise the memory limit.
    • Liveness probe kills a slow-starting app: add a startupProbe.
    • Wrong command/args in the pod spec.

    Diagnose: what each part of the command does

    1. logs <pod>container output
    2. --previousfrom the previous (crashed) container, not the one restarting now
  • kubectl describe pod <pod> -n <namespace> | grep -A 10 EventsImagePullBackOffImage cannot be pulled: read the pull error

    What it means

    ErrImagePull / ImagePullBackOff: the kubelet could not pull the image and is backing off.

    Usual causes & fixes

    • Wrong image name or tag (typos, tag never pushed).
    • Private registry without imagePullSecrets.
    • Registry rate limit (Docker Hub "toomanyrequests") or the node cannot reach the registry.
    • Check from your machine: docker pull <image>:<tag>.

    Diagnose: what each part of the command does

    1. describe podfull status
    2. | grep -A 10 Eventsjump to the Events and show 10 lines after
  • kubectl describe pod <pod> -n <namespace>PendingPod not scheduled: why?

    What it means

    The pod is accepted but not running: usually it cannot be scheduled onto any node.

    Usual causes & fixes

    • "Insufficient cpu/memory": requests too high or the cluster is full (scale nodes or lower requests).
    • "had untolerated taint" / node selector or affinity matches no node.
    • PersistentVolumeClaim not bound: kubectl get pvc -n <namespace>.

    Diagnose: what each part of the command does

    1. describe podlook at Events: FailedScheduling explains the reason
  • kubectl get configmap,secret -n <namespace>CreateContainerConfigErrorMissing ConfigMap or Secret

    What it means

    The container config refers to something that does not exist (usually a ConfigMap/Secret or a key in it).

    Usual causes & fixes

    • Create the missing ConfigMap/Secret, or fix the name/key in envFrom / valueFrom.
    • It exists in another namespace: they are namespaced.

    Diagnose: what each part of the command does

    1. get configmap,secretlist both kinds at once
  • kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.containerStatuses[*].lastState.terminated.reason}'OOMKilledWas the container killed for memory?

    What it means

    The container used more memory than its limit and the kernel killed it (exit code 137).

    Usual causes & fixes

    • Raise resources.limits.memory (and requests) or fix the leak; compare with kubectl top pod.
    • JVM/Node.js heap configured larger than the container limit.

    Diagnose: what each part of the command does

    1. -o jsonpath=…print one field
    2. lastState.terminated.reasonwhy the previous container instance ended (OOMKilled, Error, Completed)
  • kubectl get pods -A --field-selector=status.phase=FailedEvictedPods evicted from a node

    What it means

    The kubelet removed pods because the node ran short of memory or disk (or for maintenance).

    Usual causes & fixes

    • Check node pressure: kubectl describe node <node> → Conditions (DiskPressure, MemoryPressure).
    • Clean them up: kubectl delete pods -A --field-selector=status.phase=Failed.
    • Set requests/limits and ephemeral-storage limits so pods are scheduled realistically.

    Diagnose: what each part of the command does

    1. -Aall namespaces
    2. --field-selector=status.phase=Failedevicted pods end up as Failed
  • kubectl get events -n <namespace> --sort-by=.lastTimestampContainerCreatingStuck creating: volume or network problem

    What it means

    The pod is on a node but the container has not started yet.

    Usual causes & fixes

    • FailedMount / FailedAttachVolume: PVC, Secret or ConfigMap volume not available.
    • CNI / network sandbox errors: networking plugin problem on that node.
    • Very large image still pulling.

    Diagnose: what each part of the command does

    1. get eventswhat the scheduler/kubelet reported
    2. --sort-by=.lastTimestampnewest last
  • kubectl auth can-i <verb> <resource> -n <namespace> --as=<user>ForbiddenRBAC: am I allowed to do this?

    What it means

    "… is forbidden: User … cannot …": the identity has no Role/ClusterRole binding for that action.

    Usual causes & fixes

    • Add a RoleBinding / ClusterRoleBinding for the user or service account.
    • Wrong context or namespace: kubectl config current-context.

    Diagnose: what each part of the command does

    1. auth can-iask the API server whether an action is allowed (yes/no)
    2. <verb> <resource>e.g. get pods, create deployments
    3. --as=<user>check for another user or service account (system:serviceaccount:<ns>:<name>)
  • kubectl config current-context && kubectl cluster-infoUnable to connect"Unable to connect to the server" / "Unauthorized"

    What it means

    kubectl cannot reach or authenticate to the API server.

    Usual causes & fixes

    • Wrong context, VPN off, or a private API endpoint.
    • Expired credentials: refresh the kubeconfig (aws eks update-kubeconfig, az aks get-credentials, gcloud container clusters get-credentials).

    Diagnose: what each part of the command does

    1. config current-contextwhich cluster kubectl is pointing at
    2. &&then
    3. cluster-infotry to reach the API server

Linux & SSH errors10

  • namei -l <path>Permission deniedWhich part of the path blocks me?

    What it means

    The user lacks the permission needed: r to read, w to write, x to run a file or to enter a folder.

    Usual causes & fixes

    • Missing x on a parent folder blocks everything below it.
    • File belongs to another user: sudo chown <user>:<group> <path> or add the user to the group.
    • Script not executable: chmod +x <file>.
    • SELinux/AppArmor can deny even when modes look fine: ls -Z, sudo ausearch -m avc -ts recent.

    Diagnose: what each part of the command does

    1. namei -lowner, group and permissions of every folder on the way to <path>
  • df -h <path>; df -i <path>No space left on deviceOut of disk space or inodes

    What it means

    ENOSPC: the filesystem has no free blocks or no free inodes left.

    Usual causes & fixes

    • Find big folders: sudo du -xh --max-depth=1 <path> | sort -rh | head.
    • Deleted files still open: sudo lsof -nP +L1 (restart the process).
    • Docker: docker system df then prune; journald: journalctl --vacuum-time=7d.

    Diagnose: what each part of the command does

    1. df -h <path>free space on the filesystem holding <path>
    2. df -i <path>free inodes: a disk can be "full" with millions of tiny files
  • sudo ss -tlnp | grep :<port>Connection refusedIs anything listening on that port?

    What it means

    The host answered but nothing accepts connections on that port (or a firewall actively rejects).

    Usual causes & fixes

    • Service not running: systemctl status <service>.
    • Listening only on 127.0.0.1, not 0.0.0.0 / the external IP.
    • Wrong port in the client config.

    Diagnose: what each part of the command does

    1. ss -tlnpTCP listening sockets with numeric ports and process
    2. | grep :<port>only that port
  • nc -zv -w 5 <host> <port>Connection timed outCan I reach the port at all?

    What it means

    No answer at all: packets are dropped on the way.

    Usual causes & fixes

    • Firewall, security group or network ACL blocks the port.
    • Wrong IP / host is down / routing problem (traceroute <host>).

    Diagnose: what each part of the command does

    1. nc -zjust test the connection
    2. -vsay succeeded / timed out
    3. -w 5give up after 5 seconds
  • sudo lsof -i :<port>Address already in useWho holds the port?

    What it means

    EADDRINUSE: another process is already bound to that port.

    Usual causes & fixes

    • Stop the other process or pick another port.
    • Old instance still running (e.g. a previous container: docker ps --filter publish=<port>).

    Diagnose: what each part of the command does

    1. lsof -i :<port>process that has that port open
  • getent hosts <hostname>Could not resolve hostDNS: does the name resolve?

    What it means

    "Name or service not known" / "Temporary failure in name resolution": the hostname could not be turned into an IP.

    Usual causes & fixes

    • Typo, or a private name that only resolves inside a VPN/VPC.
    • Broken resolver: check cat /etc/resolv.conf, test with dig @8.8.8.8 <hostname>.
    • In Kubernetes use <service>.<namespace>.svc.cluster.local.

    Diagnose: what each part of the command does

    1. getent hostsresolve the name the way the system does (/etc/hosts + DNS)
  • ulimit -n; grep "open files" /proc/<pid>/limitsToo many open filesCheck the open-files limit

    What it means

    EMFILE: the process hit its maximum number of open file descriptors.

    Usual causes & fixes

    • Raise it for a service: LimitNOFILE=65536 in the systemd unit, then daemon-reload + restart.
    • A descriptor leak in the app (count them: ls /proc/<pid>/fd | wc -l).

    Diagnose: what each part of the command does

    1. ulimit -nlimit for your current shell
    2. /proc/<pid>/limitsthe limits a running process actually has
  • findmnt -o TARGET,OPTIONS -T <path>Read-only file systemWhy is the disk read-only?

    What it means

    The filesystem is mounted read-only, often remounted by the kernel after disk errors.

    Usual causes & fixes

    • Check kernel errors: dmesg -T | grep -i -E "error|remount".
    • Containers: the image filesystem is read-only by design; write to a volume or /tmp.

    Diagnose: what each part of the command does

    1. findmnt -T <path>the mount that contains <path>
    2. -o TARGET,OPTIONSshow where it is mounted and its options (ro / rw)
  • ssh-keygen -R <host>Host key verification failedServer key changed: remove the old oneCaution

    What it means

    The server's SSH host key differs from the one you saved: a rebuilt server, or a man-in-the-middle.

    Usual causes & fixes

    • Verify the new fingerprint out of band before reconnecting.
    • Expected after recreating a VM with the same IP/name.

    Diagnose: what each part of the command does

    1. ssh-keygen -R <host>delete the saved key for <host> from ~/.ssh/known_hosts
  • ssh -v <user>@<host>Permission denied (publickey)SSH key rejected: see what ssh tries

    What it means

    The server did not accept any of your keys.

    Usual causes & fixes

    • Wrong user (ubuntu vs ec2-user vs root) or wrong key: ssh -i <key-file> <user>@<host>.
    • Permissions too open: chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys ~/.ssh/id_ed25519 (sshd StrictModes refuses group/world-writable files).
    • Public key not in the server's ~/.ssh/authorized_keys: ssh-copy-id <user>@<host>.

    Diagnose: what each part of the command does

    1. -vverbose: shows which keys are offered and why they are refused

Docker errors5

  • sudo usermod -aG docker $USER && newgrp dockerdocker.sock permission denied"permission denied while trying to connect to the Docker daemon socket"Caution

    What it means

    Your user may not talk to /var/run/docker.sock.

    Usual causes & fixes

    • Note: the docker group is root-equivalent on that machine.

    Diagnose: what each part of the command does

    1. usermod -aG docker $USERadd yourself to the docker group
    2. &&then
    3. newgrp dockerstart a shell with the new group (or log out and in)
  • sudo systemctl status dockerCannot connect to daemon"Cannot connect to the Docker daemon … Is the docker daemon running?"

    What it means

    The client cannot reach dockerd.

    Usual causes & fixes

    • Start it: sudo systemctl enable --now docker.
    • Wrong DOCKER_HOST or context: docker context ls.

    Diagnose: what each part of the command does

    1. systemctl status dockeris the Docker service running, and its last log lines
  • docker ps --filter publish=<port>port is already allocatedWhich container holds the host port?

    What it means

    Another container (or process) already uses that host port.

    Usual causes & fixes

    • Stop/remove the other container, or map a different host port (-p 8081:80).
    • Not a container? sudo lsof -i :<port>.

    Diagnose: what each part of the command does

    1. --filter publish=<port>containers publishing that host port
  • docker image inspect <image> --format '{{.Os}}/{{.Architecture}}'exec format errorImage built for another CPU architecture

    What it means

    The binary in the image does not match the machine's CPU (e.g. an arm64 image on amd64), or a script lacks a shebang.

    Usual causes & fixes

    • Build for the target: docker buildx build --platform linux/amd64,linux/arm64 ….
    • Script entrypoint: add #!/bin/sh as the first line.

    Diagnose: what each part of the command does

    1. image inspectimage metadata
    2. --format '{{.Os}}/{{.Architecture}}'e.g. linux/arm64 vs linux/amd64
  • docker logintoomanyrequestsDocker Hub pull rate limit

    What it means

    Anonymous pulls from Docker Hub are rate-limited per IP.

    Usual causes & fixes

    • Log in (also on CI runners / nodes via imagePullSecrets).
    • Use a pull-through cache or mirror the images to your own registry.

    Diagnose: what each part of the command does

    1. docker loginauthenticated pulls get a higher limit

Git, Terraform & Helm errors6

  • git pull --rebase origin <branch>rejected (non-fast-forward)"Updates were rejected because the remote contains work that you do not have"

    What it means

    Someone pushed to the branch since you last pulled; a plain push would overwrite their work.

    Usual causes & fixes

    • Pull with rebase, resolve conflicts, then git push.
    • Only after a deliberate rebase of your own branch: git push --force-with-lease.

    Diagnose: what each part of the command does

    1. pull --rebasefetch the remote commits and replay yours on top
    2. origin <branch>the branch you are pushing
  • git diff --name-only --diff-filter=UCONFLICTMerge conflict: which files?

    What it means

    Both sides changed the same lines; Git marked them with <<<<<<< ======= >>>>>>>.

    Usual causes & fixes

    • Edit the files, remove the markers, git add <file>, then git commit (or git rebase --continue).
    • Give up: git merge --abort / git rebase --abort.

    Diagnose: what each part of the command does

    1. --name-onlylist file names only
    2. --diff-filter=Uonly Unmerged (conflicted) files
  • git switch -c <new-branch>detached HEADKeep work done in detached HEAD

    What it means

    You checked out a commit or tag directly, not a branch. New commits belong to no branch.

    Usual causes & fixes

    • Already switched away? Find the commit in git reflog.

    Diagnose: what each part of the command does

    1. switch -c <new-branch>create a branch at the current commit so the work is not lost
  • git rev-parse --show-toplevelnot a git repository"fatal: not a git repository"

    What it means

    The current folder is not inside a Git working tree.

    Usual causes & fixes

    • cd into the repo, or git init / git clone first.
    • In CI/containers: "dubious ownership" → git config --global --add safe.directory <path>.

    Diagnose: what each part of the command does

    1. rev-parse --show-toplevelprint the repo root, or fail if you are not inside a repo
  • terraform force-unlock <lock-id>state lockTerraform "Error acquiring the state lock"Destructive

    What it means

    Another run holds the state lock, or a crashed/cancelled run left it behind.

    Usual causes & fixes

    • Make sure no other plan/apply is running first.
    • Avoid by not cancelling apply jobs; use a CI concurrency group per workspace.

    Diagnose: what each part of the command does

    1. force-unlock <lock-id>remove the lock (ID is in the error message)
  • helm history <release> -n <namespace>another operation in progressHelm "another operation (install/upgrade/rollback) is in progress"

    What it means

    A previous Helm operation was interrupted and left the release in a pending state.

    Usual causes & fixes

    • Roll back to the last deployed revision: helm rollback <release> <revision> -n <namespace>.
    • Use --rollback-on-failure (Helm 4) / --atomic (Helm 3) and a timeout so this cleans up itself.

    Diagnose: what each part of the command does

    1. history <release>revisions; the last one is stuck in pending-install / pending-upgrade

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…