Can't get detached screen to resume

I've seen this when I drop a connection to an active screen then reconnect. Bug #27462 ("Reconnect stalls when original session is lost") describes the problem as I see it. What appears to happen is that screen is trying to notify the tty that holds it that it is about to leave, but since the tty is hung due to a dropped connection it has to wait for the timeout to happen (which is upwards of five minutes in some cases).

To fix it, I do this:

  • figure out which tty is holding on to the screen session ps -ef | grep screen | grep pty
  • find the login bash that is associated with that tty ps -ef | grep bash | grep $PTY
  • kill that bash kill -KILL $PID

This causes screen to complete its disconnect correctly, and lets you reconnect normally.

See here for an example script automating this somewhat.


I had a similar issue with my screen sessions. I name them and have them setup as multi-user sessions. What I found was that it was listing my sessions but telling me I had none to reconnect to. Then I tried:

screen -x <session_name>

It worked like a champ!