I am gonna make it short and simple. This issue is something I have seen on so many Debian 7 servers.
It goes like this. You’re trying to list your
iptables rules and you’re seeing weird stuff.
[email protected]~# iptables -L WARNING: Could not open 'kernel/net/netfilter/x_tables.ko': No such file or directory FATAL: Could not open 'kernel/net/ipv4/netfilter/ip_tables.ko': No such file or directory iptables v1.4.2: can't initialize iptables table filter': iptables who? (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
You go ???? and check if all the modules are installed properly, and they are. But iptables is saying it cannot find the kernel objects.
The fix is as simple as it gets
That’s it. A single command
depmod is all it takes to fix this issue
depmod fix the dependency error? Well, that is what depmod do.
depmod creates a dependecy file which will be then used by modeprobe to load all the modules correctly. By default,
depmod will probe all the modules and create a dependecy file for all of them, including the iptables module.