我的 Windows 11 上安装了 wsl2(ubuntu)。
我已经在 Windows 本地主机上设置了一个 gdb 侦听器服务器,并希望从 wsl2 访问它。但我的 Windows 机器和 wsl 虚拟机似乎使用不同的网络适配器。
>ipconfig
Windows IP Configuration
Ethernet adapter vEthernet (Default Switch):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::1114:bb:d0ad:93f8%18
IPv4 Address. . . . . . . . . . . : 172.29.192.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . …Run Code Online (Sandbox Code Playgroud) 我的 WSL2 子系统中当前的内核版本是:
5.10.60.1-microsoft-standard-WSL2
Run Code Online (Sandbox Code Playgroud)
但是,我在官方 Microsoft WSL GitHub 存储库中看到有更新版本的内核:
linux-msft-wsl-5.10.102.1
Run Code Online (Sandbox Code Playgroud)
如何更新已安装的 WSL 设置中的内核?我试过这个:
wsl --update
Run Code Online (Sandbox Code Playgroud)
但它不会更新内核版本。
我已经在 Windows 11 上卸载了 wsl 并尝试使用 wsl --install 重新安装。重新启动后我收到以下错误
Failed to attach disk 'C:\Users\<User>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx' to WSL2: The system cannot find the file specified.
Error code: Wsl/Service/CreateInstance/MountVhd/ERROR_FILE_NOT_FOUND
Run Code Online (Sandbox Code Playgroud) 我正在使用 Docker Toolbox,最近我了解了使用 WSL 2 的 Docker 安装。
Hyper-V 和 WSL 2 之间有什么区别?哪个性能更好?
我有两台机器;一台台式机和一台笔记本电脑。桌面运行 WSL2 和 Windows 端的 OpenSSH 服务器。我可以从笔记本电脑连接到 SSH 服务器,没有任何问题,但无法通过 SSH 连接启动 WSL。当我运行wsl或bash打印以下消息时:The file cannot be accessed by the system. 请注意,我可以直接从桌面上的终端启动 WSL(但如果我从桌面通过 SSH 进入桌面则不能)。
这太奇怪了,我不知道可能出了什么问题。我曾尝试寻找类似的问题,但没有找到任何东西。
我在github上找到了这个文档:
不过它已经有一段时间没有更新了,所以我想知道是否有人知道 Microsoft 是否已经发布了一份技术文档来描述 WSL2 发行版作为容器的实现。
我在 Windows 11 上将 WSL2 与 Ubuntu 一起使用,并且有一个奇怪的进程,名为plan9I see with htop。
这是它的图片。
ps ax输出:
4 ? Sl 0:00 plan9 --control-socket 5 --log-level 4 --server-fd 6 --log-truncate
Run Code Online (Sandbox Code Playgroud)
谁能解释那是什么?我在互联网上没有找到任何相关内容。
我使用 Ubuntu 22.04 安装了 WSL 2。
当我尝试在 PowerShell 中检查 WSL 内核时,得到以下结果:
PS C:\Users\user> wsl --status
Default Distribution: Ubuntu-22.04
Default Version: 2
Windows Subsystem for Linux was last updated on 6/7/2022
WSL automatic updates are on.
Kernel version: 5.10.102.1
Run Code Online (Sandbox Code Playgroud)
从上面的消息中,我假设我使用的是 Linux 内核 5.10.102.1。
但是当我运行 Ubuntu 并使用 时uname -a,我得到了一个不同的 Linux 内核:
user@DESKTOP-:/mnt/c/Users/user$ uname -a
Linux DESKTOP-VMP6T3Q 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
其中表示 Linux 内核是 4.4.0。
我的问题:
这个问题与我关于使 WSL2 地址为 static 的问题有关。由于这看起来不可能,我正在尝试提出一种解决方法。
我想我可以在启动时在 WSL2 中运行一个 shell 脚本,它将 WSL2 机器的地址写入主机系统上的文件。powershell 脚本将查找该文件,并在找到后运行:
netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=<WSL2 IP>
Run Code Online (Sandbox Code Playgroud)
如果可能,我想消除在 Linux 中运行 shell 脚本的需要。
一种可能性它通过netsh interface ipv4 show neighbors。172.27.154.150 是我的 WSL2 机器的当前 IP 地址,但我不确定如何编写脚本来隔离该 IP 地址。
PS C:\Users\Nick> netsh interface ipv4 show neighbors
Interface 1: Loopback Pseudo-Interface 1
Internet Address Physical Address Type
-------------------------------------------- ----------------- -----------
224.0.0.22 Permanent
239.255.255.250 Permanent
Interface 7: Ethernet0
Internet Address Physical Address Type
-------------------------------------------- ----------------- -----------
192.168.163.2 …Run Code Online (Sandbox Code Playgroud) 当我在 WSL 上使用 Ubuntu 20.04 进行更新时,我收到以下消息:
/sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
wsl2 ×10
windows-subsystem-for-linux ×5
kernel ×2
linux ×2
networking ×2
windows ×2
docker ×1
documents ×1
gdb ×1
hyper-v ×1
macos ×1
powershell ×1
process ×1
ssh ×1
tcp ×1
ubuntu ×1
windows-10 ×1
windows-11 ×1