agent's ssh connection failed during long yum update
Fixes an agent SSH connection failing or dying during a long yum update, where the update outlasts idle timeouts on the path or the session is tied to a terminal that closes. Use when yum waves fail on session errors while the same update succeeds interactively with a persistent session. Not for yum errors themselves.
TL;DR
A yum update is a long, sometimes quiet operation: it can sit silent during downloads or scriptlets while network middleboxes reap idle flows and SSH servers enforce their own timeouts. Run yum detached on the host (tmux, screen, or systemd-run) so the session lifetime no longer matters, use SSH keepalives, and poll the yum output log.
agent's ssh connection failed during long yum updateUse this when
- The agent SSH session dies partway through large yum updates.
- yum is left interrupted, sometimes requiring the dpkg-style recovery equivalents for rpm (a killed transaction).
- Interactive runs inside tmux succeed reliably on the same hosts.
Not for this skill when
- yum fails with repo or dependency errors in its own output. The session is innocent; fix yum.
- The host itself reboots or panics during the update. That is a host incident.
Steps
- Change the execution pattern: launch the update inside a named tmux or screen session, or as a systemd-run unit, writing output to a log file. Verify: the launch returns immediately and the update continues after logout
- Set SSH client keepalives (ServerAliveInterval and ServerAliveCountMax) in the agent SSH config for the remaining interactive steps. Verify: idle sessions survive the longest quiet phase
- Poll the update log and the yum process state to follow progress, with a deadline from measured durations. Verify: the agent reports completion from the log and the process exit, not the session
- On completion, collect the transaction result from yum history as the authoritative record. Verify: the history transaction matches the intended update set
- Clean up the detached session or unit and record the pattern in the runbook. Verify: no stray sessions accumulate across waves
Variant phrasings
yum update ssh disconnects run in tmux systemd-run
The standard fix phrasing.
long yum update idle timeout session died
The symptom phrasing.
ssh serveraliveinterval long running remote command
The keepalive phrasing.
Compatibility: Compatibility: RHEL-family hosts with tmux, screen, or systemd; OpenSSH client config on the agent side.
Why it happens
Two timeouts conspire here: TCP flows that look idle get reaped by firewalls and NAT, and SSH has no application heartbeat unless keepalives are configured. Meanwhile the package manager holds locks and state that assume it will not be signaled mid-transaction. Detaching the work from the session removes both hazards at once, which is why the manual tmux habit works and the naive agent pattern does not.
Edge cases / pitfalls
- A yum process killed mid-transaction usually recovers on the next run, but a kill during a kernel or glibc scriptlet is riskier; detach rather than test your luck.
- On RHEL 8 and later, dnf has the same session hazards as yum; the pattern applies unchanged.
- Keep the update log per host per wave; it is the evidence when a transaction result is disputed.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_-i7TLyw4VDZ-DrelfTJbSQ