WSL icon indicating copy to clipboard operation
WSL copied to clipboard

apt-get update and install failing

Open sam-castaneda opened this issue 9 years ago • 29 comments

When running sudo apt-get update, I'm getting the following errors:

.
.
.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/restricted/binary-amd64/Packages  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::21). - connect (13: Permission denied) [IP: 2001:67c:1360:8001::21 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/universe/binary-amd64/Packages  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::21). - connect (13: Permission denied) [IP: 2001:67c:1360:8001::21 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/multiverse/binary-amd64/Packages  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::21). - connect (13: Permission denied) [IP: 2001:67c:1360:8001::21 80]

These are just the last 3. I am able to ssh to other servers and I can also ping www.google.com for example. But every time I try to install something with apt-get or update, I get the error:

connect (13: Permission denied) [IP: 2001:67c:1360:8001::21 80]

Let me know if you need any more info.

output of running sudo strace -o strace-apt-get.txt apt-get update http://termbin.com/of0c

Windows 10 Pro Version 1607 OS Build: 14393.693

Thanks for any help.

sam-castaneda avatar Feb 23 '17 15:02 sam-castaneda

Thanks for reporting the issue, but I'm not seeing any hits of EACCES in the strace. Can you please recollect with -f (e.g. sudo strace -f -s 256 -v -o strace-apt-get.txt apt-get update)?

Haven't seen this before, but there are a number of unknown network issues in 14393 that have been fixed for insider builds.

stehufntdev avatar Feb 23 '17 16:02 stehufntdev

Here's the output for that command http://termbin.com/6pxh

I still see output of apt-get on my screen. Let me know if you'd like me to send that over as well.

sam-castaneda avatar Feb 23 '17 17:02 sam-castaneda

Could you please double check the strace file? It looks like it may have been truncated since it doesn't end cleanly and there aren't any hits for connect or EACCES.

stehufntdev avatar Feb 23 '17 17:02 stehufntdev

Apologies for rudely jumping in -- @sam-castaneda , could you try the following command?: ping6 www.google.com Or, better, open up a Web browser in Windows and try to navigate to http://ipv6.google.com/.

Apt uses IPv6 if it thinks it's available. ping uses IPv4. I've seen this issue a bunch of times on real Ubuntu systems, caused by a machine being assigned a routable IPv6 address but not being able to actually access the Internet via IPv6.

(If that's not the issue, apologies for the interrupt; please carry on with @stehufntdev 's request for strace info.)

aseering avatar Feb 23 '17 18:02 aseering

Both ping and attempting to navigate to http://ipv6.google.com/ in chrome fails. Here's the output from the ping:

scastaneda@SCASTANEDA-LT:/mnt/c/accesso/projects/cePay$ ping6 www.google.com
WARNING: your kernel is veeery old. No problems.
setsockopt(RAW_CHECKSUM) failed - try to continue.setsockopt(ICMP6_FILTER): Invalid argument

Chrome said this:

This site can’t be reached

ipv6.google.com’s server DNS address could not be found.
Did you mean http://google.com/ipv6?
Search Google for ipv6 google
ERR_NAME_NOT_RESOLVED

sam-castaneda avatar Feb 23 '17 18:02 sam-castaneda

@aseering What's the best approach of fixing this? Do I somehow tell apt-get not to use IPv6 any more, or do I fix the access to the internet via IPv6?

sam-castaneda avatar Feb 23 '17 19:02 sam-castaneda

So I tried the recommendation from this stack exchange thread, and ran:

sudo apt-get -o Acquire::ForceIPv4=true update

with the same result.

Also I noticed that in both cases before the apt-get runs I am seeing this message:

sudo: unable to resolve host SCASTANEDA-LT

@stehufntdev it looks like the file is too big and was truncated. Is the bottom part the most important? I could tail the last xk lines and bin that, or I could grep for something specific that you are looking for?

sam-castaneda avatar Feb 23 '17 19:02 sam-castaneda

Here's a grep for EACCES on that file: http://termbin.com/o55w

sam-castaneda avatar Feb 23 '17 19:02 sam-castaneda

Is anyone still looking into this?

sam-castaneda avatar Feb 28 '17 18:02 sam-castaneda

Sorry for the delay. There wasn't anything interesting in the strace for EACCESS.

Following up on the @aseering comment, can you try ping (not ping6) from WSL? The output above shows ping6, but he was asking for ping to compare ipv4 vs ipv6.

stehufntdev avatar Feb 28 '17 19:02 stehufntdev

Here's the output for ping (with "run as administrator"):

scastaneda@SCASTANEDA-LT:/mnt/c/Windows/System32$ ping www.google.com
PING www.google.com (74.125.21.103) 56(84) bytes of data.
64 bytes from yv-in-f103.1e100.net (74.125.21.103): icmp_seq=1 ttl=43 time=22.5 ms
64 bytes from yv-in-f103.1e100.net (74.125.21.103): icmp_seq=2 ttl=43 time=21.3 ms
64 bytes from yv-in-f103.1e100.net (74.125.21.103): icmp_seq=3 ttl=43 time=21.1 ms
^C
--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 21.191/21.712/22.571/0.634 ms

One thing that I found interesting is that if I start cmd.exe without "run as administrator", ping will give the following from WSL:

Z:\>bash
scastaneda@SCASTANEDA-LT:~$ ping www.google.com
ping: icmp open socket: Permission denied

sam-castaneda avatar Feb 28 '17 20:02 sam-castaneda

Thanks for the follow-up. The fact that ipv4 works but ipv6 doesn't, seems to line up with the issue @aseering mentioned.

Yes, in the Anniversary update ping requires admin but that has been resolved for insider builds.

stehufntdev avatar Feb 28 '17 20:02 stehufntdev

Ok, so what is the suggested workaround/fix? As I've mentioned before, I've tried running: sudo apt-get -o Acquire::ForceIPv4=true update which was a suggestion in a stachexchange and the result is the same.

sam-castaneda avatar Feb 28 '17 20:02 sam-castaneda

Hm... Well, one suggestion would be to either fix or disable IPv6 on the Windows side. Make sure that you either have a working IPv6 address, or no IPv6 address at all. You might want to bring this up with your IT folks, if this is a work network, because it sounds like your network is misconfigured in a way that is actively breaking software. (If your network does not support IPv6, the correct behavior would be for it to stop provisioning IPv6 addresses.)

If that's not an option, though, then the flag that you're setting really ought to work... Can you confirm that the error that you're seeing in that case is exactly the same as what you're seeing without the IPv4 flag, including that the IP addresses in the error mesaage is an IPv6 address? If so, I'm afraid this is not a failure mode that I've personally seen... That flag is handled by apt-get, and WSL is using the stock Ubuntu apt-get, so you might want to try asking on one of the various Ubuntu forum sites out there.

aseering avatar Mar 01 '17 00:03 aseering

Here's the output of running: sudo apt-get -o Acquire::ForceIPv4=true update http://termbin.com/11vj

It looks like it is using IPv4. I can ping archive.ubuntu.com just fine as well...

scastaneda@SCASTANEDA-LT:~$ ping archive.ubuntu.com
PING archive.ubuntu.com (91.189.88.152) 56(84) bytes of data.
64 bytes from steelix.canonical.com (91.189.88.152): icmp_seq=1 ttl=48 time=116 ms
64 bytes from steelix.canonical.com (91.189.88.152): icmp_seq=2 ttl=48 time=116 ms
64 bytes from steelix.canonical.com (91.189.88.152): icmp_seq=3 ttl=48 time=116 ms
64 bytes from steelix.canonical.com (91.189.88.152): icmp_seq=4 ttl=48 time=118 ms
64 bytes from steelix.canonical.com (91.189.88.152): icmp_seq=5 ttl=48 time=115 ms
^C
--- archive.ubuntu.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 115.987/116.965/118.065/0.789 ms

If there's nothing else here, then I'll check with the forums @ ubuntu.

Thanks for the help.

sam-castaneda avatar Mar 01 '17 18:03 sam-castaneda

Interesting -- that's definitely not the IPv6 issue; the new log file has IPv4 addresses.

Just out of curiosity, can you do curl http://archive.ubuntu.com/? Does it fail similarly? If so could you strace it? Curl does much less so there should be less to sift through.

aseering avatar Mar 01 '17 22:03 aseering

Looks like that failed as well:

scastaneda@SCASTANEDA-LT:~$ strace -o curl.out curl http://archive.ubuntu.com/
curl: (7) Couldn't connect to server

scastaneda@SCASTANEDA-LT:~$ cat curl.out | nc termbin.com 9999

http://termbin.com/xx5p

sam-castaneda avatar Mar 01 '17 23:03 sam-castaneda

@sam-castaneda - Thanks for the trace. Your traces are filled with errors of the form:

connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("91.189.88.152")}, 16) = -1 EACCES (Permission denied)

Your symptoms seem to match #761 (and the logs). Do you have an AV software installed? If so, can you try disabling them and see if any progress is made?

sunilmut avatar Mar 02 '17 00:03 sunilmut

@sunilmut I do have Kaspersky (Endpoint Security 10 for Windows) installed. I can see in the settings that the firewall is turned on. Unfortunately, this is a work PC and I am unable to turn it off myself, even through the Task Manager I am getting permission denied.

I will get with IT to see if they can turn it off temporarily.

I'm not sure if this is completely relevant, but I do have a VirtualBox with Ubuntu running, which has a NAT network connection, and I am able to run sudo apt-get update/install just fine.

I'm guessing that it's probably not a firewall, but an application monitoring of some sort.

sam-castaneda avatar Mar 02 '17 14:03 sam-castaneda

@sam-castaneda -- what version of Kaspersky do you have installed?

You might want to read this comment and the two immediately following it:

https://github.com/Microsoft/BashOnWindows/issues/475#issuecomment-246079109

aseering avatar Mar 02 '17 15:03 aseering