If you run into this on Ubuntu when trying to execute iptables on your DigitalOcean Ubuntu droplet:

modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.13.0-45-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.

the problem is that your Linux kernel installation got corrupted and, as the last line of the output suggests, you need to upgrade or to reinstall your kernel.

The iptables kernel modules (on Ubuntu) are provided by the linux-image-<base kernel version>-<ABI number>-<flavor> packages or similar packages which provide the kernel image (such as linux-image-generic-lts-utopic or linux-image-generic-lts-vivid).

Reinstall current running kernel

If you want to reinstall your kernel, you need to first check your kernel version by running:

$ uname -r
3.16.0-41-generic

or to check the full kernel version:

$ cat /proc/version_signature
Ubuntu 3.16.0-41.55~14.04.1-generic 3.16.7-ckt11

And then:

# apt-get install --reinstall linux-image-`uname -r`

Upgrade your kernel

If you want to upgrade your kernel you may search all the packages that provide the kernel with:

# apt-cache search '^linux-image-*' | grep -v "^linux-image-extra"

and after choosing the desired version and flavor (say 3.19.0-21-generic):

# apt-get install linux-image-3.19.0-21-generic

Now you have to select this kernel version in the DigitalOcean Control Panel for your droplet:

  1. Go to the droplets list, select your desired droplet
  2. Go to Settings, then Kernel
  3. Select the recently installed kernel version from the dropdown list and Change

After the kernel reinstall/upgrade

Reboot either from command-line or through Power menu. Now you can run iptables:

# iptables -L -n -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination        

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination        

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination