Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No connectivity from Bash to internet? #5

Closed
robertsmieja opened this issue Apr 7, 2016 · 214 comments
Closed

No connectivity from Bash to internet? #5

robertsmieja opened this issue Apr 7, 2016 · 214 comments

Comments

@robertsmieja
Copy link

Running apt-get update returns the following:

root@localhost:~# apt-get update
Err http://archive.ubuntu.com trusty InRelease

Err http://archive.ubuntu.com trusty-updates InRelease

Err http://security.ubuntu.com trusty-security InRelease

Err http://archive.ubuntu.com trusty Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'security.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.
root@localhost:~#

Running curl also doesn't seem to work:

root@localhost:~# curl www.microsoft.com
curl: (6) Could not resolve host: www.microsoft.com

I'm running Bash as an Admin.

My Windows 10 Pro Insider Preview Build Number:
Build 14316.rs1_release.160402-2217

@russalex
Copy link
Contributor

russalex commented Apr 7, 2016

Thank you for reporting. This is probably your /etc/resolv.conf file not being generated correctly. Any chance you can take a look at it's contents and compare the DNS servers with ipconfig /all at the cmd prompt?

Also, a couple of questions:

  1. What is your network connection (wifi / wired)?
  2. Are you on a VPN?

If you're on wifi, can you try and switch to a different network and back? If not, try uninstalling through "lxrun /uninstall" and reinstall in Bash.

Let me know if any of the above work. I will also be writing a bug on our side for this.

@robertsmieja
Copy link
Author

I'm on a Wired Connection, without VPN. I do have an IPv6 enabled router/modem, and am using NAT.

vi /etc/resolv.conf results in the following:

nameserver 2601:19c:4500:5e6b::1
nameserver 192.168.1.1

ipconfig /all results in the following (I snipped a bit, let me know if there's something I left out):

...
Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   Physical Address. . . . . . . . . : 50-E5-49-C0-2E-8D
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5d3f:33a2:3c2a:b36%6(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.120(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Wednesday, April 06, 2016 9:32:39 PM
   Lease Expires . . . . . . . . . . : Thursday, April 07, 2016 9:32:40 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 38856009
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1E-62-CD-F4-50-E5-49-C0-2E-8D
   DNS Servers . . . . . . . . . . . : 2601:19c:4500:5e6b::1
                                       192.168.1.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
...

Running the following didn't result in any changes:

lxrun /uninstall /full
bash
curl www.microsoft.com

One more "fun" thing to report, here's the output from nslookup www.microsoft.com :

C:\Users\Robert>bash
root@localhost:/mnt/c/Users/Robert# nslookup www.microsoft.com
socket.c:2447: setsockopt(20, SO_TIMESTAMP) failed: Invalid argument
socket.c:2476: setsockopt(20, IPV6_RECVPKTINFO) failed: Invalid argument
socket.c:1915: internal_send: 2601:19c:4500:5e6b::1#53: Invalid argument
socket.c:2447: setsockopt(21, SO_TIMESTAMP) failed: Invalid argument
socket.c:1915: internal_send: 192.168.1.1#53: Invalid argument
socket.c:1915: internal_send: 2601:19c:4500:5e6b::1#53: Invalid argument
socket.c:1915: internal_send: 192.168.1.1#53: Invalid argument
socket.c:1915: internal_send: 2601:19c:4500:5e6b::1#53: Invalid argument
socket.c:1915: internal_send: 192.168.1.1#53: Invalid argument
;; connection timed out; no servers could be reached

@russalex
Copy link
Contributor

russalex commented Apr 7, 2016

Thanks. Sending this off to the dev team to take a look.

@russalex
Copy link
Contributor

russalex commented Apr 7, 2016

@robertsmieja. one more question. Any chance you can send me the rest of your ipconfig /all? If you don't want to post feel free to DM it to @richturn_ms. Just tell him it's for me.

@robertsmieja
Copy link
Author

Here's the rest. I think the only identifiable info in it is my MAC address which I already shared. Whoops.

C:\Users\Robert>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : RSMIEJA-PC
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   Physical Address. . . . . . . . . : 50-E5-49-C0-2E-8D
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5d3f:33a2:3c2a:b36%6(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.120(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Wednesday, April 06, 2016 9:32:39 PM
   Lease Expires . . . . . . . . . . : Thursday, April 07, 2016 9:32:39 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 38856009
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1E-62-CD-F4-50-E5-49-C0-2E-8D
   DNS Servers . . . . . . . . . . . : 2601:19c:4500:5e6b::1
                                       192.168.1.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fb:3846:24b0:b6bb:bdbb(Preferred)
   Link-local IPv6 Address . . . . . : fe80::3846:24b0:b6bb:bdbb%11(Preferred)
   Default Gateway . . . . . . . . . : ::
   DHCPv6 IAID . . . . . . . . . . . : 117440512
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1E-62-CD-F4-50-E5-49-C0-2E-8D
   NetBIOS over Tcpip. . . . . . . . : Disabled

Tunnel adapter isatap.{728EBB16-D2DC-480E-B2FB-9E90BC0AC5D9}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

@jokeyrhyme
Copy link

Out-of-the-box I had apt-get update etc working just fine on my machine. No VPN, no wireless, ethernet hardline, but I do have the Hyper-V and VirtualBox virtual bridging interfaces.

@robertsmieja
Copy link
Author

Well if I had to take a guess, there's an error creating a socket so I have 0 network connectivity. It could be a "driver" issue where the Ubuntu distro doesn't have the driver for my network card, or something to that effect.

What's suspicious is that it's complaining about "invalid argument" for the setsockopt function call in socket.c, where the call "setsockopt(20, SO_TIMEOUT)" appears to be missing one argument, according to documentation: http://man7.org/linux/man-pages/man7/socket.7.html


Here's the ifconfig and ll /proc/net/ output, which may be useful:

root@localhost:~# ifconfig
Warning: cannot open /proc/net/dev (No such file or directory). Limited output.
root@localhost:/proc/net# ll /proc/net
total 0
dr-xr-xr-x 1 root root 0 Apr  7 06:37 ./
dr-xr-xr-x 1 root root 0 Apr  7 06:37 ../
-r--r--r-- 1 root root 0 Apr  7 06:37 if_inet6
-r--r--r-- 1 root root 0 Apr  7 06:37 netlink
-r--r--r-- 1 root root 0 Apr  7 06:37 tcp
-r--r--r-- 1 root root 0 Apr  7 06:37 tcp6
-r--r--r-- 1 root root 0 Apr  7 06:37 udp
-r--r--r-- 1 root root 0 Apr  7 06:37 udp6
dr-xr-xr-x 1 root root 0 Apr  7 06:37 xt_qtaguid/

@jernejs
Copy link

jernejs commented Apr 7, 2016

I have the same problem if I leave the ipv6 nameserver first in /etc/resolv.conf. Removing (or moving it to the last line) makes resolving work for me.

@jokeyrhyme
Copy link

@jernejs good call. My working scenario is IPv4-only, without any IPv6 internet connectivity.

@jacqinthebox
Copy link

Same problem here, no internet connectivity.

root@localhost:/# ifconfig
Warning: cannot open /proc/net/dev (No such file or directory). Limited output.

Here I'm pinging my gateway:

root@localhost:/# ping 192.168.2.254
ping: icmp open socket: Socket type not supported

I'm on a wired internet connection and disabled the Hyper-V bridge just in case. No VPN.

Here I'm trying to reset the network:

root@localhost:/# service networking restart
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
 * Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces
 * Reconfiguring network interfaces...
ifdown: failed to open lockfile /run/network/.ifstate.lock: No such file or directory
ifup: failed to open lockfile /run/network/ifstate.lo: No such file or directory

And for the record, I run Ubuntu as well on this machine (dual boot) and it never has problems recognizing my network interface card.

Any suggestions? I'm so happy with this feature. :)

@pallatee
Copy link

pallatee commented Apr 7, 2016

I have same symptoms as @jacqinthebox but I am able to install packages with apt and access internet with links

@gdude2002
Copy link

I got networking working on mine by disabling my AV's firewall. That won't fix all networking applications, but it'll get apt-get working.

@jamesscholeyweb
Copy link

I can also confirm that disabling firewall in Bitdefender solved this for me. I tried also with allowing bash.exe through but didn't work so i'm assuming some other services need to be allowed through firewall. So for now have it disabled and using windows firewall and everything ok.

@gdude2002
Copy link

Images from BfW seem to be completely separate from normal Windows processes. They do exist, and they don't show up in the task manager, but you can see them in the resource monitor.

For example, in the below screenshot, you can see an image named http, which shows up when I run apt-get update.


Even more curious:

root@localhost:/mnt/c/Users/-gdude2002# http
The program 'http' is currently not installed. You can install it by typing:
apt-get install httpie

@thanosk
Copy link

thanosk commented Apr 7, 2016

I am running Win10 build 14316 inside VMWare on Ubuntu 15.10 host OS. VMWare networking is configured as Bridged for Win10 guest OS. LAN situation on this PC is ethernet-based.

MS Bash did not correctly generate /etc/resolv.conf, it was totally empty. I had to add a simple nameserver 192.168.1.254 (my home router) in order to get it working. I'm also attaching the output from ipconfig /all (with snipped MAC address) if that helps.
ipconfig-output.txt

@gdude2002
Copy link

Oh, right, I should point out that I'm running bare metal here.

@jacqinthebox
Copy link

Thanks @thanosk, I can confirm apt-get update is working now as well now after adding the nameserver to /etc/resolv.conf.

The regular Linux network troubleshooting commands I tried result in rather cryptic output in this enviroment, so I was on the wrong track thinking it was a hardware problem.

@jolibert
Copy link

jolibert commented Apr 7, 2016

Same problem here, running on native hardware (thanks thanosk for the vmware users but that did not work here).
Using a "Killer e2200 ethernet" interface, popular amongs gamers. Already had complications with it
and windows.

Nice to see that project btw, will be glad to participate more.

@gdude2002
Copy link

@jolibert Does apt-get update work for you, or does it hang?

@jolibert
Copy link

jolibert commented Apr 7, 2016

My bad, it works with update. Thank you,
cat > /etc/resolv.confseems the solution.

@gdude2002
Copy link

@jolibert It seems that only certain types of sockets are working at the moment, that's why I asked. No ping yet, unfortunately. apt-get seems to be working properly though.

@jolibert
Copy link

jolibert commented Apr 7, 2016

@gdude2002 Linux reflex, if no icmp (or ping) then all is wrong. Thank you.

@ghost
Copy link

ghost commented Apr 7, 2016

Same here, no connection to archive.ubuntu.com. Had to remove fritz.box and some 10.xxx.xxx.xxx entries from resolv.conf to make it work.

@gdude2002
Copy link

@poddr Did you try the suggestions in the rest of this issue?

@ghost
Copy link

ghost commented Apr 7, 2016

Yes, and worked for me.

@Aneurin
Copy link

Aneurin commented Apr 7, 2016

So I spent ages investigating this by looking in what turned out to be the wrong direction. DNS lookups using the default BIND tools don't work regardless of the DNS server used. For example:

root@localhost:~# dig archive.ubuntu.com @8.8.8.8
socket.c:2447: setsockopt(20, SO_TIMESTAMP) failed: Invalid argument
socket.c:1915: internal_send: 8.8.8.8#53: Invalid argument
socket.c:1915: internal_send: 8.8.8.8#53: Invalid argument
socket.c:1915: internal_send: 8.8.8.8#53: Invalid argument

Forcing TCP gives a slightly different error:

root@localhost:~# dig +tcp archive.ubuntu.com @8.8.8.8
socket.c:1915: internal_send: 8.8.8.8#53: Invalid argument
;; communications error to 8.8.8.8#53: end of file

So at first this seemed like DNS connections simply wouldn't work at all, even when specifying a known-good DNS server.

But! I eventually noticed that adding the address of my local DNS server to /etc/resolv.conf did work - in the sense that DNS lookups in applications (presumably using the glibc stub resover) would succeed, but BIND tools like host and dig still don't. It took me a while to realise this given that my usual diagnostic tools for DNS issues are the things that are in fact broken.

I did try to investigate a little further, but I didn't get very far. I doubt this is illuminating, but just in case:

root@localhost:~# strace -e trace=network dig -4 +tcp archive.ubuntu.com @8.8.8.8
strace: Test for PTRACE_O_TRACESYSGOOD failed, giving up using this feature.
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
getsockname(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
socket(PF_LOCAL, SOCK_STREAM, 0) = 3
socket.c:1915: internal_send: 8.8.8.8#53: Invalid argument
;; communications error to 8.8.8.8#53: end of file
--- SIGTERM {si_signo=SIGTERM, si_code=SI_TKILL, si_pid=1081, si_uid=0} ---
strace: ptrace(PTRACE_SYSCALL,pid:1081,sig:15): Invalid argument
Process 1081 detached

The thing that's confusing me is that AFAICT socket.c:1915 is only reachable as a result of "sendmsg(sock->fd, &msghdr, 0);", if it returns an error - but the strace doesn't show sendmsg being called at all, so I'm not sure what's going on.

Anyway, I'm moving on now, because it turns out there are alternatives: apt-get install knot-dnsutils knot-host replaces the BIND utils with the Knot DNS ones that work.

@robertsmieja
Copy link
Author

Last night I tried editing the /etc/resolv.conf but all of my changes were reverted, didn't take effect, or had no impact.

Today I was able to run the following without any error or Windows updates :

lxrun /uninstall /full
bash
curl www.microsoft.com

I'm confident that this issue is now fixed and can be closed.

EDIT: Nevermind, it just broke. I have no idea why it worked temporarily. More interesting output:

root@localhost:/mnt/c/Users/Robert# ping 192.168.1.1
ping: icmp open socket: Socket type not supported

@Gingernaut
Copy link

I'm also running into the same issue on build 14316, bash is unable to do any commands that use the internet: curl, git clone, apt-get, etc. I allowed bash through my Bitdefender firewall but that hasn't solved it yet either.

@gdude2002
Copy link

@Gingernaut Allowing bash through the firewall is not good enough, you need to disable it entirely. The bash launcher is not the process that deals with networking, but nobody knows what exactly to allow at the moment.

@ArnieBerg
Copy link

I resolved this by shutting down my VPN.

@rooom13
Copy link

rooom13 commented Mar 13, 2020

This happened suddenly, I just removed /etc/resolv.conf rebooted and let it regenerate the file, this makes sure you are not hardcoding your DNS server for easing further troubleshooting and keeping installation as close to defaults as possible. Most people want the DNS to follow in WSL if you decide to tether internet via phone, use VPN provider etc.

This worked for me on March 2020

@Macmee Macmee mentioned this issue Aug 22, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests