启用 Systemd 功能后 VSCode 无法连接到 WSL2

问题描述 投票:0回答:1

一开始,我想在 WSL2 启动时自动启动 SSH 服务器。从别人的回答中我发现Systemd可以满足我的要求。因此,我通过在 wsl.conf 文件中设置 systemd = true 来启用 Systemd 功能。然后我的 vscode 无法连接到 Debian。屏幕左下角有一条“正在打开远程...”消息。我不确定发生了什么事。是否有一项服务我忘记启动了?

  • 操作系统:Windows 11
  • WSL 版本:2.0.14.0
  • Visual Studio 代码版本:1.86.2
  • WSL 扩展版本:v0.86.0
  • 发行版:Debian

一旦禁用 Systemd 功能,VSCode 就能够再次连接到 Debian。

visual-studio-code wsl-2
1个回答
0
投票

同样的事情发生在我身上,看起来 /run/user 上缺少你的 UID 文件夹,接下来的 2 个命令为我解决了这个问题:

mkdir /run/user/$UID
chown $UID /run/user/$UID
© www.soinside.com 2019 - 2024. All rights reserved.