You are here

Solving the 'failed to open statefile /var/run/network/ifstate: No such file or directory' Error on a Debian Server


Solving the 'failed to open statefile /var/run/network/ifstate: No such file or directory' Error on a Debian Server

When your Debian server throws network issues, especially after a restart, it can bring operations to a halt. A common error that many administrators face, after commands ifup eth0 or /etc/init.d/networking restart  is:

failed to open statefile /var/run/ network/ifstate: No such file or directory

This issue, while common, can be quite vexing as it directly affects the server's connectivity. But there's hope! I've grappled with this error and have found the way out. Here's a detailed guide to restoring your network and putting this problem behind you.

The crux of this issue often lies in the missing /var/run/network directory and the /var/run/network/ifstate file. You might think that manually creating these would solve the problem (and using ifup -a does restore the network momentarily), but they vanish after every reboot.

To fix this for good, a tweak to the /etc/init.d/networking file is needed. Right after the line stating start), introduce:

start)

[ -d /var/run/network ] || mkdir /var/run/network

[ -f /var/run/network/ifstate ] || touch /var/run/network/ifstate

Once incorporated, your server's networking should work seamlessly.

In my quest for answers, I also stumbled upon suggestions to delete either /etc/udev/rules.d/85-ifupdown.rules or /lib/udev/rules.d/85-ifupdown.rules. However, in my scenario, neither of these files existed.

0 2

Share the article with your friends in social networks, maybe it will be useful to them.


If the article helped you, you can >>thank the author<<