microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
16.93k stars 799 forks source link

"An address incompatible with the requested protocol was used" error when trying to upgrade distro to WSL2 #5215

Closed chraaroe closed 3 years ago

chraaroe commented 4 years ago

Your Windows build number: Microsoft Windows [Version 10.0.19041.264]

What you're doing and what's happening: I followed the guide to upgrading to WSL2. No errors observed in following the official guide.

I now have an Ubuntu distro which I want to upgrade to WSL2. By Issuing the wsl --set-version Ubuntu 2 command I immediately receive the following error:

Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
An address incompatible with the requested protocol was used.

The distro works just fine. No issues to report on that front.

I have set the WSL default version to 2. If I then try to register a new distro, e.g. Alpine WSL from the Microsoft Store, I get the following error:

Temporary directory: C:\Users\CHRIST~1\AppData\Local\Temp\wsl_Alpine_setup
Downloading   : http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-minirootfs-3.11.4-x86_64.tar.gz
To local file : install.tar.gz
The current working directory is: C:\Users\CHRIST~1\AppData\Local\Temp\wsl_Alpine_setup
Error deleting file: No such file or directory
Status code : 32
Finding resource...
Connecting...
Sending request...
Mime type available
Begin download
Cache filename available
100% [====================]
End download
Downloaded OK
Hash of file install.tar.gz is: 47210239fcdd9a1dca72238f13912187cbcf0898fda2d12d4b583781279791e0

Verifying Hash: OK
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007273f
WslRegisterDistribution failed
Error: 0x8007273f An address incompatible with the requested protocol was used.

If I switch the default version back to 1 and try to register Alpine again I get the following:

Temporary directory: C:\Users\CHRIST~1\AppData\Local\Temp\wsl_Alpine_setup
Downloading   : http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-minirootfs-3.11.4-x86_64.tar.gz
To local file : install.tar.gz
The current working directory is: C:\Users\CHRIST~1\AppData\Local\Temp\wsl_Alpine_setup
File successfully deleted
Mime type available
Begin download
Cache filename available
100% [====================]
End download
Downloaded OK
Hash of file install.tar.gz is: 47210239fcdd9a1dca72238f13912187cbcf0898fda2d12d4b583781279791e0

Verifying Hash: OK
Installing, this may take a few minutes...
Executing bugfixing command: /bin/chmod 755 /
Executing bugfixing command: /sbin/apk --no-cache add shadow
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/2) Installing linux-pam (1.3.1-r1)
(2/2) Installing shadow (4.7-r1)
Executing busybox-1.31.1-r9.trigger
OK: 8 MiB in 16 packages
Executing bugfixing command: /bin/sed -i 's/^export PATH/#export PATH/' /etc/profile
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers

Before being allowed to set up my user.

What's wrong / what should be happening instead: Unable to upgrade current distros to WSL2 nor install new distro with default version set to 2. Running current WSL1 distros works just fine as well as registering new distro with version 1.

For WSL launch issues, please [collect detailed logs]: I'm unable to attach any detailed logs - all of the 3 commands to start the logging return the following error:

D:\>logman.exe create trace lxcore_service -p "{B99CDB5A-039C-5046-E672-1A0DE0A40211}" -ft 1:00 -rt -o .\lxcore_service.etl -ets

Error:
Type mismatch.
Try running this command as an administrator.

I've made sure to check it in both PowerShell and a old-school cmd prompt. I'm sure that they are both run with administrator privileges.

onomatopellan commented 4 years ago

Try netsh winsock reset from elevated PowerShell before installing any WSL2 distro.

If it doesn't work then something networking related is impeding WSL2 to run. That error is often related to IPv6 addresses when expecting IPv4. Some AV/Firewall solution or some hosts file entry could be the reason. I'd also try to open network adapter "vEthernet (WSL)" Properties and untick IPv6 protocol.

chraaroe commented 4 years ago

More information has been provided through the feedback hub: https://aka.ms/AA8hnlm

chraaroe commented 4 years ago

Hi @onomatopellan, thank you for your feedback.

Sadly, a netsh winsock reset did nothing. I still get the same error when trying to convert an existing distro to WSL2 or when installing a brand new one.

This is an entirely fresh v2004 install and I have no entries in my hosts file. I'm just running the standard Microsoft Security suite.

You mention the "vEthernet (WSL)" adapter. I'm not able to find named anything remotely similar to this anywhere on my system.

onomatopellan commented 4 years ago

It looks like Hyper-V didn't create the virtual network adapter. What do you see if you run Get-NetAdapter and Get-VMSwitch from an elevated Powershell?

Also look if there is some error in Event Viewer -> Applications and Services -> Microsoft -> Windows -> HyperV-VmSwitch-> Operational

chraaroe commented 4 years ago

Hi @onomatopellan I think you're on to something here.

The listed adapters shown via the PowerShell command is as I wrote in my last post. The output is:

PS C:\Users\ChristianRasmussen> Get-NetAdapter -Verbose

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Bluetooth Network Conn... Bluetooth Device (Personal Area Netw...      11 Disconnected 64-5D-86-92-CA-E7         3 Mbps
Wi-Fi                     Intel(R) Wireless-AC 9260 160MHz              7 Up           64-5D-86-92-CA-E3     866.7 Mbps

Looking at the list of activated features I see that none of the Hyper-V components are added. However, are they required? I thought that WSL2 was run of off the VirtualMachinePlatform component instead?

chraaroe commented 4 years ago

I've added the Hyper-V feature. Almost needless to say, but there's no warnings in Event Viewer for HyperV-VmSwitch.

Get-NetAdapter now returns:

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Bluetooth Network Conn... Bluetooth Device (Personal Area Netw...      11 Disconnected 64-5D-86-92-CA-E7         3 Mbps
vEthernet (Default Swi... Hyper-V Virtual Ethernet Adapter             35 Up           00-15-5D-66-A7-A9        10 Gbps
Wi-Fi                     Intel(R) Wireless-AC 9260 160MHz              7 Up           64-5D-86-92-CA-E3     866.7 Mbps

Get-VmSwitch is available after installing Hyper-V and now returns:

Name           SwitchType NetAdapterInterfaceDescription
----           ---------- ------------------------------
Default Switch Internal
onomatopellan commented 4 years ago

Sorry, I just checked and indeed "vEthernet (WSL)" exists during the entire session but after restarting Windows it disappears and it's created again when installing/launching a WSL2 distro. So it's normal it doesn't appear yet in your list of network adapters.

I don't know why would it show that 0x8007273f error in a fresh install. Let's wait for the team to see something on the logs.

I do know some user had problems with intel WIFI Nic though. Make sure you have the latest driver available. #4253

chraaroe commented 4 years ago

Hi @onomatopellan, thank you for checking. That might solve the mystery of the missing NIC. I did actually have a pending driver update to my Intel NIC. A small one.

I've installed it and I'm now on 21.80.2.1 which should be the latest available. All the issues I've reported up until now are still there and behaving exactly like before.

Thanks for taking your time to help with this.

chraaroe commented 4 years ago

Just a quick update. Did a fresh install of v2004 after it went live. Followed the guide once again.

Again, I manage to add WSL and the VirtualMachinePlatform features without any issues. The kernel update also installs just fine.

This time, with no installed distros beforehand, the wsl --set-default-version 2 ran without issue which led me to believe that the issue was gone. However, upon installing the Ubuntu distro I get the error:

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007273f
Error: 0x8007273f An address incompatible with the requested protocol was used.

Press any key to continue...

So it's reproducible even after reinstalling Windows.

david-redano commented 4 years ago

I am stuck with the same issue, but with Hyper-V, let's see if Docker team has a solution for this. @chraaroe just one question, which computer are you running Docker on? I have a Dell Latitude 5400.

chraaroe commented 4 years ago

Hi @dyxypyxy, I believe my issue is with Hyper-V as well. Potentially.

I'm on an aging Dell XPS 15 9530.

chraaroe commented 3 years ago

Closing this issue. Just did a fresh install today with the latest updates incorporated. It seems I'm now able to use all distros with WSL2 now.

I have no idea what caused the original issue just as I have no idea what has made the issue disappear. I've done nothing different with this install.

fschramka commented 2 years ago

Hi guys

Out of nowhere I've got exactly the same issue with WSL2. First the bash was not found, after that I tried to install a new distro and since then I've got the following error message:

WslRegisterDistribution failed with error: 0x8007273f Error: 0x8007273f An address incompatible with the requested protocol was used.

Unfortunately you don't know how it disappeared :D Now I've got no idea how to fix it...

I opened a new Issue :) #7183

azeriker commented 2 years ago

Same issue. But it helped: https://github.com/microsoft/WSL/issues/7183#issuecomment-881556850

Triopticon commented 2 years ago

This is an issue and should not have been closed. WSL2 is really broken for some reason and need to be fixed. Either there are a Windows update that did break it, or it is the WSL2 it self that is broken.

jubba2001 commented 2 years ago

Same issue. WSL2 is broken.

randomgraphics commented 2 years ago

same error. fresh installed windows, fresh installed distro.

Gabriellavoura commented 2 years ago

Same error,

Nuctori commented 2 years ago

Same error, after update windows.

TheyCallMeLinux commented 2 years ago

WSL2 is broken for me as well

mora260 commented 2 years ago

For me too. Thanks @fschramka for opening a new issue!

Ukkan commented 2 years ago

Same here

angelesosa commented 2 years ago

Same error, after update windows.

XuNing2 commented 1 year ago

Same error, didn't find the effective solution

Samuel-B-D commented 1 year ago

Issue is there on a fresh install of Windows 10 LTSC 2021 too. Can't get WSL2 working from a fresh install, nor after updates, so no way to get Docker Desktop + WSL2 working.

sdimos commented 1 year ago

I was able to resolve this issue on my end!

Had this same error, so I wiped my laptop clean of WSL and Ubuntu. Reinstalled both and ensured Hyper-V was installed on my corporate Windows 10 laptop (see doc): Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Restarted laptop.

As suggested above, I then ran netsh winsock reset from elevated PowerShell before installing any WSL2 distro: netsh winsock reset

Closed out of all Ubuntu instances, then reopened Ubuntu and it was in working order!

Not sure which part was the fix - I tried many other solutions to no avail (reinstalled many times, upgraded wsl version, etc.) - but the workflow above seemed to help me get it back to working condition.