Screen checks the fifo/socket whenever it receives a
SIGCHLD signal. If the socket is missing, it will be recreated. So the solution is to find the process and send it
On my Debian system,
screen appears to be installed as setgid
utmp but not setuid, so the first solution from the FAQ below worked:
$ kill -CHLD 30860
$ ls /var/run/screen/S-username/
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:
Sometimes the socket of a still-running screen can be destroyed,
though the actual process and all of its child processes are still
running. screen -list will display "No Sockets found in /tmp/uscreens/.."
Some handy instructions for how to recover from this (and a few
other uncommon problems) at http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html#MISC
about 2/3 of the way down.
Q: For some unknown reason, the fifo in /tmp/screens/S-myname is gone,
and I can't resume my screen session. Is there a way to recreate the fifo?
A: Screen checks the fifo/socket whenever it receives a SIGCHLD signal.
If missing, the fifo/socket is recreated then.
If screen is running non set-uid the user can issue a
kill -CHLD screenpid directly (it is
-CHILD on some
systems). Screenpid is the process-id of the screen process found
ps -x listing.
But usually this won't work, as screen should be installed setuid root.
In this case you will not be able to send it a signal, but the kernel
will. It does so, whenever a child of screen changes its state. Find
the process-id (shellpid below) of the "least important" shell running
inside screen. The try
kill -STOP shellpid. If the fifo/socket
does not reappear, destroy the shell process. You sacrify one shell to save
the rest. If nothing works, please do not forget to remove all processes
running in the lost screen session.