Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Server 'Fake Death': Why Ping Works But SSH Login Fails
Operations 90 min read

Server 'Fake Death': Why Ping Works But SSH Login Fails

This article details a server 'fake death' incident where ping succeeds but SSH login hangs, explaining why ICMP responsiveness doesn't indicate user-space health, and provides a step-by-step troubleshooting framework covering load analysis, D-state processes, disk I/O, NFS hangs, memory pressure, and evidence preservation using sysrq.

Problem Background

At 2 AM, monitoring alerts show rising SSH login failure rates. SSH connections establish (TCP handshake normal), but after entering the password the session hangs with no shell prompt. Meanwhile, ping works perfectly with 0% packet loss. This is not a network issue but a "fake death": the kernel network stack still answers ICMP, yet the entire user-space is near standstill — process scheduling extremely slow, disk I/O stuck, process creation failing, every step of the login chain (fork sshd, read PAM config, write utmp, allocate PTY, write logs) spinning or failing.

This article walks through the complete incident: symptoms, why ping ≠ health, troubleshooting order, commands and interpretation at each step, root cause identification, fix implementation, evidence preservation, and postmortem writing. It provides a reusable standard operating procedure for "server fake death" class problems.

Applicable Scenarios

On-call ops at night facing "ping works but cannot login" needing a structured troubleshooting sequence before impulsive actions.

Cloud/physical server admins who must understand why "ping all green" monitoring is insufficient and implement proper host liveness checks.

Teams building fake-death playbooks : which channels remain usable when local login fails, and which actions must never be taken.

Data analysis practitioners wanting to truly grasp load average, D-state, uninterruptible sleep concepts rather than memorize definitions.

Note: If TCP port 22 cannot even handshake (firewall/security group), that's not this "fake death". The specific signature here is: ICMP reachable + TCP 22 handshake succeeds + but authentication yields no feedback or UI freezes after handshake .

Core Knowledge Points

Why Ping Works While User-Space Collapses

ping

uses ICMP Echo, answered directly by the kernel protocol stack without any user-space process involvement. SSH login, however, traverses a full user-space chain:

sshd process
  ├─ Read ~/.ssh/authorized_keys or perform auth (PAM)
  ├─ Interact with PAM modules (pam_unix verify password)
  ├─ Write utmp/wtmp (login records)
  ├─ Allocate PTY (/dev/pts)
  ├─ Setup session, read shell config
  └─ Finally hand over shell to you

Each step can stall or fail due to: disk full → utmp/wtmp write fails; process table full → fork fails; extreme load → scheduling slower than snails, one auth takes tens of seconds; D-state processes pile up → waiting for I/O forever; /var full → PAM reads config slowly, journald fails to write logs.

Therefore, judging "is the machine alive" by ping is the worst single signal . A machine's health triangle: kernel network answers (ping) ≠ user-space usable (can login) ≠ service usable (business APIs normal). Fake death sits exactly between "kernel alive, user-space dead".

What load average Actually Measures

uptime

's first three numbers are 1/5/15 minute average load. Many think it means "how busy is my CPU", but its statistical scope is:

load = current count of processes in R (running) + D (uninterruptible sleep, usually waiting for I/O) states

Thus a severe I/O stall (many D-state processes waiting) can drive load into hundreds or thousands even with idle CPU. That's why "load 100 but top shows low CPU" is not a contradiction but independent evidence.

Uninterruptible Sleep (D-state)

Processes enter uninterruptible sleep when waiting for disk I/O, NFS responses, page faults, etc. Flag is ps state column D. They cannot be killed by signals (even SIGKILL) until the kernel-layer I/O completes or errors out.

Therefore:
- Seeing many D-state → first reaction is check I/O, not try kill (kill useless)
- NFS mount hang is #1 source of D-state
- Disk failures (bad sectors / array controller hang) also create D processes

Why Login Ultimately Dies from Resource Exhaustion

Table of resource exhaustion scenarios that break login (converted to list):

Disk space : /var full → utmp/wtmp write fails → No response after auth, or "HOME directory cannot write"

Inode exhaustion : Massive small files consume all inodes → df shows space but always "cannot create file"

Process limit : EALREADY / fork fails → sshd cannot spawn new sessions

System memory : OOM killer triggered → sshd process killed, connection drops immediately

/run or tmpfs : sshd needs /run/sshd → sshd refuses to start, port 22 not listening

CPU starvation : Run queue hundreds long → Single auth takes tens of seconds, strong fake-death feel

Login lock : /etc/nologin (PAM blocks) → Non-root directly rejected

/dev/pts full : PTY allocation fails → Auth succeeds but no terminal

Overall Troubleshooting Approach: Preserve Evidence First, Then Act

In fake-death scenarios, the biggest taboo is "reboot immediately". Reboot destroys the scene; you lose root cause. Correct order:

Step 1: Define boundary
  Confirm "ping works but login fails" is real, not network/client issue
  Criterion: one SSH connection can handshake (nc/telnet connects to 22) → confirms local user-space problem

Step 2: Find live channel
  Any existing session still connected? Can console (out-of-band) enter?
  This is "rescue channel"; all troubleshooting ops should use live channel, not bare-metal reboot

Step 3: Preserve scene
  In still-executable channel, snapshot key metrics at that moment:
  uptime / load / ps D-count / df / dmesg / sysrq snapshots
  Evidence precedes repair

Step 4: Locate
  Eliminate layer by layer in order: load → D → disk → NFS → memory → process resources → sshd

Step 5: Repair
  Fix only the identified link; repair actions should be "unblock stall", not "full reboot"

Step 6: Verify + Postmortem
  Restore login, business metrics normal, write postmortem, add alerts (stop relying only on ping)

Practical Steps

Using this early-morning incident as example, walk a complete "fake death" troubleshooting chain.

Step 1: Confirm "Real Fake Death, Not Network Issue"

Purpose : Before acting, use three observations to slice every possibility of "ping works but login fails", classifying it as a "local user-space" problem.

Commands :

# ① Network layer: ping ok, can TCP 22 handshake?
nc -vz -w3 <SERVER_IP> 22
# or local ping/telnet combo (if nc missing):
telnet <SERVER_IP> 22
# Expected: Connected to ... Escape character or SSH banner (22 default open)

# ② Old session still alive? If previous connection still hanging, that's rescue channel
# In your other terminal, Ctrl+Z or netstat to see if still there

# ③ From another machine, can it connect (avoid client issue)
ssh -v user@<SERVER_IP>  2>/dev/null &
# Observe ssh -v progress, where it stops (Connect ok = network ok)

Expected Output :

- nc shows Connected to 10.0.0.5 port 22 (TCP handshake OK)
- ping normal
- but SSH auth handshake then hangs
→ Judgment: network layer fine, issue is "kernel alive, user-space stuck", a fake-dead machine

Abnormal : If nc cannot connect to 22 (Connection refused/fail), then 22 not listening, problem changes (sshd down or firewall), follow another branch.

Logic : Use "ping ok + TCP ok + auth then hang" three elements to qualify the problem, not gut feeling.

Next : Enter Step 2, start "find live channel + preserve scene".

Step 2: Establish Rescue Channel & Preserve Scene

Purpose : Find an executable entry (old session / out-of-band console), snapshot critical state first, avoid losing evidence on reboot.

Commands & Actions :

# ① Try existing, possibly alive old session (Ctrl+Z or tmux attach)
tmux attach -t 0    # if tmux session exists
screen -r           # if screen

# ② Cloud vendor VNC/serial console, open immediately (doesn't depend on SSH)
# Platform console built-in; if none, check physical IPMI/KVM

# ③ When commands executable, snapshot immediately (≤5, fast & critical):
date +%F_%T
w
uptime
cat /proc/loadavg
ps -eo state,comm --no-headers | awk '{c[$1]++} END {for (k in c) print k, c[k]}'

Expected Output (excerpt):

16:20:01 up 45 days, 2:11, 1 user, load average 412.10, 300.20, 120.55
D 158
R 12
S 231
Z 5

Interpretation : load 400+, D-state 158 — typical "many threads waiting for I/O" profile, CPU likely idle. Record it, next round directly check I/O.

Abnormal : If even console hangs (out-of-band also stuck), situation more severe, enter "read-only forensics + emergency reboot" branch (see Step 9 sysrq usage).

Next : Since channel still executable, enter Step 3 to break down "high load".

Step 3: Break Down Load — Look at D and R Distribution, Not Just One Number

Purpose : load = R+D sum. First clarify whether "CPU can't keep up (many R)" or "I/O stuck (many D)" — directions differ vastly.

Commands :

# ① top first screen (see load three numbers + current D/R states)
top -b -n 1 | head -12

# ② Count processes by state (refine to state)
ps -eo stat,comm --no-headers | awk '{cmd[$2]++; st[$1]++} END {for (s in st) print "state " s " = " st[s]; for (c in cmd) if (cmd[c]>3) print c, cmd[c]}'
# Simplified just to see D count:
ps -eo state --no-headers | grep -c '^D'
ps -eo state --no-headers | grep -c '^R'

# ③ Check load timeliness (1-min vs 15-min)
cat /proc/loadavg

Expected Output :

top - 16:21:02 up 45 days,  load average: 412.10, 300.20, 120.55
Tasks: 401 total, 12 running, 158 sleeping, 0 stopped, 231 zombie-free (per actual)

State breakdown: D 158 / R 12 / S 231

Interpretation Logic :

Many D (dozens to hundreds) → I/O layer stuck, investigate disk, NFS, network storage.

Many R + CPU saturated → CPU compute bottleneck, investigate processes and load sources.

Both high → dual bottleneck, investigate I/O first because D most lethal (unkillable).

This case D dominates, CPU likely not saturated. Write conclusion: "High load mainly contributed by D-state, suspect I/O stall".

Next : Enter Step 4, check disk & mounts — #1 source of D-state.

Step 4: Check Disk, Inodes & NFS Mounts

Purpose : Use df, iostat, mount, dmesg to determine: disk full? inodes full? I/O errors? NFS mount hung?

Commands :

# ① Filesystem space & inodes (df hangs = that mount point stuck)
df -hT
df -iT
# Pay special attention to /, /var, /home, and all NFS/network disks

# ② Disk I/O pressure & wait (iostat -x needs sysstat; if missing use dstat/vmstat)
iostat -x 2 5          # watch %util / await / svctm magnitude
vmstat 1 5             # watch bi/bo and wa columns

# ③ Any NFS / cloud disk / multipath in mount table?
mount | grep -Ei 'nfs|cifs|ceph|fc|multipath'

# ④ Touch each mount point (create temp file, hang = mount point stuck)
# Danger: don't test on path you depend on, use independent mount point
for m in $(awk '/\/ / {print $2}' /proc/mounts | sort -u | head -20); do
  timeout 2 touch "$m/.fw_probe_$$" 2>/dev/null && rm -f "$m/.fw_probe_$$" && echo "OK  $m" || echo "HANG $m"
done

# ⑤ Kernel logs for I/O errors (bad disk / array hang)
dmesg -T | grep -iE 'I/O error|nvme|sd[a-z]|ext4|XFS|fatal' | tail -40

Expected : Normal df returns instantly, iostat normal, touch all instant, dmesg no major errors.

Abnormal & Interpretation :

- df hangs at a mount point: that mount stuck (usually NFS/object storage client), df cannot complete → D-state source confirmed
- df errors or / partition 100%: many processes failing writes, login chain stuck at utmp/wtmp disk write
- iostat %util 100% and high await: local disk I/O saturated
- dmesg has I/O error or nvme errors: hardware/driver issue, contact vendor
- df -i Use% 100%: inode exhaustion, process file creation fails

In this case df -hT hung directly — mount revealed an NFS mount connected to faulty storage, dozens of processes (writing logs/reading configs) all blocked in D-state waiting for NFS response. Simultaneously /var partition at 99%, journald repeatedly failing to write logs.

Logic : D-state mostly "waiting for I/O", df hang = mount point stuck, this conclusion aligns with Step 3's D-count, forming evidence chain.

Next : Disk not fully explained (why /var only 1% left), enter Step 5 check memory & process resources, confirm no overlay issues.

Step 5: Check Memory & Process Resource Limits

Purpose : Exclude second-layer overlays like "OOM killing processes", "fork failures", "/proc subsystem anomalies", prevent fixing one but missing another.

Commands :

# ① Memory & swap (swap thrashing more dangerous than full memory)
free -h
vmstat 1 5           # watch si/so columns, wild paging = memory pressure

# ② Any OOM kill records
dmesg -T | grep -iE 'Out of memory|Killed process|oom' | tail -20

# ③ Process & thread limits
cat /proc/sys/kernel/pid_max
ps -eLf | wc -l      # actual pid count
cat /proc/sys/kernel/threads-max
ps -eLf | awk '{print $2}' | sort -u | wc -l

# ④ File descriptor pressure (top few processes)
for pid in $(ps -eo pid --no-headers | head -2000); do
  echo "$pid $(ls /proc/$pid/fd 2>/dev/null | wc -l)"
done | sort -k2 -rn | head -10

# ⑤ inotify exhausted? (massive file watch scenarios)
cat /proc/sys/fs/inotify/max_user_watches

Expected : Memory ample, si/so zero or low, process count far below limits, no OOM records.

Abnormal & Interpretation :

- dmesg has Killed process ... oom: memory exhausted killing processes, sshd may have been killed once
- fork: Cannot allocate memory error + memory actually sufficient: thread/process limits exhausted
- si/so long-term non-zero: swap thrashing, usually with memory black hole (leak)
- /proc/sys/kernel/pid_max saturated: nearly impossible but indicates extreme

This case no anomalies (memory healthy, no OOM), so "memory/process resources" excluded cleanly, back to disk+I/O main line.

Next : Main suspect narrowed to "NFS hang + /var full + D-state explosion" combo, enter Step 6: check sshd & login chain.

Step 6: Check sshd & Login Chain

Purpose : While root cause emerging but not yet fixed, verify sshd itself not collateral killed (e.g., OOM killed, /run/sshd missing, MaxStartups exhausted), avoiding fixing disk but still unable to login.

Commands :

# ① sshd service status (if executable)
systemctl status sshd --no-pager
# or old distro: service sshd status / ps -ef | grep sshd

# ② Recent sshd errors
journalctl -u sshd --since "1 hour ago" --no-pager | tail -40
# or log file /var/log/secure grep sshd

# ③ sshd key config (ensure not temporarily broken)
sshd -T 2>/dev/null | grep -iE 'maxstartups|usedns|usepam|passwordauthentication'

# ④ Port 22 still listening? (confirm login failure is "resource starvation" not "sshd dead")
ss -lntp | grep ':22 '

Expected : sshd process exists, 22 listening, logs show mostly "incoming requests waiting" not system crashes.

Abnormal & Interpretation :

- sshd process gone / 22 not listening: sshd OOM killed or manually stopped, login naturally fails
- Logs full of "CreateSession failed": process creation failure (resource exhaustion evidence)
- MaxStartups default 10:30:100, overwhelmed by handshake storm: amplifies "cannot connect"
- /run/sshd directory missing (rare): "Privilege separation directory /run/sshd does not exist" error

This case sshd alive, 22 listening, but every login stuck at "process creation", "disk write", "PAM read config", confirming "not sshd fault, host resource starvation".

Next : Main suspects collected to "NFS hang + /var full + D-state explosion" combo, enter Step 7: attempt thaw & stop bleeding.

Step 7: Attempt Thaw & Stop Bleeding (Resolve Most Dangerous Link First)

Purpose : Without reboot, release "disk write failure" and "NFS hang" two main culprits, see if system self-recovers.

Actions (impact small to large) :

# ① Clean visible deletable files in /var (look first, don't delete blindly!)
ls -la /var/log/ | head
# Find largest log files (lang=large)
du -sh /var/log/* 2>/dev/null | sort -rh | head -10
# When confirmed deletable (e.g., old app logs, archived files) then clean:
# First truncate known large files, then consider delete (forbid direct rm -rf dir)
: > /var/log/access.log.1          # example: empty a confirmed useless old log
# —— All delete ops: first ls/du confirm path & ownership, best test one file first

# ② If NFS mount confirmed stuck, safest: "let writing processes exit first" then unmount
# Example (first see who works through it):
lsof +D /mnt/nfs_backup 2>/dev/null | head -30   # lsof may not exist, use fuser instead
fuser -vm /mnt/nfs_backup 2>&1 | head -20
# Afterwards (when confident):
# umount -fl /mnt/nfs_backup   # lazy unmount, risks & side effects see risk reminders

# Danger reminders:
- umount -fl is "force+lazy" unmount, discards unwritten data,
  must confirm mount point has no critical data & business has fallback
- Don't hard reboot production directly, try all non-destructive actions above first
- Clean logs: truncate known smallest files first, then decide on bulk

Expected : Logically, after releasing blocked writes / removing hung NFS, a batch of D-state processes get "released", load starts dropping, system becomes enterable again.

Abnormal : If after cleanup/unmount load stays high, D processes still many — indicates hardware-level disk stall, proceed to Step 8.

Next : If environment "unmount hung NFS → system self-relieves", skip Step 8 to verification; else continue.

Step 8: sysrq Forensics (Get Stack Traces Without Reboot)

Purpose : When usable channels all stuck, even console slow, Magic SysRq is last "ex-vivo forensics" tool: dumps each task's stack, memory, CPU info on demand, no user-space login needed.

Prerequisite Check :

# sysrq enabled? (1=all, 0=off)
cat /proc/sys/kernel/sysrq
# If off, temporarily enable (production caution, revert after):
sysctl -w kernel.sysrq=1

Usage :

echo w > /proc/sysrq-trigger   # dump all blocked task stacks (focus where D-state stops)
echo t > /proc/sysrq-trigger   # dump all task states
echo l > /proc/sysrq-trigger   # dump each CPU backtrace (see what kernel threads busy)
echo m > /proc/sysrq-trigger   # dump memory info

Output appears in kernel logs:

dmesg -T | tail -200
# Find "Blocked state" sections, see which function those D-state processes stuck in (e.g., wait_on_page_bit / nfs_wait_on...)
Interpretation:
- sysrq-w D-state process call stacks stop at nfs_* or nfs_wait related functions
  → NFS network storage stuck, corroborates Step 4 mount point evidence
- Stop at xfs_buf / ext4_map_blocks etc local disk functions → local disk I/O stuck
- Stop at io wait (kiocb) → storage backend issue

Safety Reminders : sysrq-b (reboot), sysrq-s/u/b (sync, remount ro, reboot) are emergency chain, only when "cannot revive". s blocks waiting for sync, may hang long during I/O stall; don't use as daily reboot button.

Production sysrq forensics: coordinate with team first, it dumps huge kernel logs, don't flood monitoring/log platforms.

Entire process read-only forensics, no modifications, sole purpose: fix root cause evidence.

This case used echo w > /proc/sysrq-trigger + dmesg, saw 100+ processes stuck at nfs4_wait_bit_killable (NFSv4 wait), forming complete evidence loop with Step 4's "NFS hang", root cause confirmed.

Next : Root cause fixed, enter Step 9 implement fix.

Step 9: Implement Fix (Only Touch Root Cause Link)

Purpose : From root cause, do minimal fix. This case root cause = faulty NFS mount hang + /var partition filled by professional writes.

Actions :

# ① Relieve /var space pressure (first clean confirmed useless old logs)
du -sh /var/log/* 2>/dev/null | sort -rh | head
: > /var/log/nginx/access.log          # only truncate file, keep inode (production per need, confirm file droppable first)
logrotate -f /etc/logrotate.d/nginx    # better let logrotate handle, not manual clean

# ② Remove hung NFS (after confirming no data residue)
umount -fl /mnt/nfs_backup
# or remount after confirming backend restored: showmount -e <NFS_SERVER> may not work, per actual

# ③ Restart affected business processes after D-state clears (not whole machine)
systemctl restart nginx
systemctl restart app-orders 2>/dev/null || true

# ④ Confirm sshd recovered
systemctl restart sshd
Note: intentionally avoid "reboot whole machine" because:
- Reboot loses NFS hang pre-evidence (memory, dmesg read-only segments)
- Business that can hot-recover should hot-recover, full restart expands blast radius

Expected : Mount removed, space freed, D-state processes batch "wake up", load drops noticeably, SSH login restored.

Verification (immediate) :

uptime                    # load should fall from 400+
ps -eo state --no-headers | grep -c '^D'   # D count should drop significantly
df -h /var                # /var usage down to safe line
ssh user@<SERVER>         # real SSH login verify (success = preliminary recovery)

Next : After recovery, full verification round, then rollback plan & postmortem (see later sections).

Common Commands Summary

Collect all "fake death troubleshooting" chain commands into one cheat sheet, put in on-call handbook.

Network & Liveness Judgment

nc -vz -w3 <IP> 22          # TCP 22 handshake possible?
ssh -v user@<IP>            # watch SSH steps, where stuck
ping -c4 <IP>               # ICMP liveness (only "network ok" reference, not health basis)

State Snapshot (Preserve Scene)

date +%F_%T; uptime; cat /proc/loadavg
w
ps -eo state,comm --no-headers | awk '{c[$1]++} END {for (k in c) print k, c[k]}'
ps -eo pid,ppid,state,etime,cmd | grep -E ' \bD\b' | head -30   # list D process details

I/O & Disk

df -hT; df -iT
iostat -x 2 5               # needs sysstat
vmstat 1 5
mount
dmesg -T | grep -iE 'I/O error|nvme|sd[a-z]|EXT4|xfs|fatal' | tail -30

Memory & Resources

free -h
vmstat 1 5                  # watch si/so
dmesg -T | grep -iE 'Out of memory|Killed process' | tail -20
cat /proc/sys/kernel/pid_max
ps -eLf | wc -l

sshd & Login

systemctl status sshd --no-pager
journalctl -u sshd --since "1 hour ago" --no-pager | tail -40
ss -lntp | grep ':22 '
sshd -T 2>/dev/null | grep -iE 'maxstartups|usepam|passwordauthentication'

sysrq Forensics

cat /proc/sys/kernel/sysrq          # confirm enabled
echo w > /proc/sysrq-trigger        # dump blocked tasks
dmesg -T | grep -A2 -i blocked      # see where stuck

Key Metrics Observation Methods

Master these metrics' "normal ranges" and "abnormal signs", read correctly to judge correctly.

Metric Interpretation Table

Converted to list:

load average (source: uptime / /proc/loadavg): R+D process count average. Normal: below CPU core count. Fake death: dozens to thousands, 1-min > 5-min (climbing).

D-state count (source: ps): Processes waiting for I/O. Normal: single digits. Fake death: dozens to hundreds.

R count (source: ps): Runnable processes. Normal: similar to core count. Fake death: crowded out by D.

%util / await (source: iostat -x): Disk busy / I/O wait. Normal: usually < 80%. Fake death: 100% or device abnormal.

bi/bo (source: vmstat): Block read/write rate. Normal: business dependent. Fake death: may be 0 (stalled).

si/so (source: vmstat): Swap in/out rate. Normal: 0. Fake death: sustained non-zero (memory pressure).

D process call stack (source: sysrq-w + dmesg): Where stuck. Normal: normally no block. Fake death: stops at nfs_/xfs_/ext4_ functions.

/var usage (source: df -h /): System partition. Normal: 20% headroom. Fake death: near 100%.

inode usage (source: df -i /): Inode count. Normal: same. Fake death: 100% → cannot create files.

Most Common Misinterpretations

High load ≠ CPU busy : load includes D-state, I/O stall also raises load, don't judge by single number.

Ping ok ≠ machine healthy : ICMP answered by kernel, fake-dead machine pings fine, only proves kernel alive.

D-state cannot be killed : no matter how correct the posture, kill won't work; resolve I/O first.

1-min load > 5-min load : indicates load is "newly rising and worsening", more warning value than absolute value.

dmesg OOM records are hard evidence of memory issues, but OOM logs rotate and overwrite, preserve scene urgently.

Continuous Monitoring Suggestions

Hook above key criteria into monitoring, stop letting "ping all green" be health indicator:

- node_exporter metrics (per actual version names):
  node_load1 / node_load5 / node_load15
  Process state counts: need custom exporter or script to collect
  Disk: node_filesystem_avail_* / node_filesystem_files_free_*
  Memory: node_memory_* / node_memory_SwapTotal
- Alert rules must avoid "only ping":
  e.g., combine load with D-state count for alert, not just ping frequency threshold
- Disk usage > 85% alert, /var dedicated tighter
# Prometheus alert example (thresholds must calibrate with business & hardware)
groups:
- name: node-starvation
  rules:
  - alert: LoadAverageVeryHigh
    expr: node_load1 / on(instance) count(node_cpu_seconds_total{mode="idle"}) > 4
    for: 10m
    labels: { severity: critical }
    annotations:
      summary: "load/core sustained > 4, suspected fake death or I/O stall"
  - alert: RootFilesystemAlmostFull
    expr: (1 - node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) > 0.9
    for: 10m
    labels: { severity: warning }
    annotations:
      summary: "Root partition usage > 90%"

Note: node_exporter metric names vary by version, above expressions per actual installed version;
Alert thresholds must calibrate with cluster historical baseline, cannot copy directly.

Troubleshooting Path (Quick Decision Tree)

Turn judgments and actions into a wall-postable tree:

"ping ok but login fails"
  ├─ ① nc 22 handshake?
  │   ├─ No ── check sshd service & firewall (separate)
  │   └─ Yes ↓
  ├─ ② Old session/console have live channel?
  │   ├─ Yes → prefer it for commands
  │   └─ No → find out-of-band console (VNC/IPMI), else only sysrq forensics
  ├─ ③ load breakdown (uptime + /proc/loadavg)
  │   ├─ Many D → I/O stall → ④
  │   ├─ Many R → CPU busy → ⑤
  │   └─ Mixed → treat I/O first (D most lethal)
  ├─ ④ Disk queue: df -h/df -i/iostat/mount
  │   ├─ Mount stuck → NFS layer → unmount (fl) → watch load drop
  │   ├─ Local disk IO util 100% → check bad sectors/array → contact hardware
  │   ├─ /var full → clean logs/free space → watch utmp/wtmp recover
  │   └─ dmesg clean → back to memory resources
  ├─ ⑤ Resource queue: free/vmstat/dmesg-oom/pid
  │   ├─ OOM → memory chapter (separate)
  │   ├─ swap thrashing → memory leak
  │   └─ fork fail → thread/process limits
  └─ ⑥ Closure: sshd normal? login restored? business restored? postmortem archived?

Risk Reminders

In fake-death scenarios, "reckless ops" harm more than fake death itself. Key risks listed.

High-Risk Actions List

1) Mindless full reboot:
   - Lose all scene evidence (dmesg lines, memory snapshots, sysrq output)
   - Reboot may hang long due to disk/NFS stall (fake-dead machine may not come up)
   Alternative: sysrq forensics first, then consider reboot, best preserve memory image

2) kill -9 on D-state processes:
   - Ineffective: D state unkillable by signals
   - May mislead you into "unkillable = cryptominer" and go off track
   Alternative: locate and resolve I/O block source

3) Blind umount -fl production mounts:
   - Force+lazy unmount may interrupt unfinished writes, corrupt data
   Alternative: lsof/fuser see who's using; confirm replaceable then unmount; gate before unmount

4) Using ping as health criterion:
   - ping ok = kernel alive, not user-space/service usable
   Alternative: build health checks (real service probes), don't base monitoring on sonar

5) Running timeout commands blindly on stuck machine:
   - df not returning for 100s is normal, waiting like that hangs you too
   Alternative: all commands with timeout, avoid self-stall

6) rm/truncate cleaning logs:
   - Accidental delete production logs (especially no backup) loses troubleshooting evidence
   Alternative: ls -l & du confirm first, truncate then batch, keep minimal copy

Operational Discipline

- All destructive commands must have "confirm + backup + rollback" trio
- Preserve evidence first (local dmesg + monitoring export), then decide fix
- If reboot needed, announce first, state impact & expected recovery window
- If this machine is core business, confirm cluster redundancy first, else any op amplifies loss

Verification Methods

Post-fix verification in three progressive tiers, pass all to call it done:

Tier 1: Machine Level (Minutes)

uptime                    # load back to core-count match
ps -eo state --no-headers | grep -c '^D'   # D count back to single digits
df -h /                   # root partition has headroom
free -h | head -2

Tier 2: Login Level

ssh -o ConnectTimeout=5 user@<IP> 'echo ok; uptime'
# Expect instant ok, no hang
# Stress: 5 consecutive logins, zero timeouts
for i in $(seq 1 5); do
  timeout 5 ssh user@<IP> true && echo "login $i ok" || echo "login $i fail"
done

Tier 3: Business Level

# Business health check (per actual business interface)
curl -s -o /dev/null -w "%{http_code}
" http://127.0.0.1:8090/health
# Monitoring platform watch 15-30 mins: any new D processes? load rebound? logs normal?

Verification Conclusion Template

【Verification Conclusion】
- load: 412 → 8
- D-state: 158 → 2
- /var usage: 99% → 62%
- SSH login: 5/5 success
- Business probe: 200
- 30-min observation: no rebound
Conclusion: Root cause (NFS hang + /var full) resolved, system not rebooted, business recovered.

Rollback Plan

"Rollback" in fake-death has two layers: revert rescue actions, revert mis-ops.

Rollback Rescue Actions

- If unmounted NFS needed by business again: after backend restored, remount (with correct options),
  mount point original path, watch mount options not lost (autofs may need restart dependent services)
- If cleaned logs affect forensics: rely on monitoring platform & collection pipeline, local not kept
- If temporary adjustments (e.g., sysrq enabled, temp pid_max tweak):
  promptly revert sysctl original values, avoid environment drift

Mis-operation Rollback Checklist

Accidentally deleted log files : If file still held by process, recover via /proc/<pid>/fd (temp channel); no handle → only from log collection platform

Accidentally unmounted mount point : Remount per user (after confirming backend OK), restart dependent services if needed

Accidentally changed kernel params : Restore original via sysctl -w, verify param effective after rollback

Accidentally restarted sshd : Service auto-restarts, verify with connection

Accidentally killed critical process : Restart via systemctl or start command; if cannot start, follow business recovery flow

Does Reboot Count as "Rollback"?

Reboot only when "no action other than restoring scene can make machine usable",
and before reboot must have:
- Clear business impact scope & window
- Out-of-band/automation channel capable of executing reboot
- Post-reboot verification chain (machine → login → business)
- Don't reboot core business machine unprepared at 3 AM unless you're sure down is safer than stuck

Production Environment Notes

Pre-Maintenance Checks

1) Confirm if this machine in load balancer/cluster? Can drain traffic first
2) Confirm out-of-band channel usable (VNC/IPMI/auto console), else your lifeline is only talk
3) Sync risk with business owner, define "if not recovered in 20 mins, reboot machine" fallback window
4) Prepare a "switch", e.g., business can failover to standby node

On-Call Process Hardening

- Front-page monitoring reject "only ping": health checks use real TCP/service probes
- Set "D-state count / load / root partition" three alert groups, not just load
- Fake-death troubleshooting handbook on wall (decision tree + 10 commands + risk list)
- Quarterly fake-death drill: artificially create I/O stall, practice recovery flow

Postmortem Template Essentials

Postmortem must cross-check "actions correct?", "evidence complete?", "alerts timely?" — not a diary:

【Postmortem Template】
1. Occurrence & Impact: timeline, affected services/users, duration
2. Root Cause Chain: symptom → initial judgment → command checks → key metrics → root cause location
   (each link with evidence, e.g., sysrq-w output, df hang screenshot, dmesg NFS errors)
3. Remediation Actions: what done, time taken, any wasted actions
4. Evidence Preservation: dmesg, monitoring charts, command outputs archived?
5. Alert Evaluation: could monitoring have caught earlier? thresholds need adjust?
6. Improvements: each with owner & deadline, not vague "strengthen monitoring"

Deep Dive 1: NFS / Network Storage Hang

NFS mount points are the #1 culprit exposed in "fake death" incidents. Local disk bad sectors show I/O error in dmesg, but NFS fails more silently:

Client keeps waiting, kernel puts threads into D-state, waiting for NFS server response . Once NFS server loses contact or network breaks, wait time determined by kernel NFS timeout params, possibly tens of seconds to minutes, and unresponsive to any signals. Thus a pile of processes waiting for NFS I/O all enter D-state.

How to Confirm NFS Hang

# ① List NFS mounts
mount | grep -i nfs

# ② Lightweight probe (the one that hangs is it)
timeout 2 stat /mnt/nfs_backup && echo "ALIVE" || echo "NFS HANG"
timeout 2 ls /mnt/nfs_backup >/dev/null 2>&1 && echo "ALIVE" || echo "NFS HANG"

# ③ Check TCP path to NFS server (network itself reachable?)
nc -vz -w3 <NFS_SERVER_IP> 2049

Remediation Path (Risk Low to High)

1) If backend just recovered (ping NFS server, showmount returns):
   Usually wait a bit, system self-recovers; watch load & D count drop

2) If backend not recoverable short-term:
   Unmount mount — first let writing apps exit (fuser/lsof find occupiers), then umount
   Order: fuser -km kills processes (dangerous! list first no kill) → lsof see occupancy → umount -l (lazy)
   Lazy unmount (-l) relatively gentle, v2 scenarios safer, but data may be discarded

3) Long-term unused mount point apps:
   Consider replacing NFS with service-side storage to prevent re-mount
# Read-only forensics first (don't rush to kill occupying processes):
lsof /mnt/nfs_backup 2>/dev/null | head -30
fuser -v /mnt/nfs_backup 2>&1 | head -20

# After confirming no dependencies (when confident):
# umount -l /mnt/nfs_backup

How to Prevent NFS Hang

- Client mount options: soft less likely to "permanently hang" than hard (soft returns error after timeout)
  but soft has data consistency risk, trade-off must be documented; use noac/actimeo reasonably
- Network layer monitor NFS server connectivity, not just client
- Application side wrap NFS path calls with timeout, don't bind entire logic to NFS
- Primary/standby / dual-active storage solutions, avoid single point
# View current NFS mount options
mount | grep nfs
cat /proc/mounts | grep ' /mnt/nfs_backup '

One-sentence summary: The terror of NFS hang isn't "broken", it's "wait". It forces an uncertain wait onto every process touching it, and that's exactly the source of D-state.

Deep Dive 2: System Partition Full (/var Full Chain Reaction)

When /var fills, login chain hits first because login itself must write /var/run/utmp, /var/log/wtmp. Logging systems (journald, syslog, nginx access.log) once failing to write also drag whole system toward "fake death + uncontrolled logs".

Confirm "/var Written Full"

df -h /var
df -i /var
du -sh /var/* 2>/dev/null | sort -rh | head -10

Why /var Full Makes "Login" Fail

Unfold login chain once more, you'll see it's not magic:

1) PAM side: pam_unix/x verify password fails to write temp file → auth directly errors
2) utmp/wtmp: login record cannot write → some distros directly refuse session creation
3) HOME dir on /home (often on root partition) → user cannot write own dotfiles
4) journald/syslog write fails → log processes crash loop, consuming CPU and fds
5) /run is tmpfs limited size → sshd needs /run/sshd directory

Cleanup Action Order & Discipline

Fixed order: confirm first → truncate first → delete later → directories last
Every step must have confirmed "why delete this", no blind rm allowed
# ① See which files occupy space
du -sh /var/log/* /var/cache/* 2>/dev/null | sort -rh | head -20

# ② Only clean "confirmed droppable" (e.g., expired archives, compressed but still huge logs)
: > /var/log/nginx/access.log.20260707          # example only, confirm file ownership first

# ③ Move large files instead of hard delete: mv to another partition, confirm app status then delete source
mv /var/log/app/big.log /backup_staging/ && systemctl restart app

# ④ Let logrotate manage, not manual
logrotate -d /etc/logrotate.conf          # dry-run see plan
logrotate -f /etc/logrotate.d/nginx       # force execute (after confirming rules correct)

Prevent "Cleaned Then Full Again"

- logrotate config confirm: rotate N, size condition, compression
- journald limits: journalctl --vacuum-time=7d or journalctl --vacuum-size=500M
- App's own logs must have level downgrade & rotation, not infinite write
- Monitor inodes: /var file count red line

Critical Reminders

- Never rm -rf /var/log on production
- Before delete, confirm no process still holds file handle (lsof +D /var/log)
- Truncate large files safer than rm (immediate space release, inode kept),
  but if app needs reopen fd, truncate then restart corresponding process

Deep Dive 3: If Memory Issue (OOM) Not I/O Issue

Other half of "fake death" comes from memory. Though this case is I/O, same "ping ok but login fails" phenomenon, memory can't be absent. This section gives independent criteria & actions.

Confirm OOM

dmesg -T | grep -iE 'out of memory|killed process|oom-kill' | tail -30
cat /proc/zoneinfo | grep -c "low"
Interpretation:
- dmesg has Killed process <pid> ... out of memory, killed by OOM Killer
- If sshd happened to be killed, login chain breaks directly, same "ping ok but login fails"
- Memory ample but kernel crazy OOM rare: check cgroup memory limits (container deployments easy to hit)

Remediation

Order:
1) Free memory: restart memory black hole processes (first locate, e.g., top sort by RES)
2) Check cgroup: systemd / docker limits too small, conflicting with host
3) Temporarily reducing swap pressure dangerous, first confirm "real leak" vs "real shortage"
4) Long-term: add memory alerts (RES trend alert), add OOM playbook (reserve swap/reserve nodes)
top -o %MEM -b -n 1 | head -20           # Top memory consumers
cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>/dev/null || \
cat /sys/fs/cgroup/memory.max 2>/dev/null   # Check cgroup limit (v2 path differs)

Quick Distinction: Memory vs I/O Fake Death

Primary Trait : Memory: dmesg OOM / swap thrashing; I/O: High load + many D

vmstat : Memory: si/so non-zero; I/O: bi/bo stuck at 0

free : Memory: Memory or swap near exhaustion; I/O: Memory usually has headroom

Process State : Memory: Often killed (disappear); I/O: D pile up

Recovery : Memory: Free memory + restart black hole processes; I/O: Resolve I/O + unmount NFS / clean disk

Core methodology same for both: evidence first, action second, no blind full reboot.

Postmortem: This Case's Complete Flow Archive

Document entire case from "first alert" to end as auditable doc, what on-call postmortem should look like.

Timeline

01:58 : NFS backend storage failure, mount point starts failing (Server-side fault, client not yet aware)

02:02 : App massive log write failures, /var usage nears 100% (dmesg shows I/O errors (monitoring platform mis-filed under other entries temporarily ignored))

02:11 : Login starts lagging; monitoring alerts "SSH failure rate rising" (On-call first SSH attempt)

02:15 : Ping normal / SSH handshake normal / no response after auth (nc 22 ok → classified as "fake death")

02:18 : Try old session & console, got execution channel (tmux attach success)

02:20 : Snapshot: load 412 / D 158 / R 12 (Saved snapshot & dmesg)

02:25 : df hung → located NFS hang; /var 99% (mount + probe script)

02:33 : sysrq-w dump, processes stuck at nfs4_wait_bit_killable (Evidence loop closed)

02:40 : Truncate large logs + remove NFS mount (Load starts dropping)

02:48 : SSH login restored; business interfaces recover 200 (Three-tier verification passed)

03:00 : Postmortem: add alerts, fix NFS solution, log cleanup strategy (Output improvements)

Postmortem Conclusions (Three)

1) "Ping ok = machine alive" monitoring is accident magnifier:
   Never monitored load/disk/D-state from start, problem exposed only at login failure
2) Scene evidence priority lower than "rescue":
   Fake death most fears immediate reboot; reboot after you'll never know root cause NFS or memory
3) On-call handbook "#1 command" should be timeout-wrapped, not blind full run:
   df hanging while running a string of no-timeout commands equals self double-stall

Fake Death Cause Compendium

Table of all "ping ok but login fails" root causes, each with "how to confirm" and "how to handle". "Fake death" is just a symptom, underlying causes varied.

NFS mount hang : Confirm: df hangs at mount / sysrq-w stops at nfs_wait; Handle: Unmount / restore backend

Local disk bad sectors / array hang : Confirm: dmesg I/O error + iostat util 100%; Handle: Contact hardware vendor, migrate data

Local disk I/O saturated : Confirm: iostat %util 100%, await high; Handle: Identify slow processes, throttle

/var (or root) written full : Confirm: df -h / df -i; Handle: Clean / expand / logrotate

Memory exhaustion / OOM : Confirm: dmesg OOM records, swap thrashing; Handle: Free memory, restart black hole processes

Process/thread limit : Confirm: fork: Cannot allocate memory + resources sufficient; Handle: Raise limits / reduce thread creation

/dev/pts full : Confirm: Auth succeeds but no terminal; Handle: Release ptys / restart dependents

sshd OOM killed : Confirm: sshd process gone / spid_ref; Handle: Restart sshd / memory governance

/run or tmpfs full : Confirm: sshd cannot create /run/sshd; Handle: Clean tmpfs large files

PAM module stall (e.g., pam_ldap) : Confirm: strace/ltrace PAM calls; Handle: Investigate specific pam module

System entropy pool exhausted : Confirm: New connections wait long for random; Handle: Check hardware entropy source / reseed

Massive zombie process accumulation : Confirm: ps shows Z dominant; Handle: Let parent reap / restart parent

CPU single core 100% (extreme) : Confirm: top shows single core utilization; Handle: Scheduling / affinity investigation

Kernel thread panic (rare) : Confirm: dmesg panic/unexpected; Handle: Contact vendor, file bugzilla

Note: This table ordered by "diagnostic means" top-down, by "probability" NFS and "disk full" always first two to exclude.

Tested Action Checklist (Treat Exclusion as Yesterday's Shift)

Fix done ≠ off duty. Turn all judgments into a "on-call three-checks":

On-call three-checks (every fake-death incident must check):
1. Check state: load breakdown (D vs R) + dmesg OOM/IO
2. Check space: df -hT (focus / and /var) + df -iT + du largest files
3. Check mounts: all NFS/network disks + probe script point-by-point touch

After three-checks if still no conclusion, launch sysrq forensics & log deep analysis, not stuck in "staring at rules" "just not working" loop.

Maintenance Advice: Keep Fake Death Outside the Door

Monitoring Side

1) Health checks use service probes not ping; ping only kept as "network ok" reference
2) Load/D-state/root partition/inode four metric classes into alerts, thresholds set by historical baseline
3) Login availability active probing (external host periodically attempts SSH, records success rate)
4) NFS/network storage connectivity independent monitoring

Configuration Side

1) System disk logs & /var reserve space, monitoring red lines 85%/90%
2) NFS mount recovery assessment: soft vs hard, documented in deployment docs
3) journald / logrotate configs fully templated, avoid "deploy once cool, bitten by logs later"
4) Critical apps guarantee TCP heartbeat to monitoring, avoid relying on terminal perception

Playbook Side

1) Fake-death playbook written into customer-facing docs: symptoms, three-checks, actions, time windows
2) Quarterly drill (create I/O stall, practice recovery)
3) Define "who authorized to reboot" "evidence preservation order before reboot"
4) Backup NFS & system disk state regular checks (disaster has spare)

Appendix A: Terminology Quick Reference

ICMP / ping : Network layer probe, kernel direct answer, not user-space health (Core Knowledge, Step 1)

load average : R + D state process count average (Core Knowledge, Step 3)

D-state : Uninterruptible sleep, usually waiting for I/O (Core Knowledge, Step 3)

R-state : Runnable state, running or queued to run (Step 3)

Z-state : Zombie process, not reaped by parent (Step 3, Cause Compendium)

NFS : Network File System, client wait-style access (Deep Dive 1)

sysrq / Magic SysRq : Kernel-provided external forensics/emergency interface (Step 8)

Out-of-band console : Backup access not dependent on network (VNC/IPMI) (Step 2)

OOM Killer : Kernel kill-process mechanism when memory exhausted (Deep Dive 3)

utmp / wtmp : Login accounting record files (Core Knowledge, Deep Dive 2)

PAM : Authentication framework, critical link in login chain (Core Knowledge)

/run/sshd : sshd privilege separation directory (Core Knowledge, Step 6)

Memorize these terms, reading main text your eyes won't be forced to stop and look up words.

Appendix B: FAQ Quick Answers

Q: Machine load this high, is it cryptomining?

Not necessarily. Miner traits: CPU busy (many R, unknown processes), while fake death is many D (I/O stall). First split "D vs R", then ps -eo pid,ppid,cmd check process ownership. Miners usually show as R state + unknown processes, visible at glance in top.

Q: Since D unkillable, how to release D processes?

D process release only waits for kernel I/O completion or error. So "how to release" = "how to resolve I/O block": unmount hung NFS, free full disk, swap faulty disk. Or if business confirmed droppable, reboot host — but reboot risks reboot storm.

Q: Should sysrq's k value (shutdown OOM killer etc) stay enabled? kernel.sysrq recommend keep enabled (=1 enables all, or minimal non-zero), but ensure permission restricted (only root can trigger). Production don't leave at 0 (then sysrq forensics impossible), combine with your security baseline.

Q: Should I mainly use vmstat or iostat ?

Both but different purposes: first vmstat quick overview CPU/memory/swap & run queue (seconds), then iostat -x deep dive disk layer confirm "who waiting for I/O, %util how high". Fake death rhythm: vmstat first pass, if issues then iostat.

Q: What happens when df -i inode full?

Classic: "disk has space but file creation fails", causing more process failures. E.g., container/log dirs with huge small files most prone. After confirm, clean inodes (delete small files) faster than expand.

Q: How to know which sysrq keys my machine allows? sysctl kernel.sysrq range 0~1 plus bitmask (e.g., 2=console, 4=keyboard), see kernel docs; simplest set 1 (all allowed) but consider security. Unconstrained machines set 1, trigger via /proc/sysrq-trigger.

Q: If I open ping, can I avoid "fake death" alerts?

Exactly opposite. Ping's monitoring value is "network reachable", not "node healthy". To prevent fake-death accidents, health checks should be "probe business interface + watch load/D-state/disk", ping is only bottom-layer network liveness signal, don't use as health criterion, also reveals how dependent you are on it.

Appendix C: On-Call Cheat Card (One Page)

Print and stick at on-call station standardized process card:

【Server Fake Death: Ping OK but No Login / Login Then No Response】

① Baseline:
   nc -vz -w3 <IP> 22          # TCP 22 handshake = local user-space issue
   Old session / console first   # First find executable live channel

② Three-checks (fast, ≤5 cmds):
   date; uptime; cat /proc/loadavg
   ps -eo state,comm --no-headers | awk '{c[$1]++} END{for(k in c)print k,c[k]}'
   df -hT /var; df -iT /var
   dmesg -T | grep -iE 'I/O error|Out of memory|nf_conntrack' | tail -20
   mount | grep -i nfs

③ Interpretation:
   Many D → I/O stall → probe mounts/unmount NFS/clean disk
   Many R → CPU busy → find process/throttle
   /var full → utmp/wtmp write fail → clean/truncate/expand
   OOM → memory chapter → free/restart black hole processes

④ Forensics before action:
   echo w > /proc/sysrq-trigger; dmesg -T | tail -200

⑤ Fix only root cause link, no blind full reboot:
   Truncate large logs, unmount dead NFS, restart affected apps
   (All destructive: confirm → backup → rollback plan)

⑥ Three-tier verification:
   machine → login → business

⑦ Postmortem & Improve:
   Alerts add load/D/disk, remove "only ping"
   Handbook add timeouts, playbook add drills

—— If first three steps no conclusion, don't spin in place, back to "sysrq forensics" then locate ——

Appendix D: Scene Evidence Collection Script

Turn "preserve scene" actions into a directly runnable script, on-call just one command archives key evidence. Script read-only, writes no system config, safe to execute.

#!/bin/bash
# collect_evidence.sh — Fake death scene evidence collection (read-only)
# Usage: execute in "still alive" channel, output compressed to /tmp
# Purpose: before reboot, save materials that can prove root cause

set -u
STAMP=$(date +%Y%m%d_%H%M%S)
DIR="/tmp/servev_$STAMP"
mkdir -p "$DIR"

echo ">>> Collecting evidence to $DIR ..."

# 1) System basic info
date +%F_%T > "$DIR/timestamp.txt"
hostname > "$DIR/hostname.txt"
uname -a > "$DIR/uname.txt"

# 2) Load & state
uptime > "$DIR/uptime.txt"
cat /proc/loadavg >> "$DIR/uptime.txt"
ps -eo state,comm --no-headers | awk '{c[$1]++} END {for (k in c) print k, c[k]}' > "$DIR/state_count.txt"

# 3) D & Z process details
ps -eo pid,ppid,state,etime,cmd | awk '$3 ~ /D|Z/' > "$DIR/dz_processes.txt"

# 4) Memory & swap
free -h > "$DIR/memory.txt"
vmstat 1 3 >> "$DIR/vmstat.txt"

# 5) Filesystem & inodes
df -hT > "$DIR/df.txt" 2>&1 || true
df -iT > "$DIR/df_i.txt" 2>&1 || true

# 6) Mounts & network disks
mount > "$DIR/mount.txt" 2>&1 || true

# 7) Kernel key logs (up to 2000 lines)
dmesg -T 2>/dev/null | tail -2000 > "$DIR/dmesg.txt" || true

# 8) sshd related
systemctl status sshd --no-pager > "$DIR/sshd_status.txt" 2>&1 || true
ss -lntp > "$DIR/ss_lntp.txt" 2>&1 || true

# 9) Package (time critical, need fast grab)
tar -czf /tmp/servev_$STAMP.tar.gz -C "$DIR" .
echo ">>> Done: /tmp/servev_$STAMP.tar.gz"
ls -lh /tmp/servev_$STAMP.tar.gz
Usage notes:
- Script read-only, no I/O optimization; if immediately "dead", some commands may also hang,
  but those with timeout can be handled manually by ops
- Time precious, prioritize mount/df/dmesg these three categories first
- Output unified package, postmortem, vendor handoff, security all have materials

This script's key is "fast" and "complete": fake death scene window may be only minutes, a ready collection script keeps your hands steady when kneeling.

Appendix E: Don't Let "Reboot" Be Your Only Kung Fu

Final heart-to-heart: fake death troubleshooting kung fu, strength isn't "reboot fast", but "can save machine without reboot + evidence before reboot complete". To achieve this, daily practice in these five things:

1) Out-of-band channel always testable (VNC/IPMI quarterly drill usability)
2) Monitoring alerts always have a set of "non-ping-dependent health criteria"
3) On-call handbook has a page "Fake Death Three-Checks", one per person
4) Log & metrics platform has sufficient retention, postmortem can replay
5) For core business machines, primary/standby failover always prioritized over "hard reboot"

Achieve these five, "3 AM fake death" no longer "sky falling", just a standard process drill.

Appendix F: One "Fake Death First Aid" Memory Card

Compress full text's most critical judgments & actions into final card, suitable for memorization (or phone notes):

【Fake Death First Aid — 30 Second Start】

One-sentence definition: ping ok but login fails = kernel alive, user-space stalled.

Step 1 Baseline:
  nc -vz -w3 <IP> 22
  · Handshake ok → local user-space issue, matches this article
  · No handshake → check sshd/firewall (separate line)

Step 2 Three-checks (within 10 cmds):
  1. uptime + /proc/loadavg          → load how high, 1min vs 15min trend
  2. ps split D/R counts             → Many D = I/O, Many R = CPU
  3. df -hT + df -iT                 → Root/var full? Inode full?
  4. vmstat 1 5                      → si/so paging, wa proportion
  5. dmesg                           → IO error / OOM / nf_conntrack three keywords
  6. mount | grep nfs                → Network disk probe (timeout wrapped)

Step 3 Forensics before action:
  echo w > /proc/sysrq-trigger; dmesg -T | tail -200

Step 4 Fix only root cause link:
  · Many D I/O stall → unmount NFS / clean disk / swap disk
  · /var full      → truncate large logs + logrotate takeover
  · OOM            → free memory + restart black hole processes
  (Destructive actions: confirm → backup → rollback plan)

Step 5 Three-tier verification:
  machine → login → business

Step 6 Postmortem & Study:
  · Alerts add load/D/disk, remove "only ping"
  · Handbook add timeouts, playbook add drills

If you're facing a fake-dead server right now, follow this card's order, more reliable than spamming repair groups.

Appendix G: Mis-operation Consequence Quick Reference

On-call most likely reckless actions, consequences & correct postures side-by-side, stick by terminal:

Direct reboot : Lose evidence, may not come up (NFS still mounted) → Correct: Sysrq forensics first, assess impact then reboot

kill -9 D process : Ineffective (D unkillable), wasted action → Correct: Resolve I/O block source

Immediate umount production mount : Unwritten data lost → Correct: lsof/fuser check occupancy first, confirm no deps then act

Blind clean /var/log : Delete troubleshooting evidence → Correct: Truncate smallest files first, batch after confirm ownership

See ping say machine alive : Misjudgment misses rescue window → Correct: Add service probes + load/D metrics

Long wait for df return : Self also stalled → Correct: All commands with timeout

Repeated SSH login attempts : Create extra process pressure → Correct: Switch to console/out-of-band channel

Every row here paid with real incidents, don't rush to "try it".

Summary

Back to this incident's title question: Why ping works but completely cannot login?

Because ping only verified "kernel protocol stack still alive", while SSH login is a complete user-space chain dependent on disk, memory, process resources, PAM, utmp, PTY. Fake death is the moment these two tear apart: kernel answers ICMP, user-space already stalled. This case's chain: NFS hang → massive D-state → load pushed to 400 → every login step spinning; compounded by /var full → utmp/wtmp write fails → login completely unable to complete.

Condense this handling into one closing sentence:

Ping ok ≠ machine good, login fails first check three:
Break load (D vs R), check space (root/var), probe mounts (NFS/network disks).
Evidence before reboot, archive before reboot, verify three tiers after rebuild.

Emphasize once more the costliest lesson:
<strong>On a fake-dead machine, the most expensive isn't reboot, it's reboot without preserving evidence</strong>. Three seconds of sysrq-w dump may save your whole night's root cause.
About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Report an issue with this article
incident-responsepostmortemDisk I/OLinux operationsD-stateLoad Averageserver troubleshootingNFS hangSSH login failuresysrq

Reader feedback

Was this useful?

Useful0

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion