Score:1

apt-get update not working in Ubuntu 20.04 WSL1

bt flag

So I recently installed Ubuntu WSL1 in my company PC and ran this command to update my installation, It seems ping is successful but "apt-get" fails to connect and download. I need some help here to trouble shoot this

sudo apt-get update

I'm getting the following error:

Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Could not connect to security.ubuntu.com:80 (2001:67c:1562::18). - connect (111: Connection refused) 
  Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Could not connect to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (111: Connection refused)


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Could not connect to security.ubuntu.com:80 (2001:67c:1562::18). - connect (111: Connection refused) 

W: Some index files failed to download. They have been ignored, or old ones used instead.

I tried to ping archive.ubuntu.com and it is showing me it's successful. but the apt-get update does not work ?

 ping archive.ubuntu.com
--- archive.ubuntu.com ping statistics ---
13 packets transmitted, 13 received, 0% packet loss, time 12010ms
rtt min/avg/max/mdev = 220.761/221.066/221.704/0.251 ms
Artur Meinild avatar
vn flag
It seems that somehow the DNS only looks up IPv6, which might be the problem ..
rishabhk28 avatar
bt flag
I also tried running this command to force apt to use IPv4 addresses, but it still does not work! ```apt-get update -o Acquire::ForceIPv4=true
NotTheDr01ds avatar
vn flag
Welcome to Ask Ubuntu! Try a `nslookup archive.ubuntu.com` - Are you able to ping the v4 addresses?
rishabhk28 avatar
bt flag
I think I'm able to ping the v4 addresses, Server: 10.88.80.151 Address: 10.88.80.151#53 Non-authoritative answer: Name: archive.ubuntu.com Address: 185.125.190.39 Name: archive.ubuntu.com Address: 185.125.190.36 Name: archive.ubuntu.com Address: 91.189.91.39 Name: archive.ubuntu.com Address: 91.189.91.38 Name: archive.ubuntu.com Address: 2001:67c:1562::15 Name: archive.ubuntu.com Address: 2620:2d:4000:1::19 Name: archive.ubuntu.com Address: 2620:2d:4000:1::16 Name: archive.ubuntu.com Address: 2001:67c:1562::18
Score:0
bt flag

I think I solved my issues, I found out that the default apt archives links were "http" based which my network was blocking so I went to https://launchpad.net/ubuntu/+archivemirrors to look for https supported mirror links. I chose https://mirror.enzu.com/ubuntu/

I replaced http://archive.ubuntu.com and http://security.ubuntu.com with https://mirror.enzu.com/ubuntu/ in /etc/apt/sources.list

Now I'm able to sudo apt-get update and upgrade.

Thanks to everyone for your support.

Score:0
in flag

I believe I had the same problem a while ago.

I wasn't able to ascertain why this was happening, but the solution I was recommended was this:

  1. Make a backup of /etc/apt/sources.list

  2. inside that file, replace the string archive.ubuntu.com with si.archive.ubuntu.com (I use "si" to download from slovenian archive - find a mirror closest to you)

  3. Run apt-get update

rishabhk28 avatar
bt flag
Thanks for your answer! changing to a https based mirror link worked for me, I chose https://mirror.enzu.com/ubuntu/ BTW
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.