Error Codes Wiki

Screen and tmux Session Errors — Terminal Multiplexer Attachment and Detach Issues

Informationalcommand

Overview

Fix GNU Screen and tmux session errors including dead sessions, attachment failures, copy mode issues, and configuration file errors.

Key Details

  • screen and tmux allow persistent terminal sessions that survive SSH disconnections
  • Sessions can become 'dead' if the parent process crashes or the socket is removed
  • Attachment errors occur when trying to attach to a session already attached elsewhere
  • tmux uses a server-client architecture with a Unix socket for communication
  • Configuration files: ~/.screenrc for screen, ~/.tmux.conf for tmux

Common Causes

  • Session socket file deleted from /tmp or /run — session appears dead
  • Trying to attach to a session already attached from another terminal without forcing
  • tmux server crashed leaving orphaned sessions
  • Configuration file syntax error preventing tmux/screen from starting

Steps

  1. 1List sessions: 'tmux ls' or 'screen -ls' to see running and dead sessions
  2. 2Force attach (tmux): 'tmux attach -d -t session_name' — the -d detaches other clients first
  3. 3Force attach (screen): 'screen -D -r session_name' — detaches and reattaches
  4. 4Kill dead sessions: 'tmux kill-session -t name' or 'screen -X -S name quit'
  5. 5Check config: 'tmux source-file ~/.tmux.conf' to reload and check for errors

Tags

tmuxscreenterminalmultiplexersession

More in Command

Frequently Asked Questions

tmux is the modern choice — it has better default keybindings, native split panes, scriptable interface, and active development. screen is available on more legacy systems. Both serve the same core purpose.