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 network access from WSL/Ubuntu #7141

Open
sbhatti534602210 opened this issue Jul 2, 2021 · 59 comments
Open

No network access from WSL/Ubuntu #7141

sbhatti534602210 opened this issue Jul 2, 2021 · 59 comments
Labels

Comments

@sbhatti534602210
Copy link

Microsoft Windows [Version 10.0.19043.1081]
Ubuntu 20.04.2 LTS

I worked through the instructions for installing wsl for windows 10, from:
https://docs.microsoft.com/en-us/windows/wsl/install-win10

However, I cannot connect to the internet from Ubuntu. I switched off the firewall as suggested here:
https://docs.microsoft.com/en-us/windows/wsl/faq#why-do-i-not-have-internet-access-from-wsl-

But still could not connect.

There are a few things I have tried already but they did not resolve the problem (see below).
As in the FAQ page:
https://docs.microsoft.com/en-us/windows/wsl/faq#where-can-i-provide-feedback-
I raised this through the issues tracker but did not get any response.
Can someone help with this, please? I don't know why my previous request was closed without any response.

Thanks!

From Ubuntu terminal I tried to install:

curl https://get.volta.sh | bash
(6) Could not resolve host: get.volta.sh

so I tried:
ping 8.8.8.8
ping: connect: Network is unreachable

Some of the troubleshooting steps I have tried (which did not work)

  1. Disabled the firewall.

  2. Re-installed ubuntu.

  3. BT (my internet provider), port forwarding: https://www.bt.com/help/broadband/learn-about-broadband/how-do-i-set-up-port-forwarding-on-my-bt-hub-

  4. Checked Network Connection settings
    Ethernet Properties
    vEthernet Properties (WSL)
    Hyper-V Virtual Ethernet Adapter
    Internet Protocol Version 4 (TCP/IPv4) -checked
    Internet Protocol Version 6 (TCP/IPv6) -checked
    Hyper-V Extensible Virtual Switch -unchecked

  5. Checked Device Manager (View Hidden)
    Network adapters > Hyper-V Virtual Ethernet Adapter Properties
    Device status - This device is working properly.

  6. Turn Windows features on and off
    Uncheck Windows Subsystem for Linux
    Windows needs to reboot your PC to finish the requested changes
    Recheck Windows Subsystem for Linux
    Windows needs to reboot

  7. Change the nameserver
    sudo nano /etc/resolv.conf
    '# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/resolv.conf
    '# [network]
    '# generateResolvConf = false
    nameserver xxx.xx.xx
    Change the name server to 8.8.8.8 and save the file. You should now be able to connect to the internet.
    -even restarted ubuntu, same error after restarting and the nameserver seems to be reset to default

  8. No network connection in any distribution under WSL 2 #5336 (comment)
    Open Powershell or Cmd as Administrator
    and run each of these commands:
    wsl --shutdown
    netsh winsock reset
    netsh int ip reset all
    netsh winhttp reset proxy
    ipconfig /flushdns
    Hit the Windows Key,
    type Network Reset,
    hit enter.
    You should see this window.
    Click "Reset now".
    Restart Windows

@patrick330602
Copy link

Change the nameserver
sudo nano /etc/resolv.conf
'# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/resolv.conf
'# [network]
'# generateResolvConf = false
nameserver xxx.xx.xx
Change the name server to 8.8.8.8 and save the file. You should now be able to connect to the internet.
-even restarted ubuntu, same error after restarting and the nameserver seems to be reset to default

As you can see from the comment, you should edit the /etc/wsl.conf to include the following:

[network]
generateResolvConf = false

to prevent /etc/resolv.conf to be reset.

@markko1-pro
Copy link

I'm not an expert, but I think resolv.conf does not play a role here, since resolv.conf is used only for resolving DNS names.
If pinging 8.8.8.8 (Google DNS server) directly does not work, then the issue is elsewhere.
Do you use a VPN? I think there is an ongoing issue with VPN vs WSL2

@sbhatti534602210
Copy link
Author

Thank you, @patrick330602 and @markko1-pro for getting back to me.
So should I edit the /etc/wsl.conf file?

I do not use VPN. I'm using wsl2.

@patrick330602
Copy link

So should I edit the /etc/wsl.conf file?

Yep

@sbhatti534602210
Copy link
Author

Thank you, @patrick330602.
I edited /etc/wsl.conf to add the lines:

[network]
generateResolvConf = false

I then edited the /etc/resolv.conf
to change the name server from the default :

nameserver 8.8.8.8

Closed Ubuntu, reopened it tried:

ping 8.8.8.8

and got:

ping: connect: Network is unreachable

As I understand Ubuntu should be ready to go once you install it and you should not have to edit config files. However, for me, it has not and I don't know why. And also, despite editing the config files, I still cannot connect to the internet from the WSL.

@markko1-pro
Copy link

One other thing you could try - disable your antivirus for a while and see whether it helps. I had a similar problem with Kaspersky antivirus. Thankfully our IT allowed me to remove this curse from my PC :)

@sbhatti534602210
Copy link
Author

Thank you, @markko1-pro. I did try that already as it seemed the most likely problem. However, it didn't make a difference.

I had just previously installed Ubuntu and did have connection to the internet in order to download and install packages. However, my computer crashed and I had to do a factory reset. It's after this that I have not been able to connect to the internet from the wsl. I reinstalled, then uninstalled and reinstalled Ubuntu but the problem remains.

My first thought was that it might be the firewall, my computer seems to come with a preinstalled (temporary licence) antivirus software. It had previously expired and I had removed it but with resetting the computer, it got reinstalled.

Regardless of that, I did try the steps I listed above several times, in different orders in case that made a difference. But it doesn't.

@sbhatti534602210
Copy link
Author

By the way, while this problem relates to an Ubuntu installation, I did also try a different wsl distribution, Kali. Which when you download and install from the Microsoft Store comes without any packages.
When I tried:
sudo apt update
I got a network error there as well.

@grovertb
Copy link

grovertb commented Jul 4, 2021

Until 2 days ago it worked normally, but from one moment to another the internet connection in wsl2 was blocked and I no longer have an internet connection. However, I connected the internet to my pc from another provider and if I can have an internet connection in ubuntu. But with the other internet provider I have no connection in ubuntu.

@PavelSosin-320
Copy link

@grovertb All networking utilities, including ping from systemd based distros (Ubuntu, Debian,Fedora,Suse) assume that the network stack is built around 2 services systemd-networkd for links configuration and systemd-resolved for name resolution. If these services failed to start or don't function correctly there is no chance to have networking functional. Could you try networkctl and resolvectl in both cases as a networking "smoke test"? Both services have very flexible configurations and autoconfiguration mechanisms to ensure stable networking via any infrastructure but leave resolve.conf out-of-the-game.

@craigloewen-msft
Copy link
Member

craigloewen-msft commented Jul 6, 2021

If you're seeing this issue, could you please collect networking logs and post them here in this thread?

Instructions here on how to collect these. Thanks!

Could be related to this bug: #7135

@PavelSosin-320
Copy link

I suppose that WSL provides eth0 interface to the distro in the way that is independent from Internet provider. But every ISP use its own hardware and software to connect end-machine to the global infrastructure. If network interface is swon as routable by the networkctl and resolved has sufficient DNS configuration - designated DNS is reachable then WSL does its job well but some Linux configuration is missed or can't be autoconfigured. The issues on the ISP side are also possible. MTR utility helps to know how far your can reach through the WSL VM-Host-Router-... Service provider chain.

@sbhatti534602210
Copy link
Author

@craigloewen-msft, is that directed at me or to @PavelSosin-320 / @grovertb?
Can you help with the issue I have raised?
Thanks.

@craigloewen-msft
Copy link
Member

@sbhatti534602210 that comment is to anyone who is seeing this issue where you've upgraded your Windows version and your network stops working in WSL. Collecting those logs will help us resolve this issue!

To my understanding your issue is the same as the above, so collecting logs and posting them here is the best way for us to look into this.

@sbhatti534602210
Copy link
Author

Thank you @craigloewen-msft
I followed the instructions from Step 8, Collect WSL logs.
There is no log file. It just collected a screenshot of what I did. I guess the information is automatically sent via the Feedback Hub.
Or do I need to run wpr -start wsl.wprp -filemode?

@PavelSosin-320
Copy link

@sbhatti534602210 The network stack of Ubuntu and other "mature" Linux distros is built around the 2 systemd driven services: systemd-networkd and systemd-resolved. Both services have self-documented configuration files in /etc/systemd/ folder and use the autoconfiguration mechanism. The networkctl and resolvectl allow interactive configuration and testing networking and name resolution instantly. If networkctl sees eth0 (internet) interface as "routable" then WSL provides a network to WSL VM and the internet is accessible. Otherwise, either there is a bug in the WSL Network switch or internet access is blocked by security or eth0 provisioning takes too long and ends with a timeout. In the case of routing via VPN, some additional WSL Kernel features (TUP/TAN support) may be needed or only additional configuration to make the Linux networking stack working.

@PavelSosin-320
Copy link

@benhillis The prove that WSL networking is OK and the root cause is outside WSL:
systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-07-07 07:55:50 IDT; 5h 34min ago
Docs: man:NetworkManager(8)
Main PID: 101 (NetworkManager)
Tasks: 3 (limit: 9543)
Memory: 7.8M
CGroup: /system.slice/NetworkManager.service
└─101 /usr/sbin/NetworkManager --no-daemon

Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.6964] device (eth0): state change: disconnected -> prepare (reason 'none', sys-iface-state: >
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.6967] device (eth0): state change: prepare -> config (reason 'none', sys-iface-state: 'exter>
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.6982] device (eth0): state change: config -> ip-config (reason 'none', sys-iface-state: 'ext>
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.6985] device (eth0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'e>
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.7414] device (eth0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: >
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.7416] device (eth0): state change: secondaries -> activated (reason 'none', sys-iface-state:>
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.7419] manager: NetworkManager state is now CONNECTED_LOCAL
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.7425] device (eth0): Activation: successful, device activated.
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.7429] manager: NetworkManager state is now CONNECTED_GLOBAL
Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.7431] manager: startup complete

Context:

  • systemd-genie is used as an init system

  • no VPN

  • Norton internet security is on

  • Broadband WiFi router

  • Fedora remix distro

@sbhatti534602210
Copy link
Author

Thank you @PavelSosin-320. I'm sorry, from your message I did not understand what I need to do that I have not done already. Can you specify?
Thanks

@keltia
Copy link

keltia commented Jul 31, 2021

Hello, same issue here. WSL2 reinstalled from scratch, Ubuntu (tried ArchLinux as well) freshly installed, run wsl and I get

  1. weird nameserver IP inserted into /etc/resolv.conf
  2. ip address shows that eth0as down.
roberto@WoT:~$ ip address
1: lo:  mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: bond0:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 86:e6:ce:f6:ac:34 brd ff:ff:ff:ff:ff:ff
3: dummy0:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 1e:fe:2b:f1:3e:4a brd ff:ff:ff:ff:ff:ff
4: eth0:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:15:5d:ca:74:7f brd ff:ff:ff:ff:ff:ff
5: tunl0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
6: sit0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0

and /etc/resolv.conf shows:

# 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 172.18.128.1

It used to work with 1903 and 1909 if I remember correctly.

I checked that as well and apparently systemd is not even used:

roberto@WoT:~$ systemctl status NetworkManager
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

@PavelSosin-320
Copy link

PavelSosin-320 commented Jul 31, 2021 via email

@bersbersbers
Copy link

@PavelSosin-320 (and a few others), this issue is about ping 8.8.8.8 (and most likely, any other IP) not working - this will most likely not be solved by changing DNS servers. (If ping 8.8.8.8 did work, but name resolution did not, then DNS server mights help, but that would be #4275 or #5256.)

@PavelSosin-320
Copy link

PavelSosin-320 commented Jul 31, 2021 via email

@keltia
Copy link

keltia commented Aug 2, 2021

Addendum: if I set WSL to use version 1 (wsl --set-default-version 1) and download Ubuntu 18.04, it works fine, I have the network. Trying 20.04, it does not even install from the Store. Why is there another /init (in addition to /sbin/init which is linked to systemd)?

@PavelSosin-320
Copy link

@keltia WSL1 uses Windows network stack, WSL2 has its own network stack - this is the difference. You don't need another init because all WSL distro based on mature Linux distros either use special scripts (Ubuntu) installed with the distro or have the corresponding systemd-genie package that boots and login system using systemd. Not all WSL distros in the MS Store are of the same quality. Ubuntu 20.04 is not more valuable than 18.04 because the current maintained Ubuntu version is 20.10. Almost all valuable Ubuntu packages are in the 20.10 repository today. I have no idea why MS keeps 18.04. Maybe, because it is LTS and still supported by Canonical.

@keltia
Copy link

keltia commented Aug 3, 2021

@PavelSosin-320 my point is that I don't understand why it makes such a difference, it was definitely working in WSL2 a few months ago now it doesnt. Switching to WSL1 (which I didn't run before) makes it work, I'm puzzled.

@PavelSosin-320
Copy link

PavelSosin-320 commented Aug 4, 2021

@keltia WSL1 and WSL2 use different networking stack because WSL2 VM uses its own Linux Kernel. Linux networking is provided by the Linux Kernel (keep it updated using wsl --update!!!) and several Linux services heavily dependent on the Kernel version capability and distro's version. These Linux packages are the most frequently updated part of Linux in our days due to fast infrastructure changes and security requirements. Windows 11 is a good example of poor reaction on Internet infrastructure changes. WSL1 has no own Linux Kernel and uses Windows networking stack. It changes very slow and today it lags many years behind the current Internet infrastructure state of technology. Microsoft upgraded Windows networking to offer Microsoft 365 but left WSL2 behind.

@PavelSosin-320
Copy link

I just did the same as keltia and the results were very poor: I got my ISP's DNS - the rust piece of iron maintained occasionally with regular long downtimes and hours long synchronisation lag. It doesn't support the basic security features except "antivirus" for extra money. The communication cost of using GoogleDNS, Cloudfare or Quad9 is neglectable for me.

@PavelSosin-320
Copy link

In addition: I just configure my Win 11 to use Quad9 IPV6 as primary IPV6 DNS and Cloudfare IPV6 DNS as alternative IPV6 DNS. My browsers are cruising!
The current WSL Kernel passes IPV6 OK:
test -f /proc/net/if_inet6 && echo "Running kernel is IPv6 ready"
Running kernel is IPv6 ready -no work is needed here.

@simsrw73
Copy link

simsrw73 commented Mar 22, 2022

This same issue affects Windows Sandbox. No internet connectivity. There is no vEthernet adapter. Tried creating one, but it won't connect: unidentified network. I've got two machines side-by-side with fresh installs of windows, updated, no other software. One works and one does not. Only difference is hardware. Maybe something about the ethernet controller or driver that Hyper-V doesn't like? I can get a working vEthernet by connecting to my wifi adapter, but still no connect in wsl2 or sandbox.

@simsrw73
Copy link

I got it working by not using ethernet adapter and using wifi adapter. It was mentioned in one of these billion Issues logged on the subject, but I couldn't get it working the first time I tried. I uninstalled all the virtualization features & wsl. I then installed only Hyper-V. Created my wifi v switch and made sure it was working. (Here, I also tried creating an ethernet v switch, but it would not connect: Unidentified network. I wish I had a different ethernet card to plug in and test. I think the problem is tied to the ethernet card in use or it's driver.) Then I installed Sandbox & WSL + Ubuntu. Now it is all working. Not correctly. It's a stupid workaround that I don't won't to use. I don't want to use wifi for this, and prefer to have my wifi disabled on the computer. The ethernet adapter on the other computer sitting next to me works just fine, out of the box. Why not this one?

@ApoorvaPasbola
Copy link

I updated the /ect/wsl.conf with
[network]
generateResolvConf = false
then closed the wsl window and ran wsl --shutdown in powershell. Now the /etc/resolv.conf is not being created on opening wsl. But I cant update the namespace 8.8.8.8 because the file does not exist :(

@ApoorvaPasbola
Copy link

finally got it working :)
I did the following to get it running. Open wsl and run the following commands:

  • sudo rm /etc/resolv.conf
    sudo bash -c 'echo "nameservers 8.8.8.8" > /etc/resolv.conf'
    sudo bash -c 'echo "[network]" > /etc/wsl.conf'
    sudo bash -c 'echo "generateResolvConf=false" >> /etc/wsl.conf'
    sudo chattr +i /etc/resolv.conf
  • close wsl. Open powershell and run wsl --shutdown
  • Open wsl and try ping www.google.com or sudo cat /etc/resolv.conf. To check network and values of .conf

@vadimkantorov
Copy link

My probably related report: #8299

My current workaround: open a new WSLv1 tab and ping google.com in it, then the old WSLv1 bash processes start to work somehow, but maybe it's a coincidence

@RayvRavensberg
Copy link

I have the same problem. Tried all steps above. I found out that if I switched to Wifi that my problem is resolved.. I still don't know why the ubuntu doesnt have internet on cable internet.. it's only the cable internet that has the problem.

@ph-fox
Copy link

ph-fox commented Jun 22, 2022

I have the same problem but I fixed it by changing the Program Files\Windows Apps folder ownership.

@dragonblack4942
Copy link

hello i have some problem my network manager not enable and my network manager not detect any wifi i tried every method to make network manager detect my windows wifi but is fail im using kali linux version 2022.2 and wsl 2 version 5.10.102.1-microsoft-standard-WSL2 please help me i want using kali linux for test spring4shell but docker need connection to wifi
Screenshot (4)
maybe you want look the screenshot
Screenshot (5)
i have enable systemctl but the problem come after systemctl enable please help me

@b1ek
Copy link

b1ek commented Aug 8, 2022

Some other network driver is blocking WSL network. Uninstalling my VPN app solved the problem

@CliveUnger
Copy link

I had the same exact problem as the OP @sbhatti534602210, and even tried all of the things they tried. What finally worked for me was suggested in this thread: https://superuser.com/a/1733426/1725434 . They suggest decompressing the files in %TEMP%. I did that, and WSL2 networking works again! The only modification I made was to run cmd.exe as Admin.

My system was running low on hard drive space so I think Windows 10 started to compress files automatically to save space.
You can stop Windows from doing this for a folder by following this: https://answers.microsoft.com/en-us/windows/forum/all/files-in-windows-10-automatically-compressing/491e517b-e5e9-44e7-8012-0f49f7696d6b

Or you can disable the auto-compression system-wide by running fsutil behavior set disablecompression 1 in PowerShell, although I am not sure if this is a recommended approach.

Hope this helps others.

@stojan-jovic
Copy link

For those that using Comodo antivirus/firewall, you definitely need to disable firewall (like suggested by many) in order to make network working in WSL Ubuntu.

@arnabbiswas1
Copy link

I was facing this issue only under corporate firewall (Zscaler). Otherwise, WLS Ubuntu was able to connect to the network.

As suggested in this thread, some interaction of Hyper-V or Hyper-V plus docker desktop was the root cause for me. The steps I took:

  • Uninstalled the distribution: wsl --unregister
  • Disable Hyper-V (From Windows Features On & Off )
  • Restart the laptop
  • wsl --install

System reboots at this level. When I try to start the ubuntu app on my laptop, it fails with error 0x80370102. In this thread, someone suggests to enable Hyper-V to avoid this error. But, this solution worked for me:

wsl --set-default-version 1

That's it. Once installation is over, there is no networking issue even when it's behind corporate firewall.

However, I will suggest to try the following simple steps first:

  • Disable Hyper-V (From Windows Features On & Off )
  • Restart the laptop
  • Check if internet is working.

@lukexodus
Copy link

Try to use another wi-fi router. I've also done all the steps you've done and they haven't fixed the problem. After using another router (a pocket wifi actually) wsl connects now to the internet. So, I concluded that the problem was on my router, not on wsl or my computer...

@deckyfx
Copy link

deckyfx commented Oct 12, 2023

happened to me today, is there no solution?

@keith-horton
Copy link
Member

If you are having name resolution issues, please look at troubleshooting documentation we just added here: https://github.com/MicrosoftDocs/WSL/blob/main/WSL/troubleshooting.md#troubleshooting-dns-in-wsl.

It walks through some configurations which can break name resolution from the WSL container - as well as a work around for an HNS issue which can also break connectivity.

@keith-horton
Copy link
Member

There are compatibility issues with some VPNs which want to see all packets from the top of the stack.

Some compat issues with VPNs can be addressed by updating the interface metrics so the vNIC for WSL is more preferred than the VPN interface. We document this https://learn.microsoft.com/en-us/windows/wsl/troubleshooting, see the sections "WSL has no network connectivity once connected to a VPN" and "Cisco Anyconnect VPN issues with WSL in NAT mode".

@Puvipavan
Copy link

Puvipavan commented Nov 18, 2023

The solution worked for me is(I do not use Hyper-V, Maybe you could do other way around if you use Hyper-V):

  • Turn on Hyper-V from the Windows Features
  • Restart
  • Turn off Hyper-V from the Windows Features
  • Restart

Turning on Hyper-V does some magic :P I had to do the same after installing updates too.

Note: I wasn't experiencing name resolution issue

@vadimkantorov
Copy link

vadimkantorov commented Nov 21, 2023

@keith-horton This has just occurred for me after months of this being not happening:

  1. After recovery from hibernate on a different Wi-Fi network, in cmd.exe I can ping google.com
  2. in existing WSLv1 session and on new WSLv1 session, DNS lookups stopped working: Temporary failure in name resolution, ping of goolge by IP still works
  3. nslookup crashes in a bad way
  4. gdb with bt doesn't work :(
image image image image
Starting program: /usr/bin/nslookup
warning: opening /proc/PID/mem file for lwp 2496.2496 failed: No such file or directory (2)
Failed to read a valid object file image from memory.
[New LWP 2499]
> google.com
;; UDP setup with fec0:0:0:ffff::1#53(fec0:0:0:ffff::1) for google.com failed: invalid file.
;; UDP setup with fec0:0:0:ffff::1#53(fec0:0:0:ffff::1) for google.com failed: invalid file.
;; UDP setup with fec0:0:0:ffff::1#53(fec0:0:0:ffff::1) for google.com failed: invalid file.
;; UDP setup with fec0:0:0:ffff::2#53(fec0:0:0:ffff::2) for google.com failed: invalid file.
;; UDP setup with fec0:0:0:ffff::3#53(fec0:0:0:ffff::3) for google.com failed: invalid file.
task.c:805: INSIST((task->events).head != (event)) failed, back trace
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x32b13)[0x7fffff212b13]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(isc_assertion_failed+0x10)[0x7fffff212780]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(isc_task_run+0x422)[0x7fffff239fd2]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x2653e)[0x7fffff20653e]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x26cb7)[0x7fffff206cb7]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x26ed6)[0x7fffff206ed6]
/lib/x86_64-linux-gnu/libuv.so.1(+0x91ed)[0x7ffffec891ed]
/lib/x86_64-linux-gnu/libuv.so.1(+0x2511e)[0x7ffffeca511e]
/lib/x86_64-linux-gnu/libuv.so.1(uv_run+0x678)[0x7ffffec8ec88]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x2734a)[0x7fffff20734a]
/lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(isc__trampoline_run+0x1a)[0x7fffff23dd4a]
/lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7ffffed54ac3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x44)[0x7ffffede5bf4]

Thread 2 "isc-net-0000" received signal SIGABRT, Aborted.
[Switching to LWP 2499]
0x00007ffffed569fc in ?? ()
(gdb) thread apply all bt

Thread 2 (LWP 2499 "isc-net-0000"):
#0  0x00007ffffed569fc in ?? ()
Backtrace stopped: Cannot access memory at address 0x7ffffbd4c3e0

Thread 1 (LWP 2496 "nslookup"):
#0  0x00007ffffed0321a in ?? ()
Backtrace stopped: Cannot access memory at address 0x7ffffffedf80
(gdb) bt
#0  0x00007ffffed569fc in ?? ()
Backtrace stopped: Cannot access memory at address 0x7ffffbd4c3e0

this is on

Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

@Puvipavan
Copy link

@vadimkantorov It's DNS issue. You need to explore about "fixing DNS issue on WSL".

@vadimkantorov
Copy link

I checked https://github.com/MicrosoftDocs/WSL/blob/main/WSL/troubleshooting.md#troubleshooting-dns-in-wsl. I don't think my situation is described there, but I don't have time/skills for a deeper investigation.

I just thought that the nslookup crash and stack trace is interesting, I don't think I saw it in this discussion, so I hope it's helpful for further people reporting. Might be it's a different flavor of DNS problems issues

@Puvipavan
Copy link

@vadimkantorov try this: #7141 (comment)

@vadimkantorov
Copy link

vadimkantorov commented Nov 21, 2023

  • the second command probably should use >> to append instead of rewriting >
  • chattr failed: chattr: Operation not supported while reading flags on /etc/resolv.conf, despite sudo
  • nslookup started timing out ;; communications error to ::1#53: timed out <- this is before wsl --shtudown
  • the first command has incorrect syntax: nameservers 8.8.8.8 instead of nameserver 8.8.8.8
  • after fixing it, the new resolv.conf started working, even without wsl --shutdown
  • some offending nameservers:
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
nameserver fec0:0:0:ffff::3

yeah, maybe the problems is that resolv.conf sometimes doesn't get regenerated after hibernate recovery on a new Wi-Fi network

@keith-horton
Copy link
Member

keith-horton commented Nov 28, 2023

I highly recommend doing this step #4 if you are using NAT and having DNS issues:

  1. The HNS Firewall rule to allow the DNS packets to shared access can become invalid, referencing a previous WSL interface identifier. This is a flaw within HNS which has been fixed with the latest Windows 11 release. On earlier releases, if this occurs, it’s not easily discoverable, but it has a simple work around:

Stop WSL
wsl.exe –shutdown
Delete the old HNS Firewall rule. This Powershell command should work in most cases: 1.Get-NetFirewallRule -Name "HNS*" | Get-NetFirewallPortFilter | where Protocol -eq UDP | where LocalPort -eq 53 | Remove-NetFirewallRule
Remove all HNS endpoints
Note: if HNS is used to manage other containers, such as MDAG or Windows Sandbox, those should also be stopped.
hnsdiag.exe delete all
Reboot or restart the HNS service
When WSL is restarted, HNS will create new Firewall rules, correctly targeting the WSL interface.

EDIT: by #4, I mean #4 from the above link for troubleshooting DNS in WSL.

@murdoc99gtp
Copy link

I got it working by not using ethernet adapter and using wifi adapter. It was mentioned in one of these billion Issues logged on the subject, but I couldn't get it working the first time I tried. I uninstalled all the virtualization features & wsl. I then installed only Hyper-V. Created my wifi v switch and made sure it was working. (Here, I also tried creating an ethernet v switch, but it would not connect: Unidentified network. I wish I had a different ethernet card to plug in and test. I think the problem is tied to the ethernet card in use or it's driver.) Then I installed Sandbox & WSL + Ubuntu. Now it is all working. Not correctly. It's a stupid workaround that I don't won't to use. I don't want to use wifi for this, and prefer to have my wifi disabled on the computer. The ethernet adapter on the other computer sitting next to me works just fine, out of the box. Why not this one?

I know this thread is a few years old. Was there a fix determined for this issue? I am having the exact same issue with the same board series, ROG Strix Z690-E Gaming motherboard on Windows 11. The z690 onboard LAN will not connect to my cisco catalyst ws-c3550. But I have four other intel chipset motherboards (z670 prime, z170, h81 & z68) that have no problem connecting.

@krnaveen14
Copy link

I faced same issue in my Work Desktop (connected to corporate network). Setting the DNS nameserver to 8.8.8.8 doesn't make sense as it would make internal sites unresolvable.

I came up the following solution as a workaround - Fix for WSL2 No Internet

1) Find DNS Server used by Windows

# 10.9.8.169 is the DNS Server in my system (Corporate Device / Network)
ipconfig /all | findstr /R "DNS\ Servers"

2) Set DNS Nameserver in WSL

sudo bash -c "echo 'nameserver <dns_server_from_prev_cmd>' > /etc/resolv.conf"

# For personal devices without DNS Server configured, use 8.8.8.8 or any other preferred resolver

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