Updating kernel is not an option, I'm getting the following message when trying to run iptables

root@mail:/etc/postfix# iptables -L
    libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/2.6.32-5-xen-amd64/modules.dep.bin'
    iptables v1.4.14: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
    Perhaps iptables or your kernel needs to be upgraded.


after running

root@mail:/home/admin#  sudo depmod

I get

ERROR: could not open directory /lib/modules/2.6.32-5-xen-amd64: No such file or directory
FATAL: could not search modules: No such file or directory

and after

root@mail:/home/admin#  sudo modinfo ip_tables

I get

libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/2.6.32-5-xen-amd64/modules.dep.bin'
ERROR: Module alias ip_tables not found.

It looks like kernel update is a must.


Did you recently upgrade the kernel on this installation? Typically iptables is built into the kernel and by default is not an external module (typically - I'm sure there are plenty of situations where that is not the case).

Try the depmod command to have the module load order recalculated; it will fix this issue on occasion:

 sudo depmod

You will need to reboot after running depmod for it to have an impact. If you get an error, please update your question with it.

Then see if ip_tables.ko is present at all:

 sudo modinfo ip_tables

If it's not loaded, try loading it:

 sudo modprobe ip_tables

Lastly, as a potentially valuable data point, see what iptables related kernel modules are in use with this command, and update your question with the details.

 cat /proc/net/ip_tables_matches

If it is just not found, try to see if the file is on the system:

 find / -name "ip_tables.ko"

If it's not, I believe you will have to at a minimum rebuild (or reinstall from packages) the kernel modules for your kernel release.

  • Did depmod fix it? Just to help anyone who stumbles by. Glad something in there worked in any case. Thanks.
    – Argonauts
    Sep 6 '16 at 11:57
  • It didn't fix it, it seems like the only thing left to do is to update the kernel.
    – Rene
    Sep 6 '16 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.