lsmod gives error: "could not get list of modules" on Debian running on WSL

5,841

In both cases, you’re trying to interact with the kernel. Any Linux environment running on WSL isn’t running a Linux kernel, it’s running on the Windows kernel; so anything tied to the Linux kernel (including modules and system controls) won’t work.

In the IPv6 case, you need to configure the network using Windows’ tools.

Share:
5,841
m0mosenpai
Author by

m0mosenpai

Information Is Power. Anonymity Is Essential. Trust Is Valuable.

Updated on September 18, 2022

Comments

  • m0mosenpai
    m0mosenpai almost 2 years

    When I run lsmod or sudo lsmod, I get an error that says:

    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
    

    I searched on a lot of forums but am unable to find a solution for this. I'm running Debian on Windows Subsystem for Linux.

    I was recently also trying to edit the sysctl.conf file for the purpose of disabling ipv6. I had added the following lines:

    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    

    And when I tried sudo sysctl -p, it returned this error:

    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
    

    I'm not sure if the above 2 errors are connected. I was trying to run Linux shell on Windows. Any solution to the problem?

  • Stephen Kitt
    Stephen Kitt about 6 years
    The workaround is to run a full Linux environment, e.g. in a VM. There are some things which you can only do with a Linux kernel, just as there are others you can only do with Windows. You need to use the appropriate tool for your requirements; WSL gives you a Linux user-space on Windows, but it isn’t Linux.