Dealing with iptables errors on a Raspberry Pi

Posted by Diego Assencio on 2015.04.25 under Technology (Raspberry Pi)

If you use iptables on your Raspberry Pi but after a firmware upgrade start getting an error similar to the one below:

iptables v1.4.14: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

you can handle the problem by downgrading the firmware to a version which does not have this issue. Doing this is really simple. Just go to the rpi-update repository page and choose a commit which was created before the day in which you upgraded the firmware of your Raspberry Pi. Click on this commit and then copy the sequence of characters which appears right below the commit message (for those who are unfamiliar with git, this weird-looking sequence of characters is called a commit hash and uniquely identifies a commit). To be more explicit, all you have to do is look for something like this:

commit ba4304f7bec24d5f0a4150f09a37884240f8926d2

Now open a terminal on your Raspberry Pi and run:

sudo rpi-update <commit-hash>

Here is an example with the commit hash shown above:

sudo rpi-update ba4304f7bec24d5f0a4150f09a37884240f8926d2

Reboot the Raspberry Pi and see if iptables is now working. In the unlikely case that the problem persists, just choose another commit and redo the steps above.


No comments posted yet.