After wsl2 update, error 0x8007273d solution

After wsl2 update, error 0x8007273d solution

When wsl2 is updated, it may appear Error code: Wsl/Service/0x8007273d, which may be caused by the conflict between the proxy software (such as proxifier) ​​in the computer and wsl.

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-eRwTtHIL-1686657341742) (WSL2 conflict problem/images/image-20230613190305294.png)]

temporary solution

Start cmd/powershell as an administrator and run.

netsh winsock reset

This solution needs to be re-executed every time wsl is started, which is very inconvenient.

permanent solution

​ Here I found two different solutions. One is to uninstall the wsl2 update. After downgrading, there will be no conflicts, but the new features of wsl2 cannot be used; the second is to add the registry, but no need to downgrade Install, but each wsl update needs to be re-executed, because the versioning path is constantly changing, it is also difficult to tell when the application is updated.

Solution 1 wsl downgrade

  • In Add or Remove Programs: Uninstall first Windows Subsystem for Linux Update, then UninstallWindows Subsystem for Linux
  • Restart wsl, it will jump to https://aka.ms/wsl2kernel
  • Just download wsl_update_x64.msi and install again.
  • Most importantly, do not update wsl.

Solution 2 Add registry information

The main principle is to \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\add corresponding registry entries. Registry entries can use software or scripts. Here are a few demonstrations:

proxifierrequired to use the softwareNoLsp.exe

NoLsp.exeDownload link: http://www.proxifier.com/tmp/Test20200228/NoLsp.exe

  • The administrator opens it powershelland executes the following command to obtain wslthe installation directory of the app store version

    cd "C:\Program Files\WindowsApps"
    ls
    

    For example,MicrosoftCorporationII.WindowsSubsystemForLinux_1.2.5.0_x64__8wekyb3d8bbwe

  • The administrator opens it powershelland executes the following command, which is equivalent to adding the registry:

    NoLsp.exe C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\wsl.exe
    NoLsp.exe "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.2.5.0_x64__8wekyb3d8bbwe\wsl.exe"
    NoLsp.exe "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.2.5.0_x64__8wekyb3d8bbwe\wslservice.exe"
    NoLsp.exe "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.2.5.0_x64__8wekyb3d8bbwe\wslg.exe"
    NoLsp.exe "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.2.5.0_x64__8wekyb3d8bbwe\wslhost.exe"
    

If you don't want to use the software, you can run and execute powershellthe following script as an administrator, output four successes, and restart. If you don't want to restart, please use taskkill -IM "wslservice.exe" /Fkill all wsl related things.

#Requires -RunAsAdministrator
# Fix for https://github.com/microsoft/WSL/issues/4177

$MethodDefinition = @'
[DllImport("ws2_32.dll", CharSet = CharSet.Unicode)]
public static extern int WSCSetApplicationCategory([MarshalAs(UnmanagedType.LPWStr)] string Path, uint PathLength, [MarshalAs(UnmanagedType.LPWStr)] string Extra, uint ExtraLength, uint PermittedLspCategories, out uint pPrevPermLspCat, out int lpErrno);
'@

$Ws2Spi = Add-Type -MemberDefinition $MethodDefinition -Name 'Ws2Spi' -PassThru

$WslLocation = Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux | Select-Object -expand InstallLocation

$Executables = ("wsl.exe", "wslservice.exe","wslg.exe","wslhost.exe");

foreach ($Exe in $Executables) {
    $ExePath = "${WslLocation}\${Exe}";
    $ExePathLength = $ExePath.Length;

    $PrevCat = $null;
    $ErrNo = $null;
    if ($Ws2Spi::WSCSetApplicationCategory($ExePath, $ExePathLength, $null, 0, [uint32]"0x80000000", [ref] $PrevCat, [ref] $ErrNo) -eq 0) {
        Write-Output "Added $ExePath!";
    }
}

reference link

https://github.com/microsoft/WSL/issues/4177

おすすめ

転載: blog.csdn.net/weixin_44411509/article/details/131195308