problem with iptables and ubuntu Ubuntu 13.10

March 21, 2014 13k views
Hello all, When trying to check iptables i'm getting this message: $iptables -L ERROR: could not insert 'ip_tables': Operation not permitted iptables v1.4.18: can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. some more info: $lsb_release -d Description: Ubuntu 13.10 $lsmod Module Size Used by floppy 69370 0 my system uname is: $uname -r 3.11.0-18-generic I did a: $sudo apt-get install linux-image-$(uname -r) Which make the /lib/modules/3.11.0-18-generic folders rebooted and still the same.
2 comments
5 Answers
I had this problem earlier. In my case, the kernel I elected to use when booting my droplet was an *older* kernel. Then I performed various updates which included installing a *newer* kernel. When you do that, all the libraries are setup for the new kernel, but digital ocean doesn't use the new kernel, it uses the one you specify in your droplet configuration.

When I bumped the droplet configuration kernel up to the same one I had just updated to in my instance, iptables began to work again.

Now here's the key. When you get this working again, setup your kernel package to be "fixed" and not auto-upgradable. If you decide to upgrade, in the future, you have to do *both*, pick the droplet configuration kernel version you like, and then in your package manager, remove the old and pick the "fixed" package that exactly corresponds.
@Max Polk, thanks a lot for your answer.
I just found the problem.

$uname -a
3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

but

$file /sbin/init
sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),

I was running a 64bit kernel on a 32bit system.....tssss... Always check your basic stuff first...

Once shutdown and hypervisor setup to run in 32bit and the right kernel, i was ok and running again flawless.

Thanks a lot to you all.

Same problem after an upgrade.

Solved with:

apt-get install linux-image-$(uname -r)
  • Thank you @AirForceOne you saved my day. This fixes the issue. I had a slightly different error:

    iptables -L
    modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/3.13.0-32-generic/modules.dep.bin'
    iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
    Perhaps iptables or your kernel needs to be upgraded.
    
did you install ipatbles?? or varified you have it on your OS?

did you read this tut:

https://www.digitalocean.com/community/articles/how-to-set-up-a-firewall-using-ip-tables-on-ubuntu-12-04

if you have done all, then do you use root as your user or custom user?

if custom user, then make sure the user has privileges to execute commands.
@FMCB

Yes iptables is installed, which makes me be able to see this error and i'm using root to execute them.

Have another answer? Share your knowledge.