microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.48k stars 822 forks source link

Issue with WSL listening to TCP ports #1554

Closed lefty-kreouzis closed 6 years ago

lefty-kreouzis commented 7 years ago

I ma unable to start a tcp listening port in Bash for windows

Open one more bash window Run: lefty@Turing:~$ echo 'It works' | nc -4 -v localhost 4434 nc: connect to localhost port 4434 (tcp) failed: Connection refused nc: connect to localhost port 4434 (tcp) failed: Connection refused

expected result:

(on an actual Ubuntu box)

On one window: lefty@ubuntu-1gb-lon1-01:~$ nc -4 -l 4434 It works

On the other:

lefty@ubuntu-1gb-lon1-01:~$ echo 'It works' | nc -4 -v localhost 4434 Connection to localhost 4434 port [tcp/*] succeeded!

SERVER Strace: lefty@Turing:~$ strace nc -4 -l 4434 execve("/bin/nc", ["nc", "-4", "-l", "4434"], [/ 15 vars /]) = 0 brk(NULL) = 0x859000 access("/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) = 0x7f03e6930000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=36889, ...}) = 0 mmap(NULL, 36889, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f03e6926000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libbsd.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0004\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=81040, ...}) = 0 mmap(NULL, 2179952, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f03e63e0000 mprotect(0x7f03e63f3000, 2093056, PROT_NONE) = 0 mmap(0x7f03e65f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x7f03e65f2000 mmap(0x7f03e65f4000, 880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f03e65f4000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P9\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=101200, ...}) = 0 mmap(NULL, 2206280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f03e61c0000 mprotect(0x7f03e61d7000, 2097152, PROT_NONE) = 0 mmap(0x7f03e63d7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f03e63d7000 mmap(0x7f03e63d9000, 6728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f03e63d9000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f03e6920000 mmap(NULL, 3967392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f03e5df0000 mprotect(0x7f03e5faf000, 2097152, PROT_NONE) = 0 mmap(0x7f03e61af000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f03e61af000 mmap(0x7f03e61b5000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f03e61b5000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f03e6910000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f03e6900000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f03e68f0000 arch_prctl(ARCH_SET_FS, 0x7f03e6900700) = 0 mprotect(0x7f03e61af000, 16384, PROT_READ) = 0 mprotect(0x7f03e63d7000, 4096, PROT_READ) = 0 mprotect(0x7f03e65f2000, 4096, PROT_READ) = 0 mprotect(0x606000, 4096, PROT_READ) = 0 mprotect(0x7f03e6825000, 4096, PROT_READ) = 0 munmap(0x7f03e6926000, 36889) = 0 brk(NULL) = 0x859000 brk(0x87a000) = 0x87a000 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(4434), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 listen(3, 1) = 0 accept(3,

Client STRACE:

lefty@Turing:~$ echo 'It works' | strace nc -4 -v localhost 4434 execve("/bin/nc", ["nc", "-4", "-v", "localhost", "4434"], [/ 15 vars /]) = 0 brk(NULL) = 0xa5b000 access("/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) = 0x7fc22bab0000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=36889, ...}) = 0 mmap(NULL, 36889, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc22baa6000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libbsd.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0004\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=81040, ...}) = 0 mmap(NULL, 2179952, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc22b5e0000 mprotect(0x7fc22b5f3000, 2093056, PROT_NONE) = 0 mmap(0x7fc22b7f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x7fc22b7f2000 mmap(0x7fc22b7f4000, 880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc22b7f4000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P9\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=101200, ...}) = 0 mmap(NULL, 2206280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc22b3c0000 mprotect(0x7fc22b3d7000, 2097152, PROT_NONE) = 0 mmap(0x7fc22b5d7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fc22b5d7000 mmap(0x7fc22b5d9000, 6728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc22b5d9000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc22baa0000 mmap(NULL, 3967392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc22aff0000 mprotect(0x7fc22b1af000, 2097152, PROT_NONE) = 0 mmap(0x7fc22b3af000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7fc22b3af000 mmap(0x7fc22b3b5000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc22b3b5000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc22ba90000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc22ba80000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc22ba70000 arch_prctl(ARCH_SET_FS, 0x7fc22ba80700) = 0 mprotect(0x7fc22b3af000, 16384, PROT_READ) = 0 mprotect(0x7fc22b5d7000, 4096, PROT_READ) = 0 mprotect(0x7fc22b7f2000, 4096, PROT_READ) = 0 mprotect(0x606000, 4096, PROT_READ) = 0 mprotect(0x7fc22ba25000, 4096, PROT_READ) = 0 munmap(0x7fc22baa6000, 36889) = 0 brk(NULL) = 0xa5b000 brk(0xa7c000) = 0xa7c000 socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=497, ...}) = 0 read(3, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 497 read(3, "", 4096) = 0 close(3) = 0 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=36889, ...}) = 0 mmap(NULL, 36889, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc22baa6000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/tls/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/x86_64-linux-gnu/tls/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/tls/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/x86_64-linux-gnu/tls", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/x86_64-linux-gnu/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/x86_64-linux-gnu/tls/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/tls/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/x86_64-linux-gnu/tls", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/x86_64-linux-gnu/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open("/lib/tls/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/tls/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/lib/tls/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/tls", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/lib/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/lib/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open("/usr/lib/tls/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/tls/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/tls", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib/x86_64", 0x7fffcc71a120) = -1 ENOENT (No such file or directory) open("/usr/lib/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/usr/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 munmap(0x7fc22baa6000, 36889) = 0 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=36889, ...}) = 0 mmap(NULL, 36889, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc22baa6000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260!\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=47600, ...}) = 0 mmap(NULL, 2168600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc22add0000 mprotect(0x7fc22addb000, 2093056, PROT_NONE) = 0 mmap(0x7fc22afda000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7fc22afda000 mmap(0x7fc22afdc000, 22296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc22afdc000 close(3) = 0 mprotect(0x7fc22afda000, 4096, PROT_READ) = 0 munmap(0x7fc22baa6000, 36889) = 0 open("/etc/services", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=19605, ...}) = 0 read(3, "# Network services, Internet sty"..., 4096) = 4096 read(3, "\t\t# IPX\nipx\t\t213/udp\nimap3\t\t220/"..., 4096) = 4096 read(3, "nessus\t\t1241/tcp\t\t\t# Nessus vuln"..., 4096) = 4096 read(3, "347/tcp\t\t\t# gnutella\ngnutella-rt"..., 4096) = 4096 read(3, "ureg\t779/udp\t\tmoira_ureg\t# Moira"..., 4096) = 3221 read(3, "", 4096) = 0 close(3) = 0 getpid() = 779 open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=141, ...}) = 0 read(3, "# DO NOT EDIT THIS FILE BY H"..., 4096) = 141 read(3, "", 4096) = 0 close(3) = 0 uname({sysname="Linux", nodename="Turing", ...}) = 0 socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=92, ...}) = 0 read(3, "# The \"order\" line is only used "..., 4096) = 92 read(3, "", 4096) = 0 close(3) = 0 open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=4461, ...}) = 0 read(3, "# The following lines are desira"..., 4096) = 4096 read(3, "2\tdxbdoap14sv\teksho\n10.20.155.62"..., 4096) = 365 read(3, "", 4096) = 0 close(3) = 0 open("/etc/gai.conf", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2584, ...}) = 0 fstat(3, {st_mode=S_IFREG|0644, st_size=2584, ...}) = 0 read(3, "# Configuration for getaddrinfo("..., 4096) = 2584 read(3, "", 4096) = 0 close(3) = 0 socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 3 bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0 getsockname(3, {sa_family=AF_NETLINK, pid=779, groups=00000000}, [12]) = 0 time(NULL) = 1482979039 sendto(3, "\24\0\0\0\26\0\1\3\337vdX\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\20\0\0\10\0\0\0\10\0\1\0\251\376w\272"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\10\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\20\0\0\20\0\0\0\10\0\1\0\251\376\341\254"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\20\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\20\0\0\2\0\0\0\10\0\1\0\251\376\"B"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\375\2\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\10\0\0\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n\200\0\0\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\30\0\0\16\0\0\0\10\0\1\0\300\250\1*"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\16\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\20\0\0\v\0\0\0\10\0\1\0\251\376\253\7"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\v\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\r\0\0\0\24\0\1\0 \1\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\r\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"<\0\0\0\24\0\2\0\337vdX\v\3\0\0\2\30\0\0\t\0\0\0\10\0\1\0\300\250\211\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 60 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\337vdX\v\3\0\0\n@\0\0\t\0\0\0\24\0\1\0\376\200\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\20\0\0\0\3\0\2\0\337vdX\v\3\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 16 close(3) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(4434), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 getsockname(3, {sa_family=AF_INET, sin_port=htons(61465), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0 close(3) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(4434), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused) fcntl(3, F_SETFL, O_RDWR) = 0 write(2, "nc: ", 4nc: ) = 4 write(2, "connect to localhost port 4434 ("..., 43connect to localhost port 4434 (tcp) failed) = 43 write(2, ": ", 2: ) = 2 write(2, "Connection refused\n", 19Connection refused ) = 19 close(3) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(4434), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused) fcntl(3, F_SETFL, O_RDWR) = 0 write(2, "nc: ", 4nc: ) = 4 write(2, "connect to localhost port 4434 ("..., 43connect to localhost port 4434 (tcp) failed) = 43 write(2, ": ", 2: ) = 2 write(2, "Connection refused\n", 19Connection refused ) = 19 close(3) = 0 close(-1) = -1 EBADF (Bad file descriptor) exit_group(1) = ? +++ exited with 1 +++

Thanks

Lefty

lefty-kreouzis commented 7 years ago

This looks like a duplicate of #1498

therealkenc commented 7 years ago

Repro steps with netcat work here on 14986 for what it's worth ('it works' on the server and 'succeeded!' on the client). Your straces look pretty vanilla at first glance. That accept(3, on the last line sure thinks it's ready for incoming.

After you've fired up the server, can you see it listening if you run netstat -an | bash -c "grep 4434" from the Windows CMD prompt? [No netstat on WSL yet.]

It's probably a dup of #1498 but node servers work here too. Common networking scenarios used to fail because of the NETLINK_ROUTE stuff, but you're on the latest and those calls look okay in your strace. Anything special about your setup network-wise?

sunilmut commented 7 years ago

@lefty-kreouzis - I cannot reproduce the issue either on 14986 (see screenshot below). If you are running any AV software (see #475), can you try disabling it and also opening up the required port through Windows firewall.

image

lefty-kreouzis commented 7 years ago

The listening port is not shown in CMD

I have avast antivirus but I disabled it I also disabled windows firewall but the same issue persists:

image

sunilmut commented 7 years ago

That's strange. Few things:

  1. Can you confirm you are on 14986?
  2. Just for my sanity, can you also share the output of `netstat -an | find "4444" ?
  3. Can you collect a strace and share it out? strace -o <trace_file> -ff nc -v -4 -l 4444
lefty-kreouzis commented 7 years ago

Hi Sunil

I am definitely on 14986:

C:\Users\lefty>ver

Microsoft Windows [Version 10.0.14986]

C:\Users\lefty>

image

nc.trace.27.txt

Weird

I am performing a backup so I can reinstall windows ..........

Thanks

Lefty

lefty-kreouzis commented 7 years ago

BTW i had removed the WSL and reinstalled it by running lxrun /uninstall and lxrun /install

(I kept my home directory files BTW0

lefty-kreouzis commented 7 years ago

I did a reinstall of windows (keeping my files) and now it works.....

Weird

therealkenc commented 7 years ago

Did you reinstall avast though? Notwithstanding other ghosts in the machine, that's still as good a suspect as any, even given the fact you disabled it. I would have suggested uninstalling avast first if I knew you were up for the big hammer of reinstalling Windows.

lefty-kreouzis commented 7 years ago

Just reinstalled Avast and it still works.....

therealkenc commented 7 years ago

That is really weird....

sunilmut commented 7 years ago

There has to be some collision with the AV here. That's all I got here. But, I am glad it's working for you now. I would like to encourage everyone to talk to their AV vendors, in supporting WSL. Our voice only reaches so far.

I am closing this issue out.

thomashood2 commented 7 years ago

I've exactly the same problem on newly installed 15063... Should I raise a new issue?

I've no 3rd party AV only the default windows defender stuff. I tried disabling the firewall and real-time AV protection to no avail.:

nc: connect to localhost port 4434 (tcp) failed: Connection refused

hxhlb commented 7 years ago

I have same problem and same windows ver with @thomashood2

aseering commented 7 years ago

So, this works fine for me. More importantly, it works fine for most people, including (I assume) the WSL team. (Judging by the number of tickets that have been filed about bugs that were revealed after people got sockets to work :-) )

Frankly speaking: "It doesn't work just for me!" issues are, unfortunately, incredibly hard for anyone else to diagnose, let alone fix. So I think the way this moves forward is, someone who is experiencing this problem makes an observation that turns this into a "huh, that's a little weird everywhere" issue. Once any piece of this is reproducible, relevant experts can look at it and know where to start digging.

How can you do that? I would suggest that y'all play with standard Windows and Linux network diagnostic tools; check precisely which sockets are open for which addresses, ports, and and protocols (and try switching around all of the above); determine precisely what packets are or are not being delivered/received from which interfaces. Also check whether this happens just for Linux->Linux connections, or what happens if the client or server (or both!) are Windows apps. If you have any third-party Windows apps installed that might potentially mess with network interfaces, even if they aren't firewalls per se, try disabling or reconfiguring them. Basically, permute everything; find the thing that has an unexpected-and-relevant side effect.

sofent commented 7 years ago

i have the same problem with 15063.11

Roscoe93 commented 7 years ago

same problem with 15063.138 WSL reinstalled,windows reinstalled,AV(only windows defender) all shutdown,but still not working

image

image

i've no idea how to solve this

shsmith commented 7 years ago

Same issue here on public build 15063.138 Insider was previously working, but after updating to build 16176 the issue appeared. No third party AV at all.

sunilmut commented 7 years ago

@Roscoe93 @shsmith - Thanks for your post. I can understand that this can be frustrating, but it's not clear to us too why these services are not able to listen/connect.

If not already, can you also try disabling the Windows firewall:

From a powershell command prompt:

  1. To disable firewall: netsh advfirewall set allprofiles state off
  2. To check the status of the firewall: netsh advfirewall show allprofiles
therealkenc commented 7 years ago

Wish I knew the common denominator on these too. Even the stock answer we're giving people is highly questionable; I've never had to turn my firewall off. It isn't clear how doing so would help since if Windows firewall was blocking localhost, that would probably make a bunch of win32 apps pretty unhappy, nevermind WSL. The mechanism isn't magical; WSL calling WSK isn't any different from a win32 driver doing the same thing, and you'd kinda notice that if it was broken. Total 🤷.

shsmith commented 7 years ago

In my case turning off firewall does not change anything. Netstat does not show the listening port, so the problem seems to be at the moment of 'bind' or 'listen' in the WSL service. strace did not show any errors on the bind or listen operation though.

   bind(3, {sa_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
   listen(3, 1) = 0
therealkenc commented 7 years ago

That's the crux of the problem here though: it isn't bind or listen in WSL, strictly speaking. If it were, everyone would be hitting this, not just a small (but large enough) subset of WSL users. As you can see from your strace successful return values, WSL thinks everything is golden. There is something "in the way". The question is what. If you were to install a fresh copy of Win 10 (entirely hypothetically, not literally) you would almost certainly see it working. The "almost" caveat could theoretically exist if there was some win32 network driver variable at play here, but there isn't enough information to know if that's the case.

So, any information you can give about your setup versus a bog stock Win 10 install, however minor, could be helpful tracking the problem. Anything different than (a) get computer from WalMart (b) install WSL (c) bind and listen to a port. Because that works. Tunneling software. Non-default network configuration. Anything.

sunilmut commented 7 years ago

@therealkenc - Thanks for your post. Some of these applications bind to wildcard addresses (0.0.0.0) (as you can see from @Roscoe93) post above, which the Firewall can block. To the Windows Firewall, WSL processes calling into TCP/IP stack looks different than Winsock programs. That is because WSL processes are pico processes and the Windows Firewall team is yet to do the work to plumb the Pico process notifications. Opening ports in the Firewall has worked before, for example: see #1853. Having said all that, I agree that the above is not a recommended solution. And, the suggestion above is not for a solution but to understand what the common problem here is. I am still at loss at knowing what is causing these applications to not able to listen.

therealkenc commented 7 years ago

Understood. But the firewall theory and solution still leaves me squinting. Pico process or not, Standard Windows firewall doesn't block inbound connections from localhost to 0.0.0.0 listeners. It doesn't here, anyway. Things like PuTTY to port 0.0.0.0:22 would faceplant for everyone if it did. Inbound connections from foreign addresses, even from a nonroutable subnets (192.168.0.0/24), sure. But that's also the behavior on Windows. No one would be confused by that, least not web developers.

Anyway, it certainly doesn't hurt to try turning off firewall. To quote General Beringer: I'd piss on a spark plug if I thought it would do any good.

sunilmut commented 7 years ago

I think connect here is way ahead in the future. These applications are even failing to listen or accept.

sunilmut commented 7 years ago

@shsmith - Can you please help us get some additional traces here that we can share with the networking team to get closer to a resolution? Thanks for all of your patience so far.

Steps:

  1. Disable Anti-Virus and Windows Firewall if you haven't already.
  2. From a WSL bash prompt, apt install python-minimal
  3. From a Windows cmd, a. mkdir temp b. cd temp c. netsh wfp show state d. netsh trace start scenario=InternetClient_dbg capture=yes persistent=yes report=di traceFile=.\nettrace.etl e. netsh wfp capture start
  4. From WSL bash, python -m SimpleHTTPServer. It should give you a message, something like "Serving HTTP on 0.0.0.0 port 8000 ..."
  5. From cmd, a. netsh wfp capture stop b. netsh trace stop c. Make sure netstat is not showing the listening port.
  6. Zip up the whole temp directory and share it out.
Roscoe93 commented 7 years ago

i reseted windows through Windows Defender > Settings > Update & security >Fresh Start in windows 10[15068.138].All servers in WSL works now.Seems like it's some Windows thing..I kept all AV software and firewall settings,but it just works

sunilmut commented 7 years ago

@Roscoe93 - I am glad it is working for you. If it reoccurs, we would like to get the traces using the above steps.

thomashood2 commented 7 years ago

@sunilmut Traces as requested. temp.zip

sunilmut commented 7 years ago

@thomashood2 - Thank you. I am reaching out to the Windows networking team with your traces to see if they can help figure out what's going on here.

sunilmut commented 7 years ago

@thomashood2 - Networking team came back and said that they don't see anything wrong with the 'bind' and 'listen', so far. They would like to see the traces with the socket 'connect' call as well. Would you be willing to rerun the steps above with this one additional step and resubmit the traces?

3.5 strace -o telnet.tr -f telnet 127.0.0.1 8000 3.6 copy telnet.tr file to the temp directory.

therealkenc commented 7 years ago

@sunilmut - Worth looking into and I hope the traces help track it down. But I think you were right the first time. For people who have posted having problems previously, the listeners don't show up in a netstat. The crux of the problem has to be before connect.

sunilmut commented 7 years ago

@therealkenc - I hope so too. I am very curious to see what's going on here.

@thomashood2 - Another simple experiment for you worth trying.

  1. nc -4 -l 127.0.0.1 8000
  2. nc 127.0.0.1 8000
thomashood2 commented 7 years ago

@sunilmut temp3.zip

Another simple experiment for you worth trying. 1.tom@FUJITSU-E720:~$ nc -4 -l 127.0.0.1 8000 ^C tom@FUJITSU-E720:~$

2.tom@FUJITSU-E720:~$ nc 127.0.0.1 8000 tom@FUJITSU-E720:~$

I may have misunderstood you, but did you want me to trace those as a substitute for your original step 3?

sunilmut commented 7 years ago

No, sorry about the confusion. Thanks for sharing the traces. As a side experiement, I was just curious to see how does the below work for you. Can you describe the outcome of: From bash prompt:

  1. nc -4 -l 127.0.0.1 8000
  2. nc 127.0.0.1 8000
  3. Now if you type any text, the other side should receive it and display it on the screen.
sunilmut commented 7 years ago

Ignore my previous comment. Can you try this out?

From bash

  1. nc -4 -l 127.0.0.1 8000

From windows cmd prompt. Note that here it is important to provide the -q option.

  1. netstat -a -q | findstr "8000"

From bash prompt:

  1. nc 127.0.0.1 8000
  2. Now if you type any text, the other side should receive it and display it on the screen.

Can you share the output from step (2) and your observation from step (3)?

Thanks for all your help so far.

shsmith commented 7 years ago
$ nc -4 -l 127.0.0.1 8000

C:\> netstat -a -q -n  | findstr 8000
  TCP    127.0.0.1:8000         0.0.0.0:0              BOUND

Still get this when attempting to connect:

C:\> telnet 127.0.0.1 8000
Connecting To 127.0.0.1...Could not open connection to the host, on port 8000: Connect failed
sunilmut commented 7 years ago

@shsmith - Thank you very much. That was helpful. The socket is getting bound fine. It's the listen call that puts the socket in the listening mode (i.e ready to accept connections) that seems to be problematic. I think we are making progress here.

sunilmut commented 7 years ago

@thomashood2, @shsmith - We are still very bummed out as to why the socket is failing to listen. Can you help us with some additional traces? Thanks for your continued patience here as we dive deeper.

  1. Download these two .txt files and rename them .cmd https://github.com/Microsoft/BashOnWindows/files/288621/start_lxcore_trace.txt https://github.com/Microsoft/BashOnWindows/files/288622/stop_lxcore_trace.txt
  2. Run start_lxcore_trace.cmd from an admin command prompt
  3. start bash
  4. nc -4 -l 127.0.0.1 8000 Make sure the scenario is a repro with netstat showing that the socket is not listening. Please share the output of the netstat command.
  5. Exit bash
  6. Run stop_lxcore_trace.cmd from an admin command prompt
  7. You should now see few .etl files in the directory you ran the script from. Can you zip them up and send it across.
thomashood2 commented 7 years ago

Zip attached.

Not sure if anything is expected, but nc -4 -l 127.0.0.1 8000 just sits there until I close Bash. Downloads.zip

Regards,

Tom

sunilmut commented 7 years ago

@thomashood2 - Thanks.

After doing nc -4 -l 127.0.0.1 8000 from bash, switch to a windows command prompt and do: netstat -a -q -n | findstr 8000. What do you see? Can you paste the output of the netstat command?

sunilmut commented 7 years ago

@thomashood2 - Also, can you confirm if both your Anti-Virus and Windows firewall are disabled?

thomashood2 commented 7 years ago

@sunilmut sunilmut c:\Users\thoma\Downloads>netstat -a -q -n | findstr 8000 TCP 127.0.0.1:8000 0.0.0.0:0 BOUND

Also, can you confirm if both your Anti-Virus and Windows firewall are disabled? capture

sunilmut commented 7 years ago

@thomashood2 - Thanks. Now, I am wondering now how does a Win32 winsock socket application works on your Windows side. Can you try netcat Win32 application? For example: https://github.com/diegocr/netcat/blob/master/nc.exe . We don't endorse that application in any way, but it's just for reference.

From a Windows cmd prmpt:

  1. nc -l -p 8000 127.0.0.1
  2. From a different cmd prompt: netstat -a -q -n | findstr 8000
thomashood2 commented 7 years ago

@sunilmut

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\thoma>netstat -a -q -n | findstr 8000
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:8000         0.0.0.0:0              BOUND
AdamBialas commented 7 years ago

which service in windows is for routing TCP connection layer between bash processes and windows TCP ?? the problem with bind TCP ports from bash is somewhere in this place :(

sunilmut commented 7 years ago

Apologize for the delay. But, we have some new instructions from the core networking team to gather some extra logs. I have posted those instructions at #1853. If you can follow those instructions and give us some logs, that can probably help us out.

thomashood2 commented 7 years ago

@sunilmut Attached, per previous I disabled a/v and firewall.

Thanks,

Tom 20170512 WSL Bash Network Logs_evtx.txt

`Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>Auditpol /set /category:"Object Access" /SubCategory:"Filtering Platform Connection" /success:enable /failure:enable The command was successfully executed.

C:\WINDOWS\system32>netstat

Active Connections

Proto Local Address Foreign Address State TCP 127.0.0.1:49670 FUJITSU-E720:49673 ESTABLISHED TCP 127.0.0.1:49670 FUJITSU-E720:52836 ESTABLISHED TCP 127.0.0.1:49673 FUJITSU-E720:49670 ESTABLISHED TCP 127.0.0.1:52827 FUJITSU-E720:49670 TIME_WAIT TCP 127.0.0.1:52828 FUJITSU-E720:49670 TIME_WAIT TCP 127.0.0.1:52833 FUJITSU-E720:49670 TIME_WAIT TCP 127.0.0.1:52835 FUJITSU-E720:49670 TIME_WAIT TCP 127.0.0.1:52836 FUJITSU-E720:49670 ESTABLISHED TCP 192.168.1.69:3389 SonyDESKTOP-GFDOVV7:4720 ESTABLISHED TCP 192.168.1.69:3483 FUJITSU-E720:50244 ESTABLISHED TCP 192.168.1.69:3483 KitchenSqueezebox:48285 ESTABLISHED TCP 192.168.1.69:3483 OfficeSqueezebox:26246 ESTABLISHED TCP 192.168.1.69:49687 db5sch101101633:https ESTABLISHED TCP 192.168.1.69:49969 Chromecast:8009 ESTABLISHED TCP 192.168.1.69:49973 wl-in-f188:5228 ESTABLISHED TCP 192.168.1.69:49974 Chromecast:8009 ESTABLISHED TCP 192.168.1.69:49976 wl-in-f188:5228 ESTABLISHED TCP 192.168.1.69:50016 db5sch101101001:https ESTABLISHED TCP 192.168.1.69:50244 FUJITSU-E720:3483 ESTABLISHED TCP 192.168.1.69:50259 a23-55-155-27:http CLOSE_WAIT TCP 192.168.1.69:50266 157.55.235.143:40024 CLOSE_WAIT TCP 192.168.1.69:50275 91.190.218.54:12350 CLOSE_WAIT TCP 192.168.1.69:50276 198.41.214.185:http CLOSE_WAIT TCP 192.168.1.69:50282 wm-in-f125:5222 ESTABLISHED TCP 192.168.1.69:50283 lhr25s02-in-f10:https CLOSE_WAIT TCP 192.168.1.69:50285 lhr25s02-in-f10:https CLOSE_WAIT TCP 192.168.1.69:50360 lhr25s02-in-f10:https CLOSE_WAIT TCP 192.168.1.69:50361 lhr25s02-in-f10:https CLOSE_WAIT TCP 192.168.1.69:52131 lhr35s04-in-f10:https CLOSE_WAIT TCP 192.168.1.69:52132 lhr35s04-in-f45:https CLOSE_WAIT TCP 192.168.1.69:52281 192.30.253.125:https ESTABLISHED TCP 192.168.1.69:52605 gha:http ESTABLISHED TCP 192.168.1.69:52738 Chromecast:8008 TIME_WAIT TCP 192.168.1.69:52744 Chromecast:8008 ESTABLISHED TCP 192.168.1.69:52795 lhr26s05-in-f14:https TIME_WAIT TCP 192.168.1.69:52800 santander:https ESTABLISHED TCP 192.168.1.69:52813 lhr35s04-in-f46:https ESTABLISHED TCP 192.168.1.69:52814 lhr35s01-in-f10:https ESTABLISHED TCP 192.168.1.69:52816 lhr25s13-in-f14:https ESTABLISHED TCP 192.168.1.69:52818 a-0001:https ESTABLISHED TCP 192.168.1.69:52819 a-0001:https ESTABLISHED TCP 192.168.1.69:52823 lhr25s10-in-f3:https ESTABLISHED TCP 192.168.1.69:52825 13.81.59.242:https TIME_WAIT TCP 192.168.1.69:52829 a104-103-122-80:https ESTABLISHED TCP 192.168.1.69:52830 a104-103-122-80:https ESTABLISHED TCP 192.168.1.69:52831 2.17.150.124:https ESTABLISHED TCP 192.168.1.69:52832 2.17.150.124:https ESTABLISHED TCP 192.168.1.69:52834 lhr26s05-in-f5:https ESTABLISHED

C:\WINDOWS\system32>`

sbarnoud commented 7 years ago

Hi,

I have exactly the same issue. No way to open a server socket on Ubuntu 16.04 (WSL build 15063): -) netstat doesn't show anything -) nc -4 -l localhost 12345: strace shows that the bind and listen succeed -) but the socket is NOT listening -) netstat (under windows) confirms that -) after a CtrlC to stop nc, accept accept returns ERESTARTSYS (in the strace), which means that the accept was (for ubuntu point of view) successfully listening, just interrupted by the CtrlC.

=> i tried to disable the firewall, etc etc: no way.

Regards,

Sébastien,

sbarnoud commented 7 years ago

I would like to tell that on another box, with every thing in the same version (Windows, Ubuntu), it works ... We tried to re-install WSL on the non-working box, but it stills the same.