lsmod 在 WSL 上运行的 Debian 上给出错误:“无法获取模块列表”

m0m*_*pai 3 debian kernel-modules sysctl windows-subsystem-for-linux

当我运行lsmod或 时sudo lsmod,我收到一条错误消息:

libkmod: ERROR ../libkmod/libkmod-module.c:1655 kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
Error: could not get list of modules: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我在很多论坛上搜索过,但无法找到解决方案。我在 Linux 的 Windows 子系统上运行 Debian。

我最近还试图编辑该sysctl.conf文件以禁用ipv6。我添加了以下几行:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Run Code Online (Sandbox Code Playgroud)

当我尝试时sudo sysctl -p,它返回了这个错误:

sysctl: cannot stat /proc/sys/net/ipv6/conf/all/disable_ipv6: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv6/conf/lo/disable_ipv6: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我不确定上述 2 个错误是否相关。我试图在 Windows 上运行 Linux shell。有什么解决问题的办法吗?

Ste*_*itt 5

在这两种情况下,您都在尝试与内核交互。任何运行在 WSL 上的 Linux 环境都不是运行 Linux 内核,而是运行在 Windows 内核上;所以任何与 Linux 内核(包括模块和系统控制)相关的东西都不起作用。

在 IPv6 情况下,您需要使用 Windows 的工具配置网络。