Problem when running iptables in Ubuntu 14

Posted November 24, 2014 9.5k views

I’m totally stuck with iptables and don’t find the way to fix it. All started when I updated the kernel version:

1) When “ufw status”, I get error

ERROR: problem running iptables: modprobe: ERROR: could not insert ‘ip_tables’: Exec format error
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.

2) When “modprobe ip_tables”, I get:

modprobe: ERROR: could not insert 'ip_tables’: Exec format error

3) I’ve upgraded to lastest available kernel in DigitalOcean: 3.16.0-23-generic

4) uname -r gets:

3.16.0-23-generic ; so it matches the kernel selected in DigitalOcean Control Panel

5) Have rebooted many times, to not result

Any idea on how to get this fixes is welcome.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

You can check installed kernel architecture:
sudo apt-cache show linux-image-`uname -r` | grep "Architecture:"
if you will see:
Architecture: i386
than you have to set 32 bit kernel in DO Control Panel.
Also you must be sure you have chosen same version that installed from apt-get.

Do you installed a matching kernel?

Verify that by listing /lib/modules or simply /boot directory

check that your arch are in sync
for ex. you could set x64 bit kernel for x32 bit installation
it will mostly work, but without kernel modules )))