Error Codes Wiki

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

Informationalcommand

About Screen and tmux Session Errors

Fix GNU Screen and tmux session errors including dead sessions, attachment failures, copy mode issues, and configuration file errors. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: 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. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: 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. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: List sessions: 'tmux ls' or 'screen -ls' to see running and dead sessions. Force attach (tmux): 'tmux attach -d -t session_name' — the -d detaches other clients first. Force attach (screen): 'screen -D -r session_name' — detaches and reattaches. Kill dead sessions: 'tmux kill-session -t name' or 'screen -X -S name quit'. Check config: 'tmux source-file ~/.tmux.conf' to reload and check for errors. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

Should I use screen or tmux?

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.

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.