2

I've just started using screen for the first time, and I somehow got it into a state where it wasn't recognizing any commands any longer. Ctrl-A n, Ctrl-A p etc wouldn't work. Meanwhile my cursor was also frozen in emacs, which never happens to me.

So I opened another terminal, hoping that I could just reattach to screen and things would be better. But it won't let me connect, and it won't let me detach it either. I found an alternative command to try, but after the last command everything just hung again.

-bash-4.1$ screen -r
There is a screen on:
        4511.pts-1304.unixscrna01       (Attached)
There is no screen to be resumed.
-bash-4.1$ screen -list
There is a screen on:
        4511.pts-1304.unixscrna01       (Attached)
1 Socket in /var/run/screen/S-sme.

-bash-4.1$ screen -D
[4511.pts-1304.unixscrna01 power detached.]

-bash-4.1$ screen -r
There is a screen on:
        4511.pts-1304.unixscrna01       (Attached)
There is no screen to be resumed.
-bash-4.1$ screen -d -r 4511

My terminal hung completely at the last point.

Any idea what could have happened here??

1
  • 1
    Maybe the terminal is in the suspended state Try pressing Ctrl-q Jan 22, 2018 at 23:13

1 Answer 1

4

You're probably now connected to the old session, but the session may be in a wonky state for some reason. Try pressing Control-Q first: if XON-XOFF handshaking is enabled in the pseudo-terminal you've using to connect to the screen session, it might allow the session to resume.

(Control-S is the XOFF control character, which means "pause transmission": if XON/XOFF handshaking is enabled in the pseudo-terminal, it will do just that. Control-Q is the XON character which means "resume transmission".)

Then press Control-L: most full-screen terminal applications will understand that as a request to completely refresh the terminal display, in case it got corrupted for any reason. The bash shell will also clear the screen and display a fresh prompt.

If you were using screen for a ssh session onward to another system, a network problem may have broken the SSH connection, in which case the ssh client will -by default- wait a very long time until it decides the other end must have disconnected. A tilde-dot (~.) key sequence can be used to terminate a hanging SSH session.

2
  • Thank you. I've already given up on that screen session, but I tested what you said and confirmed what you were saying about XON/XOFF. Just one crazy thing though: It seems like when you pass XON, any characters you typed after XOFF are immediately sent through (at least with PuTTY). Seems like that's what you would want to avoid if you were using XOFF to temporarily disable your keyboard...
    – Stephen
    Jan 22, 2018 at 23:27
  • It's not for disabling your keyboard: it's for pausing the output from the remote end. On a very slow link (say, a bare-bones GPS 9600 bps mobile data link) and cating a file on your display, you would actually be able to eyeball it as it scrolls by, and use the XON/XOFF to pause the display if you need to look at something more carefully.
    – telcoM
    Jan 23, 2018 at 0:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .