DEV Community

TechFixDocs
TechFixDocs

Posted on • Originally published at techfixdocs.my.id

How to Fix: "ifconfig" gives an error on Bash on Ubuntu on Windows

Error resolving network devices in WSL Bash on Ubuntu on Windows

The Problem

The error 'cannot open /proc/net/dev (No such file or directory)' when using the command 'ifconfig' on Bash on Ubuntu on Windows (WSL) indicates that the system is unable to detect network devices. This issue can be frustrating, especially since the internet appears to be working properly despite the lack of visible network device detection.Despite the apparent functionality, this error suggests a deeper problem with the WSL configuration or the network interface manager. In this guide, we will explore the possible causes and provide steps to resolve the issue.
⚠️ Common Causes

                The primary reason for this error is that the 'ifconfig' command relies on the '/proc/net/dev' file, which is not available in WSL due to its Unix-like environment. This file is typically used in Linux systems to display information about network interfaces.Another possible cause could be a misconfiguration of the network interface or an issue with the WSL networking setup. However, this would likely result in more severe symptoms, such as failed network connections or inconsistent IP addresses.

            ✅ Best Solutions to Fix It

                Enabling Network Interface Manager

                    Step 1: Open a terminal on your WSL installation and run the command 'sudo wsl --set-default-version 2' to enable the latest version of WSL.Step 2: Next, run the command 'sudo dpkg --add-architecture i386' to add the i386 architecture, which is required for older network interface managers.Step 3: Finally, run the command 'sudo apt-get update && sudo apt-get install -f' to update and install any necessary packages.



                Setting Network Interface Manually

                    Step 1: Open a terminal on your WSL installation and run the command 'ip link show' to display a list of network interfaces.Step 2: Identify the interface you want to enable (e.g., eth0) and run the command 'sudo ip link set  up' to bring it online.


            💡 Conclusion
            To resolve the issue with 'ifconfig' not detecting network devices in WSL, try enabling the Network Interface Manager or setting the interface manually. If you encounter persistent issues, consider seeking further assistance from Microsoft support or a Linux expert.
Enter fullscreen mode Exit fullscreen mode

Full step-by-step guide with screenshots: Read the complete fix here

Found this helpful? Check out more verified tech fixes at TechFixDocs

Top comments (0)