简体   繁体   English

WSL 未在 VS 代码中启动 - 尝试更新它,wsl 关闭并重新启动计算机

[英]WSL Not Starting in VS Code - tried updating it, wsl shutdown, and restarting computer

I'm getting this error regarding WSL2 not starting.我收到有关 WSL2 未启动的错误。 I've tried doing wsl --shutdown wsl in PowerShell and restarting my computer but it's still not running.我已经尝试在 PowerShell 中执行wsl --shutdown wsl并重新启动我的计算机,但它仍然没有运行。 The state in PowerShell says it's running, though, I am still getting the error. PowerShell 中的 state 表示它正在运行,但我仍然遇到错误。 If I open Ubuntu in Windows and run code.如果我在 Windows 中打开 Ubuntu 并运行code. that doesn't work either.那也不管用。 I've updated wsl to the latest version.我已经将 wsl 更新到最新版本。 Thanks for your help!谢谢你的帮助!

[2023-01-23 06:26:26.345] Starting VS Code Server inside WSL (wsl2)
[2023-01-23 06:26:26.345] Extension version: 0.72.0
[2023-01-23 06:26:26.345] Windows build: 19044. Multi distro support: available. WSL path support: enabled
[2023-01-23 06:26:26.346] No shell environment set or found for current distro.
[2023-01-23 06:26:26.507] WSL daemon log file: 
[2023-01-23 06:26:26.510] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2023-01-23 06:26:29.965] Probing result: found
[2023-01-23 06:26:29.966] Server install found in WSL
[2023-01-23 06:26:29.967] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 97dec172d3256f8ca4bfb2143f3f76b503ca0534 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=1837640582-1523319798-660006518-1171681990 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2023-01-23 06:26:30.216] Setting up server environment: Looking for /home/samtimus/.vscode-server/server-env-setup. Not found.
[2023-01-23 06:26:30.216] WSL version: 5.15.79.1-microsoft-standard-WSL2 Ubuntu
[2023-01-23 06:26:30.216] WSL-shell-PID: 13
[2023-01-23 06:26:30.216] Node executable: /home/samtimus/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/node
[2023-01-23 06:26:30.216] Starting server: /home/samtimus/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/bin/code-server --host=127.0.0.1 --port=0 --connection-token=1837640582-1523319798-660006518-1171681990 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all
[2023-01-23 06:26:30.217] VS Code Server for WSL closed unexpectedly.
[2023-01-23 06:26:30.217] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2023-01-23 06:26:30.222] C:\WINDOWS\System32\wsl.exe -d Ubuntu -e kill 13
[2023-01-23 06:26:30.546] WSL Daemon exited with code 0

PS C:\Users\User> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

PS C:\Users\User> wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

When you installed your sub-system (UBUNTU) the system created a shortcut to having direct access to the shell.当您安装子系统 (UBUNTU) 时,系统会创建一个快捷方式以直接访问 shell。

If you don't, open your PowerShell and exec BASH. If still don't, open your VSCODE on windows.如果你不这样做,打开你的 PowerShell 并执行 BASH。如果仍然不这样做,请在 windows 上打开你的 VSCODE。

Install the extension WSL EXTENSION .安装扩展WSL EXTENSION

Open a WSL terminal window (using the start menu item or by typing wsl from a command prompt / PowerShell.打开 WSL 终端 window(使用开始菜单项或从命令提示符键入 wsl / PowerShell。

Another way is.另一种方式是。 Open your VSCODE on windows, press F1 and select WSL: New WSL Window.在 windows 上打开你的 VSCODE,按 F1 和 select WSL:新 WSL Window。

I was able to figure it out with the following steps!我能够通过以下步骤弄清楚!

Within the WSL terminal, type rm -r ~/.vscode-server to delete the VS Code WSL server.在 WSL 终端中,键入 rm -r ~/.vscode-server 以删除 VS Code WSL 服务器。 Exit the terminal and from your PowerShell/Cmd, run wsl --shutdown.退出终端并从您的 PowerShell/Cmd 运行 wsl --shutdown。 Then you can log in back to your WSL and run code.然后您可以重新登录到您的 WSL 并运行代码。 and it should work normally.它应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WSL2:为什么我必须在重启 PC 后关闭 WSL 才能重新启动 WSL - WSL2: Why do I have to shutdown WSL to restart WSL after restarting PC 在 WSL Ubuntu 中使用 Chocolatey VS Code - Using Chocolatey VS Code from within WSL Ubuntu VS-Code (WSL2) 中 $PATH 环境变量的问题 - Problem with $PATH environment variable in VS-Code (WSL2) 纱线vs npm,WSL的好处 - Yarn vs npm, benefits on WSL 如何在 WSL 中添加自定义起始目录 - How to add custom starting directory in WSL VS Code 未在 WSL -2 Ubuntu 18.04 服务器中打开 - 未找到给出命令“代码” - VS Code is not open in WSL -2 Ubuntu 18.04 server - giving command 'code' not found 将 Visual Studio 代码更新到 1.6.3 后,Node.js 中的 WSL2/Ubuntu 调试中断 - WSL2/Ubuntu Debugging in Node.js Broken After Updating Visual Studio Code to 1.6.3 在 VS Code 启动时.. 自动连接到 WSL-Ubuntu,打开项目文件夹和个人文件 - On VS Code startup.. Connect automatically to WSL-Ubuntu, open project folders, and personal files 如何将 Bash on Ubuntu on Windows (WSL) 用于我的 VS Code 终端? - How do I use Bash on Ubuntu on Windows (WSL) for my VS Code terminal? VS Code 连接到 WSL Ubuntu 20.04 LTS,失败并出现错误:无法获取远程环境 - VS Code connect to WSL Ubuntu 20.04 LTS, fail with error: Could not fetch remote environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM