This happened to me while I was using vi where the session froze and I disconnected. When attempting to reattach to screen using screen -Arx, the process would just hang.
There might be a similar child process running causing screen to hang. If you recall one in particular focus on that, otherwise to get a list of the child process running under your screen do:
ps ux -H
Which will show the nested child processes:
zwood 28481 0.0 0.0 101148 8844 ? Ss Oct07 1:36 SCREEN -S mysession
zwood 28482 0.0 0.0 67436 1744 pts/2 Ss+ Oct07 0:00 /bin/bash
zwood 28515 0.0 0.0 67556 1876 pts/4 Ss+ Oct07 0:00 /bin/bash
zwood 4498 0.0 0.0 67436 1772 pts/5 Ss Oct07 0:00 /bin/bash
zwood 2007 0.0 0.0 73604 1324 pts/5 S+ 15:47 0:00 vi /home/zwood/.bashrc.custom
zwood 14670 0.0 0.0 67436 1768 pts/13 Ss+ Oct14 0:00 /bin/bash
zwood 27002 0.0 0.0 67436 1720 pts/11 Ss+ Oct20 0:00 /bin/bash
zwood 24748 0.0 0.0 67432 1712 pts/14 Ss+ Oct21 0:00 /bin/bash
After killing the vi process that caused the problem in the first place, I was able to reattach the screen without any issue. Killing any previous processes that had reattached to screen is probably a good idea as well. Just use:
kill -9 <pid>
I don't know what screen is doing in internally, why vi caused screen to hang, nor why killing the vi process brought my screen back. I've ran into this problem with screen in the past and had tried what most folks were recommending in this thread with no luck. Finding this problem child process is the only thing that has worked for me and has worked consistently at that.
2Tried all options(-RD, -xr) mentioned here and could not recover the session. Ended up killing the SCREEN session by finding (ps -ef | grep bash) it. – so_mv – 2012-05-24T09:16:44.610