WSL: Failed to connect to login.microsoftonline.com

Windows Version

Microsoft Windows [Version 10.0.26100.3775]

WSL Version

2.4.13.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.167.4-1

Distro Version

Ubuntu 22.04

Other Software

curl https://login.microsoftonline.com hangs there. Reference https://github.com/Azure/azure-cli/issues/31221

It does not work even after I reset my PC and install Ubuntu again.

Repro Steps

Install Windows Enable WSL Install Ubuntu

Expected Behavior

Return

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://www.office.com/login#">here</a>.</h2>
</body></html>

Actual Behavior

The command hangs there forever.

Diagnostic Logs

Captured the TCP packets with pktmon start --capture --trace -p Microsoft-Windows-TCPIP -f PKtMon.etl when using curl https://login.microsoftonline.com in WSL. It seems like that there is no response from the server.

Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18

Most upvoted comments

Workaround:

Create .wslconfig with below content and restart your WSL.

[wsl2]
dnsTunneling=false

Thank you so much for the help, @OneBlue ! The root cause is identified. The application Global Secure Access causes the issue. It works after disabling it.