Score:2

Internet connected problem wsl 2 ubuntu 22.04 (Windows Subsystem for Linux)

sj flag

Recently I installed WSL 2 Ubuntu 22.04 on my Windows 10 machine, but nothing seems to work properly, because I have no internet access. I tried a few commands and sudo apt update says 'Connection failed' and ping google.com Edition Windows 10 Enterprise Version 21H2 Installed on ‎06/‎02/‎2023 OS build 19044.2486 Experience Windows Feature Experience Pack 120.2212.4190.0

~$ sudo apt update
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
pl flag
You say you have no internet access. Does the host Windows machine have internet access?
hobbsie avatar
sj flag
Yes I can access the internet on the windows side
pl flag
Ok, I would shutdown wsl, and start it again. `wsl --shutdown`
hobbsie avatar
sj flag
I have tried wsl --shutdown but that didn't fix anything
Score:1
kp flag

I had this issue while trying to run brew update. Solved it by configuring the /etc/resolv.conf file. Run sudo nano /etc/resolv.conf.

The original file should look like this:

# 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 127.x.x.x

Change it to this:

# 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

Now save the changes CTRL O ENTER CTRL X and test if your network is working again nslookup askubuntu.com.

Score:0
mg flag

Just had this issue on Windows 10 after not using WSL2 for a while on my laptop. No internet access whatsoever.

Restarting wsl wsl --shutdown or changing the /etc/resolv.conf file did not fix the issue, neither did installing a different version of Ubuntu and running that in wsl.

For me I somehow fixed the issue by installing the Windows 10, version 22H2 update and restarting my laptop. Suddenly I have internet again. I'm not sure what version I was on before, but for anybody encountering this issue not on version 22H2 I suggest updating to that and rebooting your PC.

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.