1

(this is a question in reference to the OS X version of Gnu screen. I don't know if this makes any difference - and I guessed that Unix & Linux would have better screen-fu than Ask Different.)

When I'm physically at my computer at a terminal, and I type a command like

screen -dRR my_session_name

I can get access to a new screen session.

While on SSH, I seem able to re-attach to sessions if they are already running:

screen -R my_session_name

but creating a new session (whether or not some other session exists, but most frustratingly when none do) will hang, the only way to escape being a ^Z to push it to the background, and then an fg to restart the job, at which point I am informed it has died (Sorry, cannot contact session "processnumber.tty.hostname" again.)

I have tried running sudo dtruss screen (Mac OS X's version of strace), but I have no idea what to look for in the (extremely verbose) output.

I am away from my machine for a while (in a different city for a few days) and I really need to start a new screen session!

my ~/.screenrc:

# Set the shell to use fish:
shell "/usr/local/bin/fish"

# Make xterm scrolling work properly with screen.
# Note, this works in Terminal.app and iTerm too.
#termcapinfo xterm-256color|xterm-color|xterm|xterms|xs|rxvt ti@:te@

# Custom escape character like this:
escape ^Xx

# always create these sessions for me:
screen -t "foo" 1

# test to see if I can create new screens from SSH in any way:
#nonblock on

I have tried, as you can see, adding and commenting out various options to try to solve this. (just now, I've tried with both fish and bash, from both fish and bash outer sessions, with and without noblock, and with and without a screen -t.) I also see the same behaviour on very fast and very slow connections.

I would be very grateful for any of the following information:

  • suggestions on finding the problem (important parts of strace/dtrace output, something else?)
  • suggestions of new .screenrc options,
  • something completely different?

am happy to post more information, but wanted to avoid the whole dtruss output as it's hundreds of lines long.

0

sideways answer, OS X-specific in this case.

One option, and the one that I used in the end in this case, was as follows:

Use something to launch screen locally, which will work, and then re-attach to the session.

I wrote a python program that generates and runs an apple script program which opens a new Terminal.app window and runs the command you asked for, even when you're over SSH (obviously, the account must be logged in in a GUI on the machine itself for this to work).

It is called "osxhijack" and it's on github here. You invoke it like so:

hijack screen -dRR my_new_session

and then you can reattach straight away using:

screen -R my_new_session

If a "real" answer comes to light (i.e. if I find out what was/is wrong with my screen installation), I will update this question with a new answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.