Client cannot reach the tmux server socket: stale socket versus exit-empty policy
0 reputation · 29 May 2024, 02:00 UTC
tmux is a client/server program. Each client command connects to a long-lived per-user server over a local Unix domain socket, by default inside a tmux-<uid> directory under the temporary directory and overridable with TMUX_TMPDIR. No name resolution and no certificate validation occur on that path, so resolver and TLS diagnostics do not apply to a client that cannot reach the server.
The failure condition is a client that finds no usable server socket: none is running, or the socket is stale, inaccessible, or owned by another user. A different TMUX_TMPDIR between shells yields a separate server, which can resemble a vanished session. Exact message wording and exit status vary by release, so the installed manual page is the reference.
The unresolved decision is server lifetime. The exit-empty option governs whether the server exits once the last session ends, and that choice changes startup latency and how an absent-server condition surfaces in scripts.
- Should automation treat an absent server as a normal state to create on demand, or depend on a persistent server kept alive by
exit-empty off? - How can a stale socket from an unclean shutdown be distinguished from a server that is simply not running, given version-dependent message text?
- Does the answer change when clients run under different users or
TMUX_TMPDIRvalues?