Bug 1253697

Summary: Cannot reattach to screen sessions
Product: Red Hat Enterprise Linux 7 Reporter: Jason Bradley Nance <jbnance>
Component: screenAssignee: Petr Hracek <phracek>
Status: CLOSED ERRATA QA Contact: Jan Kepler <jkejda>
Severity: urgent Docs Contact:
Priority: high    
Version: 7.1CC: al, btotty, ccheney, didi, fkrska, jkejda, jskarvad, lmiksik, mozilla_bugs, ohudlick, phracek, qe-baseos-apps, thozza
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: screen-4.1.0-0.22.20120314git3c2946.el7 Doc Type: Bug Fix
Doc Text:
Previously, when the user tried to reattach an existing screen session after updating the screen packages, the screen utility became unresponsive. With this update, the problem has been fixed and the reattachment of existing sessions works.
Story Points: ---
Clone Of:
: 1271131 (view as bug list) Environment:
Last Closed: 2015-11-04 17:32:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace output from screen -r none

Description Jason Bradley Nance 2015-08-14 13:20:51 UTC
Created attachment 1063031 [details]
strace output from screen -r

Description of problem:
screen -r
<indefinite hang, session never appears>

Version-Release number of selected component (if applicable):
4.1.0-0.21.20120314git3c2946.el7  (fasttrack)

How reproducible:
100%

Steps to Reproduce:
1. screen -S foo
2. <detach>
3. yum update screen (with fasttrack enabled)
4. screen -r foo

Actual results:
indefinite hang, session never appears

Expected results:
reattach to detached session

Additional info:
Running this with "strace" gives different results:

$ strace -o screen.trace screen -r foo
Directory '/var/run/screen' must have mode 777.

(full strace attached)

However, if I chmod 777 /var/run screen I get:

$ screen -r foo
Directory '/var/run/screen' must have mode 775.

Comment 2 Al Heisner 2015-08-19 18:10:09 UTC
I was able to reproduce this problem as well. 
You can still connect to the apparently hung screen sessions by using screen binary that was installed before the update was applied.

Comment 4 Petr Hracek 2015-09-01 09:39:38 UTC
I have reported the problem to upstream https://lists.gnu.org/archive/html/screen-devel/2015-08/msg00015.html
and gave a response that your /dev/pts is probably wrongly mounted.

Could you please clarify it?

Comment 5 Jason Bradley Nance 2015-09-01 15:10:33 UTC
Are you unable to reproduce this issue with the information provided?

Here is my /dev/pts mount:

$ mount | grep pts
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)

Comment 6 Petr Hracek 2015-09-08 10:09:50 UTC
I have already sent the information to upstream.
Please take a while. I will inform you about progress.

What about ptmxmode? Could it be relevant?

Comment 7 Petr Hracek 2015-09-11 07:27:45 UTC
It seems that source tarball of screen is from some snapshots.
Nowadays upstream again fixes bugs and I suggest to include at least screen-4.1.0 version or even the latest screen-4.3.1.

Comment 9 Petr Hracek 2015-10-01 14:47:45 UTC
Do you know what was the previous version installed on the system?

I would like to make a diff and send it out to upstream.

Comment 16 Chris Cheney 2015-10-09 15:23:46 UTC
Is attaching to an old screen session by a newer version of screen even supposed to be supported? I ran strace against the old detached version and it looked like it saw the connect message and then ignored it, possibly due to being mismatched version.

24976 10:12:13.946549 accept(4, {sa_family=AF_LOCAL, NULL}, [2]) = 3 <0.000045>
24976 10:12:13.946666 recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\x02\x67\x73\x6d\x02\x00\x00\x00\x2f\x64\x65\x76\x2f\x70\x74\x73\x2f\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 12348}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {8}}, msg_flags=0}, 0) = 12348 <0.000384>
24976 10:12:13.947168 close(3<socket:[276833]>) = 0 <0.000021>
24976 10:12:13.947238 select(1024, [4<socket:[54026]> 6</dev/ptmx>], [], NULL, NULL) = ? ERESTARTNOHAND (To be restarted if no handler) <24.998173>

Comment 28 Petr Hracek 2015-10-13 13:34:27 UTC
Well, in screen source is mentioned:
http://git.savannah.gnu.org/cgit/screen.git/tree/src/os.h?h=screen-v4#n524
~~~
/* Changing those you won't be able to attach to your old sessions
 * when changing those values in official tree don't forget to bump
 * MSG_VERSION */
#define MAXTERMLEN	32
#define MAXLOGINLEN	256
~~~

And we change it to 50.

Comment 29 Petr Hracek 2015-10-13 15:24:30 UTC
Thanks to upstream debian has a some hack how to attach to the older versions.

I will test it.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644788;msg=265;att=0

~~~
Discussion with upstream maintainer:
Because of we change the struct msg (by BZ https://bugzilla.redhat.com/show_bug.cgi?id=1119794) which is used for communication reattaching to the previous section is not supported at all. And it is not planned.
~~~~
It was not mentioned in DocText field in FAST Track.

The patch used by debian is not officially supported by upstream and it is not planned.

Comment 42 errata-xmlrpc 2015-11-04 17:32:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1988.html

Comment 47 Josef Ridky 2017-02-07 12:54:27 UTC
*** Bug 1315336 has been marked as a duplicate of this bug. ***