How to find interface name from /sys

It would be very rare to land on a Linux box without lspci (pciutils) installed. I faced an such rare issue today while helping a friend with his lfs machine. The network will not start because the interface eth0 is missing.

We were pretty sure we have the driver since we compiled VMXNET3 (CONFIG_VMXNET3=y) into the kernel. The first thing you would naturally do is, keep reading. is run lspci to check if the device is detected. There was no lscpi as it was a bare bone lfs system.

In the absence of lspci, When you restart network or ifup an interface and it complains the interface is missing “Device ethX does not seem to be present, delaying initialization”, you have the wrong interface name.

ifconfig -a and ip a s will show you all interfaces even if they have no IP assigned. If your system is so bare bones that you don’t have net-tools or iproute2, there are other means.

 # ls /sys/class/net/
 eno16780032  lo  sit0 


# cat /proc/net/dev

It was a case of wrong interface name in the config file. Once we find the correct interface name, the fix was a matter of renaming the config file and device name inside the config file .


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s