nullpo-head / wsl-distrod

Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
MIT License
1.9k stars 90 forks source link

[Bug]: `wsl` fails when Distrod instance has been already launched, disturbing many Windows apps (e.g. Docker Desktop, Visual Studio Code) #91

Open kissge opened 9 months ago

kissge commented 9 months ago

Describe the bug

Normally running wsl in Windows starts Linux shell, but it fails when the Linux instance with Distrod has been already launched. This means: you cannot open two tabs in Windows Terminal. Furthermore, apps running on the host Windows like Docker Desktop and Visual Studio Code (via Connect to WSL) stops working as they cannot communicate with the distros.

I've been experiencing this issue since today. Maybe recent WSL2 update brought this issue.

Same issue was reported in https://github.com/microsoft/WSL/issues/10752

Steps to reproduce

  1. Set up any Linux distro using Distrod wizard.
  2. Open PowerShell and run wsl -d Distrod to start the distro.
  3. Open another PowerShell tab and run wsl -d Distrod again.

Expected behavior

Expected:

Linux shell starts.

Actual:

PS C:\Users\John> wsl -d Distrod
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: CreateProcessParseCommon:708: Failed to translate C:\Users\John
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Windows\system32
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Windows
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Windows\System32\Wbem
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Windows\System32\WindowsPowerShell\v1.0\
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Windows\System32\OpenSSH\
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Program Files\dotnet\
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Program Files\Docker\Docker\resources\bin
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Users\John\AppData\Local\Microsoft\WindowsApps
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Users\John\AppData\Local\Programs\Microsoft VS Code\bin
<3>WSL (183) ERROR: No such file or directory @D:/a/1/s/src/linux/mountutil\mountutilcpp.h:17 (MountEnum)
<3>WSL (183) ERROR: UtilTranslatePathList:2853: Failed to translate C:\Users\John\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-6.0-full_build\bin
distrod 0.1.7

USAGE:
    -zsh [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -l, --log-level <log-level>    Log level in the env_logger format. Simple levels: trace, debug, info(default), warn,
                                   error

SUBCOMMANDS:
    create
    disable
    enable
    exec
    help       Prints this message or the help of the given subcommand(s)
    start
    stop

Windows version

Version 22H2 (OS Build 22621.2715)

$ wsl.exe --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2715

Linux kernel version

Linux XXX 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 GNU/Linux

Distro

Arch Linux

How did you install that distro?

Installed by Distrod wizard

Logs

As far as I can tell, the failed attempt is not logged even with trace log level.

additional comment

joelwurtz commented 9 months ago

Same here, this error happen right after installing one of these update for windows (don't know which one particulary) KB5032190 / KB5032007 / KB5032883

PoProstuWitold commented 9 months ago

I guess the only solution is to disable distrod (as is no longer needed since Microsoft added native systemd support) as @kissge wrote and then enable systemd it in wsl.conf.

shscs911 commented 9 months ago

Is there any way to migrate an existing Distrod instance to native WSL one without losing installed apps and data?

panuhorsmalahti commented 8 months ago

I'm also seeing this. Current workaround is to downgrade to WSL 1.3.17.0.

robertsi commented 8 months ago

same here...I can open one terminal with wsl arch linux....all other fails with

<3>WSL (233) ERROR: UtilTranslatePathList:2853: Failed to translate c:\somefile... distrod 0.1.4 I can do wsl --shutdown....then first terminal will open ok...all others will fail
GriwMF commented 8 months ago

I guess the only solution is to disable distrod (as is no longer needed since Microsoft added native systemd support) as @kissge wrote and then enable systemd it in wsl.conf.

This is actually a workaround solution worked for me. sudo /opt/distrod/bin/distrod disable to disable Distrod add

[boot]
systemd=true

to /etc/wsl.conf And restart with wsl.exe --shutdown

dgreenwald-ccs commented 8 months ago

Also you can install any of the linux distros at linuxcontainers.org without distrod by simply downloading the root.tar.xz and running something like: wsl.exe --import AL2 c:\users\username\wsl\ C:\Users\username\Downloads\rootfs.tar.xz

Example image found here: https://images.linuxcontainers.org/images/amazonlinux/2/amd64/default/

Combined with the built-in systemd support, I no longer need distrod.