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

Updates don't work on WSL2 #5061

Closed
Mystic8b opened this issue Apr 8, 2020 · 87 comments
Closed

Updates don't work on WSL2 #5061

Mystic8b opened this issue Apr 8, 2020 · 87 comments
Labels

Comments

@Mystic8b
Copy link

Mystic8b commented Apr 8, 2020

Hi guys!
After changing the version of WSL:

PS C:\WINDOWS\system32> wsl --set-version Ubuntu 2

Apt update doesn't work for me (and I waited for the execution of this command for about half an hour, why so long?...):

mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ sudo apt update
[sudo] password for mystic:
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Connection failed [IP: 91.189.88.142 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Connection failed [IP: 91.189.88.142 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Connection failed [IP: 91.189.88.142 80]
Ign:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Ign:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Ign:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Err:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
  Connection failed [IP: 91.189.88.142 80]
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Connection failed [IP: 91.189.88.142
 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Connection failed [IP: 91.189.88.1
42 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Connection failed [IP: 91.189.88.1
42 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/universe/binary-amd64/Packages  Connection failed [IP:
91.189.88.142 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

And release upgrade too:

mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ sudo do-release-upgrade
[sudo] password for mystic:
Checking for a new Ubuntu release
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release
set Prompt=normal in /etc/update-manager/release-upgrades.

In this case, everything responds:

mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ ping security.ubuntu.com
PING security.ubuntu.com (91.189.88.142) 56(84) bytes of data.
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=1 ttl=56 time=54.2 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=2 ttl=56 time=54.3 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=3 ttl=56 time=54.2 ms
^C
--- security.ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 54.289/54.329/54.399/0.049 ms
mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ ping archive.ubuntu.com
PING archive.ubuntu.com (91.189.88.142) 56(84) bytes of data.
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=1 ttl=56 time=54.2 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=2 ttl=56 time=54.2 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=3 ttl=56 time=54.3 ms
^C
--- archive.ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 54.233/54.266/54.318/0.037 ms

After the rollback (wsl --set-version Ubuntu 1), there is no problem:

mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ sudo apt update
[sudo] password for mystic:
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [691 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [221 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [33.8 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [8804 B]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [657 kB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [218 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [7176 B]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2764 B]
Get:14 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [913 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [314 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [43.5 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [10.9 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1065 kB]
Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [330 kB]
Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [10.8 kB]
Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [4728 B]
Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2512 B]
Get:26 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [1644 B]
Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4020 B]
Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1900 B]
Fetched 18.6 MB in 15s (1255 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
28 packages can be upgraded. Run 'apt list --upgradable' to see them.

My system:

C:\Users\Mystic>ver
Microsoft Windows [Version 10.0.19041.172]

Internet connected via PPTP client. And as you can see, the internet works on PC and on WSL. But the updates for some reason do not work ...
I freaked out and reinstalled WSL completely, but it gave me nothing.

@dhikrahashim
Copy link

Same issue for me also. Just installed ubuntu 18.04. not able to update

@Mystic8b
Copy link
Author

Mystic8b commented May 9, 2020

The problem is resolved after reinstalling on ubuntu 20.04. Winver 19041.208

@dhikrahashim
Copy link

okay

@rromanv
Copy link

rromanv commented May 21, 2020

I have the same issue with Windows 19041.264

@rromanv
Copy link

rromanv commented May 21, 2020

If I revert back to WSL 1 everything works, just WSL 2 doesn't connect

@Mystic8b
Copy link
Author

If I revert back to WSL 1 everything works, just WSL 2 doesn't connect

image
Strange, everything works for me on the same build

@rromanv
Copy link

rromanv commented May 21, 2020

If I revert back to WSL 1 everything works, just WSL 2 doesn't connect

image
Strange, everything works for me on the same build

wsl2 internet error

For me still, an issue, look at the powershell window, just error when I enabled wsl2

@onomatopellan
Copy link

@rromanv Try something like ping 216.58.192.164. Does it work?

@rromanv
Copy link

rromanv commented May 21, 2020

@rromanv Try something like ping 216.58.192.164. Does it work?

This works, that mean I have issues with DNS resolving?

@rromanv
Copy link

rromanv commented May 21, 2020

I followed up this, but instead of Google DNS I pointed to my company DNS (I need resolve of internal services/servers)
https://github.com/microsoft/WSL/issues/4285#issuecomment-522201021

@onomatopellan
Copy link

Yes, that looks like DNS problem. You can see plenty of threads with similar issues but not an universal solution.

@fle108
Copy link

fle108 commented Jun 19, 2020

i have the same issue when i'm connected over WiFi however i noticed that when i'm connected over ethernet it works well. i think issue is related to sharing network process between network cards over Hyper-v engine. WSL2 is not an emulation anymore but a specific hyper-v virtual machine that uses same network connexions that an hyper-v vm to connect (like virtual switch)...

@Mystic8b Mystic8b changed the title Updates do not work on WSL2 Updates don't work on WSL2 Jul 1, 2020
@markav2
Copy link

markav2 commented Jul 4, 2020

I turned off my VPN and I did not have an issue updating.

@JayParikh20
Copy link

Tried everything, still can't get it to work. It works in WSL 1 but not 2.

@whit-wu
Copy link

whit-wu commented Aug 17, 2020

Turning off my VPN fixed the issue for me as well.

@luizwhite
Copy link

luizwhite commented Sep 7, 2020

Tried everything, still can't get it to work. It works in WSL 1 but not 2.

Same..
Also tried to update my network driver, and to reinstall WSL, but nothings changes:

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Connection failed [IP: 91.189.88.142 80]
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Connection failed [IP: 91.189.88.142 80]
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Connection failed [IP: 91.189.88.142 80]
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Connection failed [IP: 91.189.88.142 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Connection failed [IP: 91.189.88.142 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Connection failed [IP: 91.189.88.142 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

But, if i try to connect over Ethernet, or through my phone's wifi (routing), it works
I'm not an advanced user, but I did everything right, it just dont work..

I guess these three are related
#5867 #5831

@luizwhite
Copy link

It magically worked after this

@mazharmahadik
Copy link

I had Same problem with WSL2 , ubuntu distro. Basically you are not able to reach ubuntu servers on TCP connection.
& that is why Ping & DNS resolution is working.
Solution - Please check your Endpoint protection/Anti-virus agent/Windows Firewall. Try to disable them & then give a try.
It worked for me.
Later you can make permanent security exception for your wsl ubuntu.
Now i am on wireless connection, my VPN connected, Security exception made on symantec protection, & still i can update all packages.
HTH

@P1100
Copy link

P1100 commented Oct 11, 2020

Turning off public network firewall solved it temporarily. Making the following firewall rule, in powershell, solved it completely:

New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow

@luizwhite
Copy link

Turning off public network firewall solved it temporarily. Making the following firewall rule, in powershell, solved it completely:

New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow

Not a PS expert here..
What exactly this code is doing?

@P1100
Copy link

P1100 commented Oct 15, 2020

Turning off public network firewall solved it temporarily. Making the following firewall rule, in powershell, solved it completely:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow

Not a PS expert here..
What exactly this code is doing?

Makes a new windows firewall rule that allows the standard WSL interface to receive inbound packets (=> internet connection). Copy and paste it in the PowerShell admin console, after if you open Windows Firewall you will see the new created rule

@luizwhite
Copy link

@P1100 The rule didnt work for me..
Same issue..
Actually i have Bitdefender and I also tried to disable the firewall, but nothing changes..

The only thing that works until now is run sudo ifconfig eth0 mtu 1350 command everytime i start my WSL, and the internet magically start working:

terminal evidence
❯ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 https://dl.yarnpkg.com/debian stable InRelease
Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease
  Connection failed [IP: 91.189.91.39 80]
Err:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Connection failed [IP: 91.189.88.152 80]
Err:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Connection failed [IP: 91.189.88.152 80]
Reading package lists... Done
Building dependency tree
Reading state information... Done
61 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Connection failed [IP: 91.189.91.39 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
❯ sudo ifconfig eth0 mtu 1350
❯ sudo apt update
Hit:1 https://dl.yarnpkg.com/debian stable InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [338 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [4992 B]
Get:7 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [507 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/universe Translation-en [63.4 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [8500 B]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [610 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [10.3 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [669 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [12.0 kB]
Fetched 2540 kB in 2s (1144 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
63 packages can be upgraded. Run 'apt list --upgradable' to see them.

@vineettalwar
Copy link

vineettalwar commented Oct 24, 2020

#5061 (comment) -> Solution is working for me.
on windows defender Widnows 10 Pro 2004

@rasert
Copy link

rasert commented Nov 10, 2020

I can't update too.

@duaneking
Copy link

duaneking commented Apr 6, 2022

Running a brand new install of windows 11 with focal on wsl2 I ran into this issue.

I tried to:

  1. update /etc/resolve.conf to use 8.8.8.8 -> Commonly reported above but honestly should not be an issue on my network so it was done in desperation. Did not work on its own.

  2. turn off Malwarebytes completely (not just disabled, QUIT it, kill the process) => It does not stop anything or alert it blocked anything, its fully silent, but I turned it off "just in case". Did not seem to help.

  3. Run sudo apt-get purge snapd before anything started working. This was the magic bullet that got everything else working. Nothing else worked on its own. This is so frustratting.

The snapd install should not be breaking networking or updates; snapd is poorly designed bloatware if that is happening.

@0xlibai
Copy link

0xlibai commented May 24, 2022

windows10 + wsl2 ran into this issue.

it can work :

change /etc/resolv.conf

# [network]
# generateResolvConf = false
#nameserver 172.18.58.17
nameserver 223.5.5.5
nameserver 223.6.6.6

@c3n21
Copy link

c3n21 commented Jun 14, 2022

I don't know if this was posted but I solved it in this way:

add in /etc/wsl.conf

[network]
generateResolvConf = false

rm /etc/resolv.conf
and
in /etc/resolv.conf add

nameserver 1.1.1.1
nameserver 1.0.0.1

on Windows 10 Pro + WSL2

@EDIflyer
Copy link

Windows 10 Home + WSL2

Able to ping IPs and hosts OK (so resolving OK) however apt update kept failing. Came off my Wireguard VPN and it worked fine (so not an AV issue) - can't quite understand why connectivity part working.

@mendesrl
Copy link

mendesrl commented Aug 5, 2022

it worked for me

Open Symantec Endpoint Protection > Network and Host Exploit Mitigation > options > Disable Network Threat Protection

image

@nachr1
Copy link

nachr1 commented Aug 14, 2022

change the mtu of eth0 to 1350. It works for me.
sudo ip link set dev eth0 mtu 1350

@nandex7
Copy link

nandex7 commented Aug 27, 2022

Checking all the steps suggested like change 8.8.8.8, adding the wsl.conf , adding the .wslconfig, or disable the firewall and antivirus doesn't work. (I was thinking to go to reinstall a new windows 11 version lol) but I tried one more time.
What worked for me was :

  1. Uninstall Docker, Vmware , Virtual Box , VPN, or any software that could be the problem. (Just in case I'm not sure if that was the reason but I advise you to start the clean possible) You can install it later you are sure it's everything working.
  2. I updated the version of windows my version was 10 build 19042 20H2
    as suggested here. https://meterpreter.org/microsoft-launched-windows-10-20h2-build-19042-541-to-fix-wsl2-error/
    Go to your windows update and try to update it in my case now I have Version 21H2 Build 19044.1889
  3. Restart your windows. Be sure you are with the new windows version
  4. Open your Terminal and try $ sudo apt update.
    image
  5. Reinstall your VPN , Docker or any other tool you need making sure is not blocking your internet connection to WSL2

@wasifsyed02
Copy link

In my case, I switched to a different isp, and update worked well. After update, I went back to my first network and everything was working well.

@thongvhoang
Copy link

Thank you. wsl --set-version Ubuntu 1 command, it worked for me.

@levz0r
Copy link

levz0r commented Oct 26, 2022

change the mtu of eth0 to 1350. It works for me. sudo ip link set dev eth0 mtu 1350

This worked for me. Before the change, eth0 was 1500.

@domattioli
Copy link

domattioli commented Nov 23, 2022

The instruction here worked for me:

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

@yokamGH
Copy link

yokamGH commented Nov 29, 2022

wsl --set-version Ubuntu 1

It also works for me

@BigBrad12
Copy link

BigBrad12 commented Dec 16, 2022

I installed Ubuntu-20.04 so for me it was: (from powershell)

wsl --set-version Ubuntu-20.04 1

appreciate the fix bro

@pranjal779
Copy link

pranjal779 commented Jan 26, 2023

I reverted to wsl1 and I am getting error at:

sudo apt update
[sudo] password for
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:4 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Err:4 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
Fetched 345 kB in 2s (197 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
132 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.cloud.google.com/apt kubernetes-xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
W: Failed to fetch https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
W: Some index files failed to download. They have been ignored, or old ones used instead.

@pranjal779
Copy link

sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

sudo apt update && sudo apt upgrade
sudo apt-get update && sudo apt-get upgrade

from kubernetes/release#1982 (comment)

but still getting error

@jonascsantos
Copy link

wsl --set-version Ubuntu 1 works for me

@pranjal779
Copy link

pranjal779 commented Feb 14, 2023

yea same for me
it worked for me

@muharremkackin
Copy link

it worked for me

Open Symantec Endpoint Protection > Network and Host Exploit Mitigation > options > Disable Network Threat Protection

Hi, I tried everything but that worked

@Extravi
Copy link

Extravi commented Feb 26, 2023

wsl --set-version Ubuntu 1 works for me

just had the same issue and this fixed it thanks :)

@abdennour
Copy link

Tragedy of 3 years. please rewrite WSL

@byMagg
Copy link

byMagg commented Mar 8, 2023

Tragedy of 3 years. please rewrite WSL

I can't believe this is not already fixed

@b-dantas
Copy link

b-dantas commented May 1, 2023

For my case, my system was wrong with date/time. Probably when apt tried to validate HTTPS based on date/time, it failing.

More info: #4114

@mjurek01
Copy link

Hello all,

I've just get same error using two different AV software. Adding bash.exe and wsl.exe to the AV whitelist resolve this problem as described in this StackOverflow thread: Link. Basically all you need to do is whitelist in firewall software (or firewall module of AV) two files - bash.exe and wsl.exe located in C:\Windows\System32 then restart PC and it's should be working. Alternative way is to launch installed distribution as a administrator.

I hope this helps someone.

@allenkenney
Copy link

allenkenney commented Oct 6, 2023

My problem was that my DNS was messed up.
Trying curl www.google.com returned:
curl: (6) Could not resolve host: www.google.com

I fixed this by switching to Google's DNS server: 8.8.8.8
Edit /etc/resolv.conf so that your nameserver is 8.8.8.8

cat /etc/resolv.conf
This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
[network]
generateResolvConf = false
nameserver 8.8.8.8

After making this change, curl www.google.com worked and I was able to run sudo apt update

@Bele2244
Copy link

wsl --set-version Ubuntu 1 worked for me, win 10 home WSL2

@OneBlue
Copy link
Collaborator

OneBlue commented May 14, 2024

Hi ! Please try the latest networking features that we've added in WSL. Those should greatly improve networking.

If the issue still remains, please reopen this issue.

@OneBlue OneBlue closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests