"ifconfig" gives an error on Bash on Ubuntu on Windows

8,002

WSL doesn't run a full Linux kernel – it only translates each individual syscall to its Windows variant. Therefore WSL doesn't need to "detect" devices the same way real Linux would, because Windows itself has already done that.

Besides, "detecting" a device is not the same thing as exposing information about it, anyway. The files in /proc/net are only for informative purposes; they are not needed for actually using the net. So it's not a big problem if they are missing.

In addition, most network programs do not care about the actual devices; they only deal with high-level functions (BSD sockets) and let the OS handle the details. Therefore, as long as WSL implements functions like socket() and connect() and sendto(), that's enough.


The situation with iwconfig is similar: the wireless devices are already managed by Windows itself; WSL just doesn't know how to translate the link information to Linux programs, but most of them do not need to know that anyway.

Besides, iwconfig is an old tool that uses the nearly-obsolete WEXT API. I suspect the developers would care more about making modern nl80211-based tools such as iw work first.

(Even many Linux drivers no longer support WEXT directly – they only emulate it on top of nl80211.)

Share:
8,002

Related videos on Youtube

Don't Root here plz...
Author by

Don't Root here plz...

Updated on September 18, 2022

Comments

  • Don't Root here plz...
    Don't Root here plz... over 1 year

    When I try using the command "ifconfig" on Bash on Ubuntu on Windows(WSL), it gives me an error like this :-

    root@example:~# ifconfig
    Warning: cannot open /proc/net/dev (No such file or directory). Limited output.

    And when I try to run "iwconfig" :-

    eth0   no wireless extensions.

    wifi0   no wireless extensions.

    lo       no wireless extensions.

    und0  no wireless extensions.

    und1  no wireless extensions.

    This leads me to believe that it hasn't detected the network devices, but then how is the internet working? Internet works well, as I've used apt-get to install apps;

    I'm no linux pro, let alone a wsl pro, so could I have a some advice on how to overcome this problem?

  • Don't Root here plz...
    Don't Root here plz... over 7 years
    Hmmm, I see. How do I do stuff like advanced network monitoring if WSL doesn't even detect the network connections/adapters? I've upvoted, but let me see if anyone else answers before accepting.
  • user1686
    user1686 over 7 years
    Either use native Windows programs (want tcpdump? use Wireshark) or wait until Microsoft improves the WSL subsystem (e.g. see issue 66, issue 239).