I had a screen
session running on a home server. My workstation needed a reboot, so I detached and killed the terminal. Upon reconnecting to the server, I execute my typical
$ screen -D -R
[new screen]
Huh? No, not a new session, gimme the old one. I know, I'll grab it directly. What's the socket name?
$ screen -list
No Sockets found in /var/run/screen/S-username
$ ls -a /var/run/screen/S-username
. ..
Wait… what? I know I left it running. Where'd it go?
$ ps -ef | grep -i screen
username 30860 1 0 Oct16 ? 00:00:29 SCREEN
Well, there's the process. But there's no socket to pass to screen -r
. How can I reattach to my session?
Best Answer
Screen
checks the fifo/socket whenever it receives aSIGCHLD
signal. If the socket is missing, it will be recreated. So the solution is to find the process and send itSIGCHLD
.On my Debian system,
screen
appears to be installed as setgidutmp
but not setuid, so the first solution from the FAQ below worked:On systems where screen is installed setuid
root
, this won't work, and you'll need to kill one of the child processes of the active screen session to force the kernel to send the signal for you. This means sacrificing one of your screen windows to reconnect with the rest (choose wisely!).From an archived Gentoo Wiki FAQ: