35. Troubleshooting Guide
When production environments experience an outage, panic is the enemy of recovery. Amateur engineers restart services at random, reboot servers blindly, or change permissions without understanding the root cause—often destroying critical log evidence in the process.
Senior DevOps and SysAdmin professionals follow a disciplined, hypothesis-driven Troubleshooting Methodology.
35.1 7-Step Troubleshooting Lifecycle
Section titled “35.1 7-Step Troubleshooting Lifecycle” 1. Identify Problem (Understand symptoms, user impact, scope) ↓ 2. Collect Data (Inspect logs, metrics, alerts, recent git/infra changes) ↓ 3. Reproduce (Can you reliably trigger the failure in a controlled way?) ↓ 4. Isolate & Hypothesize (Narrow down to one specific component or layer) ↓ 5. Implement Fix (Apply the minimal, targeted change to resolve) ↓ 6. Verify (Prove the issue is resolved and test for regressions) ↓ 7. Document (Post-Mortem) (Root Cause Analysis, runbook updates, blameless review)Step 1: Identify the Problem
Section titled “Step 1: Identify the Problem”Never start fixing before clearly understanding the symptom:
- What is actually broken? (“Database returning HTTP 500” vs “Slow API response”).
- What is the scope? (Is it affecting all users, or only users in a specific region? One node or the entire cluster?).
- When did it start? (Did it coincide with a code deploy, a kernel update, or a certificate renewal?).
Step 2: Collect Information & Preserve State
Section titled “Step 2: Collect Information & Preserve State”Before restarting services or clearing caches, collect the live state:
- Check recent changes:
uptime,who -b,git log -n 5,history | tail -n 25. - Check active errors:
journalctl -p 3 -xb(priority: error/critical/alert). - Check kernel events:
dmesg -T | tail -n 50.
Step 3: Reproduce
Section titled “Step 3: Reproduce”If you cannot reproduce an issue, you cannot confirm when it is fixed.
- Use
curl -vto reproduce HTTP errors with full header traces. - Run the application command in foreground debug mode if possible.
Step 4: Isolate (Divide and Conquer)
Section titled “Step 4: Isolate (Divide and Conquer)”Work systematically through the layers. Test components independently:
- Can the server reach itself on
127.0.0.1? - Can it reach its local gateway?
- Can it resolve internal DNS?
- Can it connect to the database port via
nc -zv?
Step 5: Implement Fix (One Change at a Time)
Section titled “Step 5: Implement Fix (One Change at a Time)”Never change five configuration parameters simultaneously! If the issue resolves, you won’t know which change fixed it, and you may introduce new latent bugs. Apply one atomic change, test it, and observe the result.
Step 6: Verify
Section titled “Step 6: Verify”Confirm that:
- The original error symptom has disappeared.
- The metrics have returned to baseline.
- No adjacent dependencies or microservices were broken by your fix.
Step 7: Document & Post-Mortem
Section titled “Step 7: Document & Post-Mortem”A bug you don’t document is a bug you will debug twice.
- Conduct a blameless post-mortem:
- Timeline: When was the issue introduced, detected, and mitigated?
- Root Cause: What underlying design or configuration flaw enabled the failure?
- Action Items: What automated tests, monitoring alerts, or architecture changes will prevent this from ever happening again?
35.2 11 Diagnostic Areas
Section titled “35.2 11 Diagnostic Areas”When facing an unknown server failure, systematically investigate these 11 areas:
1. Boot Failures
Section titled “1. Boot Failures”- Symptoms: Server hangs on startup, kernel panic, drops to
(initramfs)or emergency shell. - Triage Checklist:
- Boot into GRUB, press
e, appendsystemd.unit=rescue.targetto inspect logs. - Check
/etc/fstabfor nonexistent UUIDs or corrupted partition labels. - Run
fsckon unmounted root filesystem. - Inspect kernel ring buffer via
journalctl -xb.
- Boot into GRUB, press
2. CPU Bottlenecks
Section titled “2. CPU Bottlenecks”- Symptoms: High load average, sluggish interactive terminal, worker timeouts.
- Triage Checklist:
Terminal window uptime # Compare 1/5/15 min load to nproctop -b -n 1 | head -n 20 # Identify runaway processesmpstat -P ALL 1 3 # Check if single core is pinned (single-threaded bottleneck)pidstat -w 1 3 # Check for excessive context switching
3. Memory & OOM
Section titled “3. Memory & OOM”- Symptoms: Services randomly dying, Redis/Node crashing,
Killedmessage in terminal. - Triage Checklist:
Terminal window free -h # Check available RAM vs swapvmstat 1 5 # Are si/so actively > 0? (Thrashing)sudo dmesg -T | grep -i oom # Confirm if OOM Killer terminated the processsudo journalctl -xe | grep -i "out of memory"
4. Disk & Storage
Section titled “4. Disk & Storage”- Symptoms: “No space left on device”, “Read-only file system”, slow database queries.
- Triage Checklist:
Terminal window df -h # Are any physical filesystems 100% full?df -i # Are Inodes 100% exhausted? (Zero disk bytes left, even if space looks free!)sudo du -sh /* 2>/dev/null | sort -h # Hunt down directory consuming spaceiostat -x -m 1 3 # Check if %util is at 100% and await > 20mssudo dmesg -T | grep -i -E "ext4|xfs|io error" # Check for filesystem remounted as read-only
5. Network Connectivity
Section titled “5. Network Connectivity”- Symptoms: Cannot connect to internet, dropped packets, API gateway timeouts.
- Triage Checklist:
Terminal window ip link show # Is the interface UP?ip addr show # Does it have a valid IP (not 169.254.x.x)?ip route show # Is the default gateway configured?ping -c 3 8.8.8.8 # Can we reach external IP bypassing DNS?mtr -rw target_ip # Where along the path are packets dropping?
6. DNS Resolution
Section titled “6. DNS Resolution”- Symptoms:
ping 8.8.8.8works, butcurl https://api.stripe.comfails with “Could not resolve host”. - Triage Checklist:
Terminal window cat /etc/resolv.conf # Who is the upstream nameserver?dig @127.0.0.1 domain.com # Test local resolverdig @8.8.8.8 domain.com # Test upstream public DNSresolvectl status # Inspect systemd-resolved status
7. SSH Access
Section titled “7. SSH Access”- Symptoms: “Connection refused”, “Permission denied (publickey)”, session hangs.
- Triage Checklist:
Terminal window # Test with verbose debugging from client machine:ssh -vvv user@server_ip# On the server:sudo ss -tulpn | grep :22 # Is sshd actually listening?sudo systemctl status sshd # Is the daemon running?sudo tail -n 50 /var/log/auth.log # (or /var/log/secure on RHEL) - shows exact auth failure reasonls -ld ~/.ssh && ls -l ~/.ssh/authorized_keys # Are permissions strictly 700 and 600?
8. Services & Daemons (systemd)
Section titled “8. Services & Daemons (systemd)”- Symptoms: Service fails to start, crash-looping (
auto-restart). - Triage Checklist:
Terminal window sudo systemctl status <service_name>sudo journalctl -u <service_name> -n 50 --no-pager# Test manual binary execution using ExecStart command from service file:systemctl cat <service_name>
9. File & Directory Permissions
Section titled “9. File & Directory Permissions”- Symptoms: “Permission denied” when file exists and user appears to have access.
- Triage Checklist:
Terminal window ls -la /path/to/file # Check owner, group, and standard rwxnamei -l /path/to/file # Check execute permissions across EVERY parent folder in the path!getfacl /path/to/file # Check if an ACL (+ sign) or mask is overriding permissionsls -Z /path/to/file # Check if SELinux security context is blocking access
10. Package Management
Section titled “10. Package Management”- Symptoms: Broken dependencies, locked apt database, corrupted RPM database.
- Triage Checklist:
Terminal window # Fix interrupted installs on Debian/Ubuntu:sudo dpkg --configure -asudo apt --fix-broken install# If apt lock is stuck (ensure no apt process is running first!):sudo lsof /var/lib/dpkg/lock-frontend# Rebuild RPM database on RHEL/CentOS:sudo rpm --rebuilddb
11. System Logs Analysis
Section titled “11. System Logs Analysis”- Symptoms: Unexplained crashes or errors without clear user-facing messages.
- Primary Log Locations:
/var/log/syslogor/var/log/messages: General OS system logs./var/log/auth.logor/var/log/secure: Authentication and sudo logs./var/log/dmesgorjournalctl -k: Kernel logs./var/log/nginx/or/var/log/httpd/: Web server access and error logs.journalctl -p err..emerg: Query systemd journal filtered strictly for error-level logs and above.