Martin Thoma
Martin Thoma

Reputation: 136665

How do I fix 'WriteMessage: Bad file descriptor' of screen -r name?

When I try to resume a screen session with

$ screen -r name

I get

WriteMessage: Bad file descriptor

How can I fix that? (Ideally being able to resume the screen, but at least remove it if resuming is not possible)

The problem why it occurs might be that the SSH connection was interrupted.

Upvotes: 8

Views: 2682

Answers (2)

duhaime
duhaime

Reputation: 27611

I got this error when trying to detach all screens with screen -D. I had attached the screen with

screen -R screen-name-here

To detach, I needed to specify the screen name:

screen -D screen-name-here

Upvotes: 0

LouYu
LouYu

Reputation: 691

This worked for me:

  1. Find the process's pid by running screen -R
  2. Use screen -r <pid> instead of screen -r <name>

If the screen didn't detach from previous ssh session, you might also need to kill dead sshd process.

Upvotes: 5

Related Questions