Comparing your strace: [pid 28825] openat(AT_FDCWD, "/dev/ptmx", O_RDWR) = 4 [pid 28825] statfs("/dev/pts", {f_type="TMPFS_MAGIC", f_bsize=4096, f_blocks=2560, f_bfree=2560, f_bavail=2560, f_files=2063331, f_ffree=2063053, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 [pid 28825] statfs("/dev/", {f_type="TMPFS_MAGIC", f_bsize=4096, f_blocks=2560, f_bfree=2560, f_bavail=2560, f_files=2063331, f_ffree=2063053, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 [pid 28825] close(4) = 0 [pid 28825] openat(AT_FDCWD, "/dev/ptyp0", O_RDWR) = -1 ENOENT (No such file or directory)
with one on 3.16.0-0.bpo.4-amd64 4023 open("/dev/ptmx", O_RDWR) = 4 4023 statfs("/dev/pts", {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 4023 ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 4023 ioctl(4, TIOCGPTN, [2]) = 0 4023 stat("/dev/pts/2", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 your trace seems to be "missing" some ioctl() calls on /dev/ptmx. looking at master.c: if (!dont_have_tty) the_pty.pid = forkpty(&the_pty.fd, NULL, &the_pty.term, NULL); else the_pty.pid = forkpty(&the_pty.fd, NULL, NULL, NULL); if (the_pty.pid < 0) return -1; i am guessing the difference hides in forkpty. could you cd /tmp apt-get source dtach cd dtach-0.8 ./configure and attach config.h? stefam On Fri, Nov 13, 2015 at 04:15:01PM -0400, David Bremner wrote: > Stefan <b...@bc-bd.org> writes: > > > Can you strace detach to see where it looks for ptys ? > > Sorry, I missed this message. > > Here is the output from strace -f > > execve("/usr/bin/dtach", ["dtach", "-A", "/tmp/foo", "bash"], [/* 21 vars > */]) = 0 > brk(0) = 0x19793000 > faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or > directory) > mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = > 0x7f9388e000 > faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or > directory) > openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 > fstat(3, {st_mode=S_IFREG|0644, st_size=16627, ...}) = 0 > mmap(NULL, 16627, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f93889000 > close(3) = 0 > faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or > directory) > openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libutil.so.1", O_RDONLY|O_CLOEXEC) = > 3 > read(3, > "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\340\17\0\0\0\0\0\0"..., > 832) = 832 > fstat(3, {st_mode=S_IFREG|0644, st_size=10600, ...}) = 0 > mmap(NULL, 74008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = > 0x7f93854000 > mprotect(0x7f93856000, 61440, PROT_NONE) = 0 > mmap(0x7f93865000, 8192, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f93865000 > close(3) = 0 > faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or > directory) > openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 > read(3, > "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\254\16\2\0\0\0\0\0"..., > 832) = 832 > fstat(3, {st_mode=S_IFREG|0755, st_size=1275584, ...}) = 0 > mmap(NULL, 1348472, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = > 0x7f9370a000 > mprotect(0x7f9383b000, 61440, PROT_NONE) = 0 > mmap(0x7f9384a000, 24576, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x130000) = 0x7f9384a000 > mmap(0x7f93850000, 13176, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f93850000 > close(3) = 0 > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = > 0x7f93888000 > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = > 0x7f93887000 > mprotect(0x7f9384a000, 16384, PROT_READ) = 0 > mprotect(0x7f93865000, 4096, PROT_READ) = 0 > mprotect(0x7f93892000, 4096, PROT_READ) = 0 > munmap(0x7f93889000, 16627) = 0 > ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0 > socket(PF_LOCAL, SOCK_STREAM, 0) = 3 > connect(3, {sa_family=AF_LOCAL, sun_path="/tmp/foo"}, 110) = -1 ENOENT (No > such file or directory) > close(3) = 0 > socket(PF_LOCAL, SOCK_STREAM, 0) = 3 > bind(3, {sa_family=AF_LOCAL, sun_path="/tmp/foo"}, 110) = 0 > listen(3, 128) = 0 > fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) > fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 > fchmodat(AT_FDCWD, "/tmp/foo", 0600) = 0 > fcntl(3, F_SETFD, FD_CLOEXEC) = 0 > pipe2([4, 5], 0) = 0 > fcntl(4, F_SETFD, FD_CLOEXEC) = 0 > fcntl(5, F_SETFD, FD_CLOEXEC) = 0 > clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, > child_tidptr=0x7f938870d0) = 28825 > Process 28825 attached > [pid 28824] close(5) = 0 > [pid 28825] close(4) = 0 > [pid 28824] read(4, <unfinished ...> > [pid 28825] setsid() = 28825 > [pid 28825] rt_sigaction(SIGPIPE, {SIG_IGN, [PIPE], SA_RESTART}, {SIG_DFL, > [], 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGXFSZ, {SIG_IGN, [XFSZ], SA_RESTART}, {SIG_DFL, > [], 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGHUP, {SIG_IGN, [HUP], SA_RESTART}, {SIG_DFL, [], > 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGTTIN, {SIG_IGN, [TTIN], SA_RESTART}, {SIG_DFL, > [], 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGTTOU, {SIG_IGN, [TTOU], SA_RESTART}, {SIG_DFL, > [], 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGINT, {0x401e74, [INT], SA_RESTART}, {SIG_DFL, [], > 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGTERM, {0x401e74, [TERM], SA_RESTART}, {SIG_DFL, > [], 0}, 8) = 0 > [pid 28825] rt_sigaction(SIGCHLD, {0x401e74, [CHLD], SA_RESTART}, {SIG_DFL, > [], 0}, 8) = 0 > [pid 28825] openat(AT_FDCWD, "/dev/ptmx", O_RDWR) = 4 > [pid 28825] statfs("/dev/pts", {f_type="TMPFS_MAGIC", f_bsize=4096, > f_blocks=2560, f_bfree=2560, f_bavail=2560, f_files=2063331, f_ffree=2063053, > f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 > [pid 28825] statfs("/dev/", {f_type="TMPFS_MAGIC", f_bsize=4096, > f_blocks=2560, f_bfree=2560, f_bavail=2560, f_files=2063331, f_ffree=2063053, > f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 > [pid 28825] close(4) = 0 > [pid 28825] openat(AT_FDCWD, "/dev/ptyp0", O_RDWR) = -1 ENOENT (No such file > or directory) > [pid 28825] dup3(5, 1, 0) = 1 > [pid 28825] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 > [pid 28825] mmap(NULL, 65536, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f936fa000 > [pid 28825] unlinkat(AT_FDCWD, "/tmp/foo", 0) = 0 > [pid 28825] write(1, "dtach: init_pty: No such file or"..., 43) = 43 > [pid 28824] <... read resumed> "dtach: init_pty: No such file or"..., 1024) = > 43 > [pid 28824] write(2, "dtach: init_pty: No such file or"..., 43 <unfinished > ...> > [pid 28825] exit_group(1) = ? > dtach: init_pty: No such file or directory > [pid 28824] <... write resumed> ) = 43 > [pid 28824] kill(28825, SIGTERM) = 0 > [pid 28824] exit_group(1) = ? > [pid 28825] +++ exited with 1 +++ > +++ exited with 1 +++ -- One of the most striking differences between a cat and a lie is that a cat has only nine lives. -- Mark Twain, "Pudd'nhead Wilson's Calendar"