Can't resume screen, says I am already attached?

The session is still attached on another terminal. The server hasn't detected the network outage on that connection: it only detects the outage when it tries to send a packet and gets an error back or no response after a timeout, but this hasn't happened yet. You're in a common situation where the client detected the outage because it tried to send some input and failed, but the server is just sitting there waiting for input. Eventually the server will send a keepalive packet and detect that the connection is dead.

In the meantime, use the -d option to detach the screen session from the terminal where it's in.

screen -r -d 30608

screen -rd is pretty much the standard way to attach to an existing screen session.


According to the manual you can "resume" only detached screens:

-ls [match]
-list [match]
Do not start screen, but instead print a list of session identification strings (usually of the form pid.tty.host; see Session Name). Sessions marked ‘detached’ can be resumed with screen -r. Those marked ‘attached’ are running and have a controlling terminal. If the session runs in multiuser mode, it is marked ‘multi’. Sessions marked as ‘unreachable’ either live on a different host or are dead. An unreachable session is considered dead, when its name matches either the name of the local host, or the specified parameter, if any. See the -r flag for a description how to construct matches. Sessions marked as ‘dead’ should be thoroughly checked and removed. Ask your system administrator if you are not sure. Remove sessions with the ‘-wipe’ option.

What you want is this option:

-x
Attach to a session which is already attached elsewhere (multi-display mode). Screen refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care.


I attache to screen with options -rD

From manual:

-D -r
Reattach a session. If necessary detach and logout remotely first. 

Tags:

Gnu Screen