WSL: Error The attempted operation is not supported for the type of object referenced when using virtual network adapter on wsl2

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.264] Distribution version: Ubuntu 20.04 LTS WSL 2

Steps to reproduce

  • installing WSL2
  • ubuntu 20.04 from the store
  • setting or not the distribution user.
  • Installing VPN software with virtual network adapter (i.e. Astrill) (prior or after previous steps)
  • Running distribution [tried distro’s console, microsoft terminal, terminal on vs code]

Expected behavior

Usable distro Annotation 2020-06-06 142933

Actual behavior

If a vpn software with virtual network adapter is installed, renders impossible to use the distro on the new WSL2 with error The attempted operation is not supported for the type of object referenced Annotation 2020-06-06 142348

disabling or uninstalling the virtual network adapter doesn’t change the behaviour. The only way to go back to normal is uninstalling the whole vpn software.

Opening the distro in microsoft terminal shows an additional error code 4294967295 Annotation 2020-06-06 144623

The kind of network adapter is SSL VPN Adapter

Annotation 2020-06-06 142714

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 11
  • Comments: 44 (1 by maintainers)

Most upvoted comments

Try this

wsl --shutdown
netsh winsock reset

and retry.

I am facing same issue with Open TEXT Socks Client. trying “netsh winsock reset” fixes the WSL issue but it breaks my VPN connectivity. Any other solution would be helpful

Thanks!

How is this still an issue… I was finally ready to make the switch to windows full time… please release a patch/solution for this soon. Having to reset the winsock manually and kill my vpn’s is ridiculous.

Try the NoLsp.exe solution found at https://github.com/microsoft/WSL/issues/4177#issuecomment-597736482 It magically resolved this issue for me.

Confirmed. Same issue.

After typing “netsh winsock reset”, don’t listen when it says “You must restart the computer in order to complete the reset.”

For me, it only works if I do not restart, and after I restart the problem comes back.

Try this (needs to run as Administrator)

void Main()
{
    try
    {
        var p = "C:\\windows\\system32\\wsl.exe";
        UInt32 d = 0;
        var x = WSCSetApplicationCategory(p, (UInt32)p.Length, "", 0, 0x80000000, 0x0, ref d);
        // should return 0,0
        Console.WriteLine($"{x},{d}");
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }
}

[DllImport("C:\\Windows\\System32\\ws2_32.dll")]
public static extern UInt32 WSCSetApplicationCategory(
		[MarshalAs(UnmanagedType.LPWStr)] string path,
		UInt32 len,
		[MarshalAs(UnmanagedType.LPWStr)] string param,
		UInt32 len2,
		UInt32 settings,
		UInt32 settings2,
		ref UInt32 settings3);

Try this

wsl --shutdown
netsh winsock reset

and retry.

Fixed it only for one day for me.

@hilmarf yes this does work great for me as well.

for me this solved all my trouble with WSL2 - https://github.com/MicrosoftDocs/WSL/issues/547#issuecomment-873540236 - thanks a lot @esunilkumare

Same issue on my side :

image

image

Then :

image

image

So fixed until the next reboot of my Windows 10 machine.